#include <reg52.h>
#include "1602.h"
#include "uart.h"
void SendData(void);//????????
void LCD_display(void);//LCD1602??????
void delay_ms(int xms)//????,1ms
{
unsigned char i;
for( ; xms > 0; xms--)
for(i = 110; i > 0; i--);
}
unsigned int Temperature = 0;//??????
void main()
{
RY1 = 0; RY2 = 0; //??????????
LCD1602_Init();//LCD1602???
uart_init(); //?????
//LCD1602???????????
LCD1602_Write_String(0, 1, "Temp:");
uchar m;
static uchar n;
uint TC;
init_S();
TCA[0][3]=TCA[1][3]=TCA[2][3]=TCA[3][3]='.';//???
while(1)
{
STA44((m+1)%4); //?????????
if(STAbe(m,&TC)){ //?????????
TC=TC*0.625; //????
TCA[m][0]=TC/1000%10+'0'; //???ASCII?
TCA[m][1]=TC/100%10+'0';
TCA[m][2]=TC/10%10+'0';
TCA[m][4]=TC%10+'0';
}
m=(m+1)%(sizeof(TCA)/sizeof(TCA[0]));
if(count<60){
LedGreen=c0%20<10?OFF:ON; //???????
LedRed=OFF; count++;c0++; //???
}else {LedRed=ON; LedGreen=OFF;c0=0;}//???????
SendData();//???????
LCD_display();//LCD??
delay_ms(2000);//??2s,??????2?????
}
}
|