Data Fields | |
p2ptFunM | appModFun |
The application specific Modbus function (pointer to) | |
uint8_t | options |
Configuration options of the Modbus server. | |
uint16_t | port |
The port of the Modbus server. | |
uint8_t | unit |
The unit number of the Modbus server. |
The configuration data (type) for a Modbus handling.
The application specific Modbus function (pointer to)
The function registered here must implement the user / application specific Modbus handler as thread.
A NULL value here means that there is no user / application specific Modbus handler and Modbus server functions (if any) are restricted to those defined by the weAutSys runtime.
To do any process I/O or handling through Modbus user software must provide and register an appropriate function. This user function is relieved from (almost) all communication and protocol handling: it must just consume and/or deliver the respective data. (Note that 16 bit units are in wrong endianes due to Modbus standard.)
As provided as protothread function the user software handling of a Modbus request may block or yield. In that case the next schedule would be at the next polling the open connection. That could be 100..1000ms later. This may be appropriate in special cases and with a good explanatory statement. The recommendation is to handle the request in one stint. Anyway, the data delivered by the request have to be consumed (copied) completely in the first and the data to be send have to be given completely in the last stint.
uint16_t port |
The port of the Modbus server.
This is and should be the well known Modbus port. This is only provided for future use, should it be decided to make the Modbus server port configurable.
uint8_t unit |
The unit number of the Modbus server.
If this server is to check the unit number in requests this is the only one accepted. Other wise the request's unit number and this value will be ignored (i.e. all will be accepted).
uint8_t options |
Configuration options of the Modbus server.
Bit 0 (0x01) : if set check request's unit number against .unit
Bit 1..7 : future use