|
uchar sh,f,m,r,y,x,l,k1,k2=0; //时间时分秒 日月年 星期 定时器溢出标志 两按键
uint n=2010;
uchar Rsh,Rf,Rswitch,Rr,Ry; //闹铃 日月年 时 分 开关
uint Rn=2010;
extern uchar s1[][5]={"mon ","tue ","wed ","thu ","fri ","sun ","sur "};
extern uchar s2[][10]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" };
extern uchar s3[][10]={" ","January","February","March","April","may","June","July","August","September","October","November","December"};
extern uchar s0[11]="0123456789";
extern void LCD_display(void) // 适时动态显示
{
if(k1==0)
{
if(Rswitch&&Rn==n&&Ry==y&&Rr==r&&Rsh==sh&&Rf==f)
while(Rswitch&&Rf==f)
{
if(l)
{
w_str(0,0,"the time you set");
w_str(0,1,"is stepping here!");
PWMGenEnable(PWM_BASE,PWM_GEN_1);
}
else
{
w_str(0,0,"U can turn off it");
w_str(0,1,"and refresh it !");
PWMGenDisable(PWM_BASE,PWM_GEN_1);
}
}
else
{
PWMGenDisable(PWM_BASE,PWM_GEN_1);
display_addr(0,0);
w_char(s0[n/1000]);
w_char(s0[(n%1000)/100]);
w_char(s0[(n%100)/10]);
w_char(s0[n%10]);
w_char('-');
w_char(s0[y/10]);
w_char(s0[y%10]);
w_char('-');
w_char(s0[r/10]);
w_char(s0[r%10]);
w_char(' ');
w_char('~');
w_str(12,0,s1[x]);
w_str(0,1,"Time is ");
w_char(s0[sh/10]);
w_char(s0[sh%10]);
w_char(':');
w_char(s0[f/10]);
w_char(s0[f%10]);
w_char(':');
w_char(s0[m/10]);
w_char(s0[m%10]);
}
}
if (k2==7)
{
if(k1==1)
{
w_str(0,0,"Set up the ring:");
w_str(0,1,"repress it later");
}
else if(k1==2)
{
w_str(0,0,"Set up the time:");
w_str(0,1,"repress it later");
}
}
else if(k2==0)
{
if(l)
{
if(k1==1)
{
w_str(0,0,"Set the second..");
if(Rswitch)
w_str(0,1," Ring on ");
else w_str(0,1," Ring off ");
}
if(k1==2)
{
w_str(0,0,"Set the second..");
display_addr(7,1);
w_char(s0[m/10]);
w_char(s0[m%10]);
}
}
else w_str(0,1," ");
}
else if(k2==1)
{
w_str(0,0,"Set the minute..");
if(l)
{
if(k1==1)
{
display_addr(6,1);
w_char('~');
w_char(s0[Rf/10]);
w_char(s0[Rf%10]);
}
if(k1==2)
{
display_addr(6,1);
w_char('~');
w_char(s0[f/10]);
w_char(s0[f%10]);
}
}
else w_str(0,1," ");
}
else if(k2==2)
{
w_str(0,0,"Set the hour..");
if(l)
{
if(k1==1)
{
display_addr(6,1);
|
|