Chapter 105. Internals
The main MODBUS control thread serialises MODBUS backend processing by accepting requests from a mailbox. It parses the request data, and where valid (and supported by the user-application supplied backend) will pass the data to the relevant handler function for processing.
Since the backend handler functions are called from the main MODBUS control thread context they should NEVER block. This limits the operations that can be performed within the specific handler functions. If scheduling is required to complete an operation then control should be passed to a suitable user-application thread.
The MODBUS requests are posted to the main MODBUS control thread from the transport listener code. The transports are responsible for the specific communication layer wrapping of the MODBUS PDU packets.
Multiple transport layers can be configured and the main control loop will handle requests from all, directing responses back to the original requesting transport layer. This allows a single application (for example) to provide ModbusTCP support as well as serial line server support. Normally transport implementations would be limited to ModbusTCP, MODBUS-RTU or MODBUS-ASCII however the user could provide support for arbitrary transport mechanisms, e.g. a MODBUS-LOCALTEST special transport for doing internal memory-based loopback messaging for unit-testing.
|2018-07-27||eCosPro Non-Commercial Public License|