|
MODBUS_SLAVE_ERR_CODE | MX_RTU_Modbus_Rtu_Slave_Init () |
| This API must be called at first. More...
|
|
MODBUS_SLAVE_ERR_CODE | MX_RTU_Modbus_Rtu_Slave_Uninit () |
| This API must be called at the end. More...
|
|
MODBUS_SLAVE_ERR_CODE | MX_RTU_Modbus_Rtu_Slave_Register (UINT8 slot, SERIAL_PORT port, INT32 slaveID, UINT16 map_size, TTY_PARAM *param, UINT32 *handle) |
|
MODBUS_SLAVE_ERR_CODE | MX_RTU_Modbus_Rtu_Slave_Unregister (UINT32 handle) |
|
MODBUS_SLAVE_ERR_CODE | MX_RTU_Modbus_Rtu_Slave_Start (UINT32 handle) |
|
MODBUS_SLAVE_ERR_CODE | MX_RTU_Modbus_Rtu_Slave_Stop (UINT32 handle) |
|
MODBUS_SLAVE_ERR_CODE | MX_RTU_Modbus_Rtu_Slave_Add_Entry (UINT32 handle, UINT8 map_type, UINT16 address, void *pUserData, pfnModbusRead, pfnModbusWrite) |
|
MODBUS_SLAVE_ERR_CODE | MX_RTU_Modbus_Rtu_Slave_Delete_Entry (UINT32 handle, UINT8 map_type, UINT16 address) |
|
Sample Code:
modbus_rtu_slave.c
- Parameters
-
[in] | slot | slot 0: Built-in COM Ports, slot 1 ~ 12: Expansion COM Ports. |
[in] | port | port 0 ~ 3. |
[in] | slaveID | RTU serial port UnitID(ie. Device ID). |
[in] | map_size | The amount of entries for each Map Type, Maximum Map Size is MODBUS_MAX_MAP_SIZE . |
[in] | param | Serial settings, e.g., baud rate, parity, flow control, etc. |
[out] | handle | A handle, like a file descriptor, stands for the rtu port. |
- Returns
- MODBUS_SLAVE_ERR_CODE
- Parameters
-
[in] | handle | A handle, like a file descriptor, stands for the rtu port. |
[in] | slot | slot 0: Built-in COM Ports, slot 1 ~ 12: Expansion COM Ports. |
[in] | port | port 0 ~ 3. |
- Returns
- MODBUS_SLAVE_ERR_CODE
- Parameters
-
[in] | handle | A handle, like a file descriptor, stands for the rtu port. |
[in] | map_type | Please refer to ModbusSlaveMapType . |
[in] | address | Modbus Address from 0x0 to 0xffff. |
[in] | pUserData | User Date for RW Callback. |
[in] | pfnModbusRead | Read Callback of the modbus address. |
[in] | pfnModbusWrite | Write Callback of the modbus address. |
- Returns
- MODBUS_SLAVE_ERR_CODE
- Note
- RW Callback's return code: ModbusSlaveReturnCode .
- Parameters
-
[in] | handle | A handle, like a file descriptor, stands for the rtu port. |
[in] | map_type | Please refer to ModbusSlaveMapType . |
[in] | address | Modbus Address from 0x0 to 0xffff, this address must be added already. |
- Returns
- MODBUS_SLAVE_ERR_CODE