【精品】粮仓多点温度控制系统的设计与实现毕业论?- 百度文库 ر

}

delay1ms(5);

void display_time(void) { }

void Init_Timer0(void) { }

void KeyScan(void) {

P2 = 0x1f;

P0 = ~table[time1010]; delay1ms(5); P2 = 0x2f;

P0 = ~table[time10]; delay1ms(5);

TMOD=0x01; TR0=1; EA=1; ET0=1;

TH0=(65536-50000)256; TL0=(65536-50000)%6;

if(Key1 == 0) {

TR0 = 0;

delay1ms(5); if(Key1 == 0) { }

while(!Key1); time+=10;

} else if(Key2 == 0) { }

else if(Key3 == 0) { }

TR0 = 0; delay1ms(5); if(Key3 == 0) { }

while(!Key3); time_flag = 1; TR0 = 0; delay1ms(5); if(Key2 == 0) { }

while(!Key2); time-=10;

}

else if(Key4 == 0) { }

TR0 = 1; delay1ms(5); if(Key4 == 0) { }

while(!Key4); time_flag = 0;

void main(void) { }

void timer0() interrupt 1 ʱ0жϷӺ

unsigned char i; beep = 1; led = 1; Init_Timer0(); for(;;) { }

KeyScan(); if(time_flag) display_time(); else

display_temp(tempValue[ch-1]);

{

static unsigned char i = 0; TH0=(65536-50000)256; TL0=(65536-50000)%6; i++; if(i>=time) {

i = 0; ch++; if(ch==9) ch = 1;

tempValue[ch-1]=read_temp(Serial + 8*(ch-1));

if(tempValue[ch-1]==85)

tempValue[ch-1] = 20;

if(ch>1) {

if(tempValue[ch-1]>=tempValue[0]) {

tempValue[ch-1] = tempValue[ch-1] - tempValue[0]; if(tempValue[ch-1]>=10) { } else { }

beep = 1; led = 1; beep = 0; led = 0;