初级会员

- 积分
- 100
- 金钱
- 100
- 注册时间
- 2016-10-14
- 在线时间
- 13 小时
|

楼主 |
发表于 2016-11-9 11:23:30
|
显示全部楼层
主程序里是这样
int main(void)
{
u8 adcx;
u8 t=0;
short tempature;
u8 shidu;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
LED_Init();
uart_init(115200);
delay_init();
LCD_Init();
LSENS_Init();
while(DS18B20_Init())
{
POINT_COLOR=RED;
LCD_ShowString(30,50,200,16,16,"NOT FOUND 18B20");
}
while(DHT11_Init())
{
LCD_ShowString(30,90,200,16,16,"DHT11 ERROR!");
}
POINT_COLOR=BLUE;
LCD_ShowString(30,50,200,16,16,"18B20 IS READY!");
LCD_ShowString(30,70,200,16,16,"Tempature: . C");
POINT_COLOR=GREEN;
LCD_ShowString(30,90,200,16,16,"DHT11 IS READY!");
LCD_ShowString(30,110,200,16,16,"SHIDU: %RH");
POINT_COLOR=BROWN;
LCD_ShowString(30,130,200,16,16,"LSENS_VAL: ");
while(1)
{
adcx=LSENS_Get_Val();
LCD_ShowxNum(118,130,adcx,3,16,0);
if(t%10==0)
{
tempature=DS18B20_Get_Tempature();
DHT11_Read_Data(&shidu);
POINT_COLOR=GREEN;
LCD_ShowNum(86,110,shidu,2,16);
POINT_COLOR=BLUE;
if(tempature<0)
LCD_ShowChar(118,70,'-',16,0);
else
LCD_ShowChar(118,70,' ',16,0);
LCD_ShowNum(120,70,tempature/10,2,16);
LCD_ShowNum(142,70,tempature%10,1,16);
//LSENS_Init();
}
delay_ms(10);
t++;
if(t==20)
{
LED0=!LED0;
t=0;
}
}
}
|
|