标题: 单片机串口通信 发送温速度 [打印本页]

作者: 453384985    时间: 2017-5-5 12:33
标题: 单片机串口通信 发送温速度
串口通信



  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点:温度:22 'C  湿度:33% ");
  19.                         while(!Key1);
  20.                 }
  21.                 if(!Key2)
  22.                 {
  23.                     DelayMs(10);
  24.                     if(!Key2)
  25.                     COM_Ts("B点:温度:23 'C  湿度:34% \n");
  26.                         while(!Key2);
  27.                 }
  28.                 if(!Key3)
  29.                 {
  30.                     DelayMs(10);
  31.                     if(!Key3)
  32.                     COM_Ts("A点:温度:22 'C  湿度:33% B点:温度:23 'C  湿度:34% \n");
  33.                         while(!Key3);
  34.                 }
  35.         }   
  36. }
复制代码


串口通信测试.rar

41.45 KB, 下载次数: 3, 下载积分: 黑币 -5

串口通信






欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1