发布时间 : 星期五 文章LCD12864单片机电子万年历程序更新完毕开始阅读
while(SureKey==0); // 等待键松 开 }
if (PlusKey==0) // 加调整 {
delay(10); // 按键消 抖
if(PlusKey==0&&w==1) {
SetTime(next); // 调整 }
while(PlusKey==0); // 等待 键松开 }
if (ReduceKey==0) // 减调整 {
delay(10); // 按键消 抖
if(ReduceKey==0&&w==1) {
SetTime(next); // 调整 }
while(ReduceKey==0); // 等 待键松开} }
void beep() { int i;
uchar hour1,min1,high,low; hour1=read_24c02add(32); min1=read_24c02add(33); high=read_24c02add(30); low=read_24c02add(31); mm=read_24c02add(34);
hour=ReadDs1302(0x85)/16*10+ReadD s1302(0x85);
min=ReadDs1302(0x83)/16*10+ReadDs 1302(0x83); i=GetTemp()/10.0;
//tt=1; if(mm==1) {
LCDTestWord(0,0x87);WriteDataLCD( 0x0e);WriteDataLCD(0x0e); }
if(mm==0)
{LCDTestWord(0,0x87);
WriteDataLCD(0x01);WriteDataLCD(0x01); }
if(((hour>6&&hour<23)&&sec==0&&min==0) &&mm==1) {
speak=0; delay(20); speak=1; delay(10); }
if((hour==hour1&&min==min1)&&mm== 1) {
speak=0; delay(20);
speak=1;delay(10); }
if((i+1>high||i speak=0; delay(150); speak=1; delay(50); } } void main() { SetKey=1; SureKey=1; PlusKey=1; ReduceKey=1; PSB=1; next=0; delayb(100); LCDInit();LCDClear(); InitDS1302(); while(1) { while(!next){ Key(); WriteCommandLCD(0x0c); DisplayYear(); // 显示年 DisplayMonth(); // 显示月 DisplayDay(); // 显示日 DisplayWeek(); // 显示星期 DisplayHour(); // 显示时 DisplayMin(); // 显示分 DisplaySec(); // 显示秒 beep(); } Key(); } }