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.
|
|
|
#include "task_modbus.h"
|
|
|
|
#include "../msp/uart0.h"
|
|
|
|
//#include "../msp/uart2.h"
|
|
|
|
//#include "../tpc/modbus.h"
|
|
|
|
#include "../app/app_config.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void L3_task_modbus_handler(TP_Handler_X *ph4)
|
|
|
|
{
|
|
|
|
if(ph4->ok)
|
|
|
|
{
|
|
|
|
TS_PH4_modbus *ts_modbus = (TS_PH4_modbus *)ph4->buf;
|
|
|
|
//LED0 ^= 1;
|
|
|
|
ph4->ok = 0;
|
|
|
|
if(ts_modbus->slaver == G.slaver_id || ts_modbus->slaver == D_UART0_485_SLAVER_ID_BROADCAST) //从机
|
|
|
|
{
|
|
|
|
U16 acklen = L3_modbus_slaver_ack(ts_modbus,&s_uart0_ack);
|
|
|
|
L0_uart0_sendArray((U8*)&s_uart0_ack, acklen);
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//LED0 ^= 1;
|
|
|
|
L0_uart2_sendArray(s_uart0_rec.buf, s_uart0_rec.num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(ph4->yes)
|
|
|
|
{
|
|
|
|
ph4->yes=0;
|
|
|
|
L0_uart2_sendArray(s_uart0_rec.buf, s_uart0_rec.num);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|