void Timer0_Init()
{
ET0 = 1; //允许定时器0中断
TMOD = 0x11; //定时器工作方式选择
TL0 = 0xFF;
TH0 = 0x4B; //定时器赋予初值
TR0 = 1; //启动定时器
}
//定时器0中断
void Timer0_ISR (void) interrupt 1 using 0
{
uchar RHCounter;
TL0 = 0xFF;
TH0 = 0x4B; //定时器赋予初值
RHCounter++;
if(RHCounter%10==0&&BJ==1)
buzz=!buzz;
else if(BJ==0)
buzz=1;
//每2秒钟启动一次温湿度转换
if (RHCounter >= 40)
{
FlagStartRH = 1;
RHCounter = 0;
}
}
/*********************************
BASE DRIVE
**********************************/
void DELAY(unsigned int t)
{
while(t!=0)
t--;
}
/******************************
IIC DRIVE
******************************/
void IICStart(void)
{
SCL=0;
DELAY(1);
SDA=1; SCL