📄 ex6-4.c
字号:
}
if (down_button==0) {
delay();
if (down_button==0) return(3);
}
return(15);
}
//
void main (void) {
char keys;
txOK=1;
max=99;
mode=0;
operation=0;
init_LCD();
clear_LCD();
gotoxy(2,0);
display_LCD_string("20");
display=now;
display_time();
tmpday=today;
display_date();
EA=1;
com_initialize();
timer0_initialize();
IT0=1;
EX0=1;
adc_wr=0;
temp_wr=0;
adc_wr=1;
do {
keys=gotkey();
switch(keys) {
case 0 :
mode++;
if(mode==8) mode=0;
if(mode==7)
{
clear_LCD();
gotoxy(2,0);
display_LCD_string("20");
display=now;
display_time();
tmpday=today;
display_date();
}
if(mode==2)
{
clear_LCD();
gotoxy(2,2);
display_LCD_string("Send data");
}
if(mode==3)
{
clear_LCD();
gotoxy(2,2);
display_LCD_string("Get data");
}
//*************************************************
if(mode==4)
{
clear_LCD();
gotoxy(2,0);
display_LCD_string("T:");
gotoxy(2,2);
display_LCD_string("min:");
gotoxy(2,10);
display_LCD_string("max:");
}
//*****************************************
if(mode==6)
{
clear_LCD();
gotoxy(2,0);
display_LCD_string("SET heatfast: ");
}
//*****************************
gotoxy(1,12);
write_LCD_data(int2char[mode]);
if(mode==1) {
display=now;
tmpday=today;
}
if(mode==2) {
now=display;
today=tmpday;
}
break;
case 1 :
if(mode==0) break;
if(mode==1) {
operation++;
if(operation==5) operation=0;
}
//****************************************
if(mode==2) {
send_count=1;
SBUF=read_byte(0)+32;// 传送数据
for(ii=11;ii<16;ii++)
{
gotoxy(2,ii);
display_LCD_string(".");
delay();
delay();
delay();
}
}
if(mode==3) {
write_byte(0,0);
write_byte(0,0);
write_byte(1,6);
write_byte(2,today.year);
write_byte(3,today.month);
write_byte(4,today.day);
write_byte(5,now.hour);
AT93C66_add=6;
adc_wr=0;
temp_wr=1;
adc_wr=1;
for(ii=9;ii<16;ii++)
{
gotoxy(2,ii);
display_LCD_string(".");
delay();
delay();
delay();
}
}
//***************************************
if(mode==4) //设置最小温度
{
min++;
if(min==100) min=0;
t=min;
gotoxy(2,6);
t1=t/10;
write_LCD_data(int2char[t1]);
t1=t%10;
write_LCD_data(int2char[t1]);
}
//****************************************
if(mode==5) //调置最大温度
{
max++;
if(max==100) max=0;
tt=max;
gotoxy(2,14);
tt1=tt/10;
write_LCD_data(int2char[tt1]);
tt1=tt%10;
write_LCD_data(int2char[tt1]);
}
//****************************************
if(mode==6) //设置加热速度
{
heatfast++;
if(heatfast==3) heatfast=0;
gotoxy(2,14);
write_LCD_data(int2char[heatfast]);
}
gotoxy(1,14);
write_LCD_data(int2char[operation]);
break;
case 2 :
if(mode!=1) break;
switch(operation) {
case 0 : display.hour++;
if(display.hour>=24)
display.hour=0;
gotoxy(1,0);
display_LCD_number
(display.hour);
break;
case 1 : display.minute++;
if(display.minute>=60)
display.minute=0;
gotoxy(1,3);
display_LCD_number
(display.minute);
break;
case 2 : tmpday.year++;
if(tmpday.year>=100)
tmpday.year=0;
display_date();
break;
case 3 : tmpday.month++;
if(tmpday.month>12) tmpday.
month=1;
display_date();
break;
case 4 : tmpday.day++;
if(tmpday.day>monthday
(tmpday.year,
tmpday.month))
tmpday.day=1;
display_date();
break;
}
break;
case 3 :
if(mode!=1) break;
switch(operation) {
case 0 : display.hour--;
if(display.hour<0) display.hour=23;
gotoxy(1,0);
display_LCD_number(display.hour);
break;
case 1 : display.minute--;
if(display.minute<0)
display.minute=59;
gotoxy(1,3);
display_LCD_number
(display.minute);
break;
case 2 : tmpday.year--;
if(tmpday.year<0) tmpday.year=99;
display_date();
break;
case 3 : tmpday.month--;
if(tmpday.month<1) tmpday.month=12;
display_date();
break;
case 4 : tmpday.day--;
if(tmpday.day<1)
tmpday.day=monthday
(tmpday.year,tmpday.month);
display_date();
break;
}
}
} while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -