///======================US100.c=================================
#include "US100.h"
#include "systick.h"
#include "usart.h"
extern char RxCounter2,RxBuffer2[100];
char buff[100] = {0};
int tem = 0;
int distance = 0;
int index = 0;
void clear_buff2()//串口2缓存清理函数
{
int i;
for(i=0;i<100;i++)
RxBuffer2[i]=0;
RxCounter2=0;
index=0;
}
void readTembuff()//读取温度与距离 :周期36+55+5=96ms;频率约等于10hz
{
UART2_send_byte(0x55);//发送测距命令
delay_ms(36);
delay_ms(55);
UART2_send_byte(0x50);//发送测温命令
delay_ms(5);
distance = RxBuffer2[0]*256+RxBuffer2[1];
tem = RxBuffer2[2]-45;
clear_buff2();
}
========&#