增加RS485接口的测温传感器代码
This commit is contained in:
+6
-6
@@ -52,7 +52,7 @@ uint8_t modbusTxBuf[16]; // Modbus发鿁缓冲区
|
||||
volatile uint8_t rxFlag = 0; // 接收完成标志
|
||||
|
||||
static uint16_t temp;
|
||||
static uint16_t leve;
|
||||
static uint16_t level;
|
||||
//uint8_t UART1_Rx_flg = 0;
|
||||
/* USER CODE END PTD */
|
||||
|
||||
@@ -266,16 +266,16 @@ void get_level(void)
|
||||
int difference_3 = abs(temp_value[0]-temp_value[3]);
|
||||
|
||||
if( difference_1>=250){
|
||||
leve = 0;
|
||||
level = 0;
|
||||
}
|
||||
else if(difference_2>=250){
|
||||
leve = 1;
|
||||
level = 1;
|
||||
}
|
||||
else if(difference_3>=250){
|
||||
leve = 2;
|
||||
level = 2;
|
||||
}
|
||||
else {
|
||||
leve = 3;
|
||||
level = 3;
|
||||
}
|
||||
|
||||
// printf("%d,",difference_1);
|
||||
@@ -409,7 +409,7 @@ int main(void)
|
||||
{
|
||||
printf("%d,",temp_value[i]);
|
||||
}
|
||||
printf("%d,",leve);
|
||||
printf("%d,",level);
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user