这是目前我找到功能比较强大的一个电子表,特拿出来分享。文件中包含DSN文件与HEX文件。包含了流水灯,修改时间以及音乐播放的功能。
仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)
单片机源程序如下:
- #include<reg52.h>
- #include <intrins.h>
- #include <absacc.h>
- #include<lcd.h>
- #include<1302.h>
- #include<music_code.h>
- #include<SoundPlay.h>
- #include<dds.h>
- uchar code time[]={'0','1','2','3','4','5','6','7','8','9'};
- uchar code get_up[]="Time to Get up!";
- uchar code str[]="Never frown,even when you are sad,because you never know who is falling in love with your smile! To the world you may be one person,but to one person you may be the world ";
- uchar code menu[4][10]={{"Time Set"},{"Music"},{"Books"},{"Ring Set"}};
- void main()
- {
- ini();
- open();
- delay(255);
- delay(255);
- delay(255);
- delay(255);
- write_order(0x01,1);
- init_ds1302();
- set_ds1302(time_add,initial_time);
- while(1)
- {
- /*read_ring();
- if(ring_time[0]==now_time[0]&&ring_time[1]==now_time[1]&&ring_time[2]==now_time[2])
- {
- timeup();
- } */
- detect();
- write_order(0x80+0x04,1);
- for(i=0;menu[key][i]!=0;i++)
- {
- write_date(menu[key][i]);
- }
- get_ds1302();
- write_order(0x80+0x40,1);
- write_date(time[now_time[4]>>4]);
- write_date(time[now_time[4]&0x0f]);
- write_date(0x01);
- write_date(time[now_time[3]>>4]);
- write_date(time[now_time[3]&0x0f]);
- write_date(0x00);
- write_date(' ');
- write_date(' ');
- write_date(time[now_time[2]>>4]);
- write_date(time[now_time[2]&0x0f]);
- write_date(':');
- write_date(time[now_time[1]>>4]);
- write_date(time[now_time[1]&0x0f]);
- write_date(':');
- write_date(time[now_time[0]>>4]);
- write_date(time[now_time[0]&0x0f]);
- if(key==2)
- {
-
- sum=0;
- book();
- ……………………
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
基于1602 ds12b80 ds1302 音乐 电子书 流水灯的多功能电子表.rar
(58.88 KB, 下载次数: 74)
|