You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

24 lines
462 B

#include "app_task_uart0.h"
#include "../ctask/tick.h"
#include "../msp/uart0.h"
#include "../msp/time.h"
void L3_task_uart0_modbus_handler(TS_Handle_PH4 *ph4)
{
//timer1 -> 5ms
if(ph4->ok)
{
ph4->ok = 0;
crc16(ph4->crc,ph4->buf,ph4->num - 2);
if(ph4->crc[0] == ph4->buf[ph4->num-2] && ph4->crc[1] == ph4->buf[ph4->num-1])
{
L3_ph4_common_handler((TS_PH4_modbus*)(ph4->buf));
}
else
{
L3_ph4_send_error_pkg(MODBUS_ERR_CRC);
}
}
}