Agile Modbus
1.1.4
Lightweight modbus protocol stack.
|
Functions | |
static uint8_t | agile_modbus_compute_meta_length_after_function (agile_modbus_t *ctx, int function, agile_modbus_msg_type_t msg_type) |
The length of the data element to be received after calculating the function code. More... | |
static int | agile_modbus_compute_data_length_after_meta (agile_modbus_t *ctx, uint8_t *msg, int msg_length, agile_modbus_msg_type_t msg_type) |
The length of data to be received after calculating the data element. More... | |
static int | agile_modbus_receive_msg_judge (agile_modbus_t *ctx, uint8_t *msg, int msg_length, agile_modbus_msg_type_t msg_type) |
Check the correctness of received data. More... | |
|
static |
The length of the data element to be received after calculating the function code.
---------- Request Indication ---------- | Client | ---------------------->| Server | ---------- Confirmation Response ---------- Take the 03 function code request message as an example ---------- ------ --------------- --------- | header | | 03 | | 00 00 00 01 | | CRC16 | ---------- ------ --------------- --------- ---------- | header | ---------- RTU: device address TCP: | transaction identifier protocol identifier length unit identifier | --------------- | 00 00 00 01 | --------------- Data element: Data related to the function code, such as 03. The function code data element contains the register starting address and register length.
ctx | modbus handle |
function | function code |
msg_type | message type |
Definition at line 88 of file agile_modbus.c.
|
static |
The length of data to be received after calculating the data element.
---------- Request Indication ---------- | Client | ---------------------->| Server | ---------- Confirmation Response ---------- Example of responding to a message with function code 03 ---------- ------ ------ --------- --------- | header | | 03 | | 02 | | 00 00 | | CRC16 | ---------- ------ ------ --------- --------- ---------- | header | ---------- RTU: device address TCP: | transaction identifier protocol identifier length unit identifier | ------ | 02 | ------ Data element: two bytes of data --------- | 00 00 | --------- data
ctx | modbus handle |
msg | message pointer |
msg_length | message length |
msg_type | message type |
Definition at line 177 of file agile_modbus.c.
|
static |
Check the correctness of received data.
ctx | modbus handle |
msg | message pointer |
msg_length | message length |
msg_type | message type |
Definition at line 224 of file agile_modbus.c.