The Siemens LOGO! devices do support Modbus over TCP/IP. Those devices are helpful in case 230VAC must be switched in context of the model railroad.
The Modbus protocol is very straight forward and therefor easy to implement.
Serial Modbus devices can be connected by a gateway.
The IP prefix. If not set, the IP of the Rocrail server will be used.
The default Modbus registered port number 502 will be used in case of zero.
Poll discrete inputs.
Poll holding registers.
Poll analog registers.
Poll coil output state.
Pause in ms between the polling requests.
The last part of the device its IP address.
Both ranges are automatically adjusted to multiples of 8.
If a range is set from zero to zero the polling for that type is disabled.
The addressing is based on the IP address of the Rocrail server.
If the server hast IP address 192.168.0.120, the base IP prefix is 192.168.0.
The Rocrail object bus will be used as IP suffix, for example if an output bus is 44, the IP address will be 192.168.0.44.
A coil is a read/write output in the Modbus context, and is mapped to a Rocrail output/switch object.
The output bus is the IP suffix, and the address is the coil address.
Modbus inputs must be polled because of its master/slave architecture. (Originally RS485. Also new projects are based on RS485 like BiDiB where the GBMBoost master will do the polling.)
If a Rocrail sensor is defined for this Interface ID, the eight bit module range, 8, will be requested for this IP suffix at a fixed interval.
To activate polling the digint attribute fbpoll must be set to true. The psleep attribute is used for the polling interval in ms.
Input registers are reported as sensor default type.
Coiuls are reported as output field events.
Input registers are reported as sensor register type.
Holding registers are reported as sensor register type.
If the port is set > 1024, a Modbus service will be started; Rocrail will accept Modbus request on this port.
For all other requests an exception response will be send back.
|I||Digital Input||bit||Discrete Input||Sensor|
|M||Memory||bit||Coil||Read Sensor, Write Output|
|AI||Analog Input||word||Register||Sensor register type|
|AQ||Analog Output||word||Register||Output analog port type|
|AM||Memory||word||Holding Register||Sensor register type|