LCD_disp_char(10,2,0xDF);

LCD_disp_char(11,2,‘C’);

}

//阈值设置函数

void shezhi()

{

//初值

s1[3] = (char)(0X30+count1/10);

s1[4] = (char)(0X30+count1);

//初值

s2[3] = (char)(0X30+count2/10);

s2[4] = (char)(0X30+count2);

moshi=1;

if(moshi==0)

{

Delay_10us();

while(moshi==0);

moshicount++;

}

switch(moshicount)

{

case 1:

{

INC=1;DEC=1;

if(INC==0)

{

Delay_10us();

while(INC==0);

count1++;

}

else if(DEC==0)

{

Delay_10us();

while(DEC==0);

count1--;

}

LCD_disp_char(14,1,s1[3]);

LCD_disp_char(15,1,s1[4]);

LCD_disp_char(14,2,s2[3]);

LCD_disp_char(15,2,s2[4]);

}break;

case 2:

{

//moshicount=0;

INC=1;DEC=1;

if(INC==0)

{

Delay_10us();

while(INC==0);

count2++;

}

else if(DEC==0)

{

Delay_10us();

while(DEC==0);

count2--;

}

LCD_disp_char(14,1,s1[3]);

LCD_disp_char(15,1,s1[4]);

LCD_disp_char(14,2,s2[3]);

LCD_disp_char(15,2,s2[4]);

}break;

case 3:

{

moshicount=0;

LCD_disp_char(14,1,‘ ’);

LCD_disp_char(15,1,‘ ’);

LCD_disp_char(14,2,‘ ’);

LCD_disp_char(15,2,‘ ’);

}break;

default :break;

}

}

//蜂鸣器报警程序

void laba()

{

if((U8RH_data_H》=count1)||(U8T_data_H》=count2))

SPK=1;

else

SPK=0;

}

//定时器0中断程序,每次定时50ms

timer0() interrupt 1

{

TD++;

if(TD》=100)

{

TH0=-50000/256;

TL0=-50000%6;

TR0=0;

TD=0;

}

TH0=-50000/256;

TL0=-50000%6;

}

//*********主函数*****************

void main(void)

{

LCD_init();

timerinit();

Delay(4);

while(1)

{

RH();

disp();

laba();

TR0=1;

while((TD》=1)&&(TD《=100))

{

shezhi();

}

}

}

关于控制,MCU就介绍完了,您有什么想法可以联系小编。