谢谢分享!
|
|
|
|
|
void datetime_adjust(char x)
{
switch(adjust_index)
{
case 6:
if(x==1&&datetime[6]<99)datetime[6]++;
if(x==-1&&datetime[6]>0)datetime[6]--;
monthsdays[2]=runnian(2000+datetime[6]?29:28);
if(datetime[3]>monthsdays[datetime[4]])
datetime[3]=monthsdays[datetime[4]];
refresh_week_day();
break;
case 4:
if(x==1&&datetime[4]<12)
datetime[4]++;
if(x==-1&&datetime[4]>1)
datetime[4]--;
monthsdays[2]=runnian(2000+datetime[6])?29:28;
if(datetime[3]>monthsdays[datetime[4]])
datetime[3]=monthsdays[datetime[4]];
refresh_week_day();
break;
case 3:
monthsdays[2]=runnian(2000+datetime[6])?29:28;
if(x==1&&datetime[3]
datetime[3]++;
if(x==-1&&datetime[3]>0)
datetime[3]--;
refresh_week_day();
break;
case 2:
if(x==1&&datetime[2]<23)
datetime[2]++;
if(x==-1&&datetime[2]>0)
datetime[2]--;
break;
case 1:
if(x==1&&datetime[1]<59)
datetime[1]++;
if(x==-1&&datetime[1]>0)
datetime[1]--;
break;
}
}
void T0_INT() interrupt 1
{
TH0=5000/256;
TL0=5000%256;
if(++tcount!=2)return;
tcount=0;
format_datetime(datetime[6],LCD_buffer1+5);
format_datetime(datetime[4],LCD_buffer1+8);
format_datetime(datetime[3],LCD_buffer1+11);
strcpy(LCD_buffer1+13,week[datetime[5]-1]);
format_datetime(datetime[2],LCD_buffer2+5);
format_datetime(datetime[1],LCD_buffer2+8);
format_datetime(datetime[0],LCD_buffer2+11);
display_string(0x00,LCD_buffer1);
display_string(0x40,LCD_buffer2);
}
|
|
|
|
|
sdfafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafa
|
|
|
|
|