IPC@CHIP Modbus library – API Documentation
This page lists all functions of the Modbus RTU slave API.
The API provides the creation of up to 16 different RTU slaves, specificable by the unique serial port number 0..15.
Supported Modbus function codes: 1h,2h,3h,5h,6h,10h,17h
Supported serial modes:
The application programmer has to implement/install several user-specific callback functions, which become executed on incoming Modbus master requests.
Note: Please use the provided source code sample MBRTU_SLAVE as a template for the creation of own Modbus RTU slave applications.
For accessing the serial port devices the library uses the IPC@CHIP® RTOS Fossil API.
Enable debug mode: When setting the internal variables mb_rtu_rcv_dbg and mb_rtu_snd_dbg to value 1 all incoming and outgoing messages are written to stdout.
|int||mbRTU_slv_init (MbHandle *handle, MBRTU_SLV_Init *initParams)|
|Initialize a Modbus RTU slave. |
|int||mbRTU_slv_deinit (MbHandle handle)|
|Stop and close Modbus RTU slave (and the serial port). |
|int||mbRTU_slv_loop (MbHandle handle, u16 delayMs)|
|Modbus RTU slave process loop. |
|int||mbRTU_slv_loop_stop (MbHandle handle, u32 maxWaitMs)|
|Stop Modbus RTU slave process. |