欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 單片機車廂檢測+上位機串口通訊仿真(Proteus仿真+源碼) [打印本頁]

作者: GaryOAO    時間: 2021-5-22 11:13
標題: 單片機車廂檢測+上位機串口通訊仿真(Proteus仿真+源碼)
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)



部分源碼
  1. #include "reg51.h"
  2. #include "intrins.h"
  3. #include "dht11.c"
  4. #include "adc.c"
  5. #include "key.c"
  6. #include "lcd1602.c"
  7. #include "UART.c"

  8. sbit LED0 = P2^3;
  9. sbit LED1 = P2^4;
  10. sbit LED2 = P2^5;
  11. sbit Buzzer = P2^6;


  12. void judge()
  13. {
  14.         if(humi_value < rh_low || humi_value > rh_high)
  15.         {
  16.                 LED0 = 0;
  17.         }
  18.         else
  19.                 LED0 = 1;
  20.         if(temp_value < temp_low || temp_value > temp_high)
  21.         {
  22.                 LED1 = 0;
  23.         }
  24.         else
  25.                 LED1 = 1;
  26.         if(co2 < co2_low || co2 > co2_high)
  27.         {
  28.                 LED2 = 0;
  29.         }
  30.         else
  31.                 LED2 = 1;
  32.         
  33.         if(humi_value < rh_low || humi_value > rh_high || temp_value < temp_low || temp_value > temp_high || co2 < co2_low || co2 > co2_high)
  34.                 Buzzer = 0;
  35.         else Buzzer = 1;
  36.                
  37. }

  38. void main()
  39. {
  40.         flcd1602_init();
  41.         InitUart();        
  42.         while(1)
  43.         {
  44.                 Display();
  45.                 DHT11_receive();
  46.                 co2 = (adc0832(0) * 12);
  47.                 key();
  48.                 judge();
  49.                 printf("T:%d,RH:%d,CO2:%d\r\n",(int)temp_value,(int)humi_value,(int)co2);
  50.         }
  51. }
復制代碼
Proteus8.8仿真程序資料51hei下載地址,大家下載一個串口調試助手調試一下看看:
上位機通訊.zip (130.27 KB, 下載次數: 40)





歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1