Agile Modbus 1.1.1
Lightweight modbus protocol stack.
|
函数 | |
static uint8_t | agile_modbus_compute_meta_length_after_function (agile_modbus_t *ctx, int function, agile_modbus_msg_type_t msg_type) |
计算功能码后要接收的数据元长度 更多... | |
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) |
计算数据元之后要接收的数据长度 更多... | |
static int | agile_modbus_receive_msg_judge (agile_modbus_t *ctx, uint8_t *msg, int msg_length, agile_modbus_msg_type_t msg_type) |
检验接收数据正确性 更多... | |
|
static |
计算功能码后要接收的数据元长度
---------- Request Indication ---------- | Client | ---------------------->| Server | ---------- Confirmation Response ---------- 以 03 功能码请求报文举例 ---------- ------ --------------- --------- | header | | 03 | | 00 00 00 01 | | CRC16 | ---------- ------ --------------- --------- ---------- | header | ---------- RTU: 设备地址 TCP: | 事务处理标识 协议标识 长度 单元标识符 | --------------- | 00 00 00 01 | --------------- 数据元: 与功能码相关的数据,如 03 功能码数据元中包含寄存器起始地址和寄存器长度
ctx | modbus 句柄 |
function | 功能码 |
msg_type | 消息类型 |
在文件 agile_modbus.c 第 88 行定义.
|
static |
计算数据元之后要接收的数据长度
---------- Request Indication ---------- | Client | ---------------------->| Server | ---------- Confirmation Response ---------- 以 03 功能码响应报文举例 ---------- ------ ------ --------- --------- | header | | 03 | | 02 | | 00 00 | | CRC16 | ---------- ------ ------ --------- --------- ---------- | header | ---------- RTU: 设备地址 TCP: | 事务处理标识 协议标识 长度 单元标识符 | ------ | 02 | ------ 数据元: 两个字节数据 --------- | 00 00 | --------- 数据
ctx | modbus 句柄 |
msg | 消息指针 |
msg_length | 消息长度 |
msg_type | 消息类型 |
在文件 agile_modbus.c 第 177 行定义.
|
static |
检验接收数据正确性
ctx | modbus 句柄 |
msg | 消息指针 |
msg_length | 消息长度 |
msg_type | 消息类型 |
在文件 agile_modbus.c 第 224 行定义.