|
串口通信
- #include <reg52.h>
- #include <stdio.h>
- #include "KEY.h"
- #include "COM.h"
- #include "Delay.h"
- static char temp[10];
- void main()
- {
- float a = 50.00;
- COMConfiguration();
- sprintf(temp,"%2.0f",a);
- while(1)
- {
- if(!Key1)
- {
- DelayMs(10);
- if(!Key1)
- COM_Ts("A点:温度:22 'C 湿度:33% ");
- while(!Key1);
- }
- if(!Key2)
- {
- DelayMs(10);
- if(!Key2)
- COM_Ts("B点:温度:23 'C 湿度:34% \n");
- while(!Key2);
- }
- if(!Key3)
- {
- DelayMs(10);
- if(!Key3)
- COM_Ts("A点:温度:22 'C 湿度:33% B点:温度:23 'C 湿度:34% \n");
- while(!Key3);
- }
- }
- }
复制代码
|
|