|
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
51hei.png (27.63 KB, 下載次數(shù): 34)
下載附件
2021-5-22 16:29 上傳
51hei截圖20210522111303.png (181.25 KB, 下載次數(shù): 48)
下載附件
2021-5-22 11:13 上傳
部分源碼- #include "reg51.h"
- #include "intrins.h"
- #include "dht11.c"
- #include "adc.c"
- #include "key.c"
- #include "lcd1602.c"
- #include "UART.c"
- sbit LED0 = P2^3;
- sbit LED1 = P2^4;
- sbit LED2 = P2^5;
- sbit Buzzer = P2^6;
- void judge()
- {
- if(humi_value < rh_low || humi_value > rh_high)
- {
- LED0 = 0;
- }
- else
- LED0 = 1;
- if(temp_value < temp_low || temp_value > temp_high)
- {
- LED1 = 0;
- }
- else
- LED1 = 1;
- if(co2 < co2_low || co2 > co2_high)
- {
- LED2 = 0;
- }
- else
- LED2 = 1;
-
- if(humi_value < rh_low || humi_value > rh_high || temp_value < temp_low || temp_value > temp_high || co2 < co2_low || co2 > co2_high)
- Buzzer = 0;
- else Buzzer = 1;
-
- }
- void main()
- {
- flcd1602_init();
- InitUart();
- while(1)
- {
- Display();
- DHT11_receive();
- co2 = (adc0832(0) * 12);
- key();
- judge();
- printf("T:%d,RH:%d,CO2:%d\r\n",(int)temp_value,(int)humi_value,(int)co2);
- }
- }
復(fù)制代碼 Proteus8.8仿真程序資料51hei下載地址,大家下載一個(gè)串口調(diào)試助手調(diào)試一下看看:
上位機(jī)通訊.zip
(130.27 KB, 下載次數(shù): 40)
2021-5-22 11:13 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|