函数Рvoid Display2(unsigned char FirstBit,unsigned char Num);//数码管2显示用户设定温度函数Рvoid Init_Timer0(void);//定时器T0初始化函数Р/*-------------------------------------------------------------------------------------Р 主函数Р---------------------------------------------------------------------------------------*/Рvoid main (void)Р{ Р unsigned int TempH,TempL,temp;Р unsigned char usertemp=20;//开机设定20度Р KEY_ADD=1; //按键输入端口电平置高Р KEY_DEC=1;Р Init_Timer0();Р while (1) //主循环Р { Р/*-----------------------------------------------------------------------------------Р 显示当前测得的温度Р--------------------------------------------------------------------------------------*/Р if(ReadTempFlag1==1)Р {Р ReadTempFlag1=0;Р temp=ReadTemperature();Р TempH=temp>>4;Р TempL=temp&0x0F;Р TempL=TempL*6/10;//小数近似处理Р Р if(TempH/10==0) //不考虑负温度