標(biāo)題: 單片機(jī)串口通信 發(fā)送溫速度 [打印本頁]

作者: 453384985    時(shí)間: 2017-5-5 12:33
標(biāo)題: 單片機(jī)串口通信 發(fā)送溫速度
串口通信



  1. #include <reg52.h>
  2. #include <stdio.h>
  3. #include "KEY.h"
  4. #include "COM.h"
  5. #include "Delay.h"

  6. static char temp[10];

  7. void main()
  8. {
  9.     float a = 50.00;
  10.     COMConfiguration();
  11.         sprintf(temp,"%2.0f",a);
  12.     while(1)
  13.         {
  14.         if(!Key1)
  15.                 {
  16.                     DelayMs(10);
  17.                     if(!Key1)
  18.                     COM_Ts("A點(diǎn):溫度:22 'C  濕度:33% ");
  19.                         while(!Key1);
  20.                 }
  21.                 if(!Key2)
  22.                 {
  23.                     DelayMs(10);
  24.                     if(!Key2)
  25.                     COM_Ts("B點(diǎn):溫度:23 'C  濕度:34% \n");
  26.                         while(!Key2);
  27.                 }
  28.                 if(!Key3)
  29.                 {
  30.                     DelayMs(10);
  31.                     if(!Key3)
  32.                     COM_Ts("A點(diǎn):溫度:22 'C  濕度:33% B點(diǎn):溫度:23 'C  濕度:34% \n");
  33.                         while(!Key3);
  34.                 }
  35.         }   
  36. }
復(fù)制代碼


串口通信測試.rar

41.45 KB, 下載次數(shù): 3, 下載積分: 黑幣 -5

串口通信






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