User Tools

Site Tools


modbus:modbus-en

Differences

This shows you the differences between two versions of the page.


modbus:modbus-en [2022/08/31 10:34] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== Modbus TCP/IP ======
 +[[:english#command_stations|{{  :interface.png}}]][[:english|{{  :rocrail-logo-35.png}}]]
 +[[:english|Content]] -> [[:english#command_stations|Command Stations]] ->  **[[:english#protocols|Protocols]]**
 +  * **[[:modbus:modbus-en|Modbus TCP/IP]]** 
  
 +{{http://www.modbus.org/images/logo_new.jpg}}\\
 + \\
 +=====Introduction=====
 +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.\\
 +{{:modbus:modbus-tcpip-struct.png?0x120}}{{:modbus:logo-example.png?0x120}}{{:modbus:logo-siemens.png}}{{:modbus:modbus-logo-addressing.png?0x160}}\\
 +The Modbus protocol is very straight forward and therefor easy to implement.\\
 +Serial Modbus devices can be connected by a gateway.\\
 +
 +//[[https://en.wikipedia.org/wiki/Modbus|Modbus has become a de facto standard communication protocol and is now a commonly available means of connecting industrial electronic devices.]]//
 + \\
 +
 +=====Setup General=====
 +{{:modbus:modbus-gen-en.png}}\\
 + \\
 +====IP====
 +The IP prefix. If not set, the IP of the Rocrail server will be used.\\
 +====Port====
 +The default Modbus [[http://www.iana.org/assignments/port-numbers|registered port number 502]] will be used in case of zero.\\
 +
 +====Poll options====
 +
 +===Inputs===
 +Poll discrete inputs.\\
 +===Holdings===
 +Poll holding registers.\\
 +===Registers===
 +Poll analog registers.\\
 +===Coils===
 +Poll coil output state.\\
 +===Sleep===
 +Pause in ms between the polling requests.\\
 +
 +
 + \\
 +=====Setup Devices=====
 +{{:modbus:modbus-dev-en.png}}\\
 +A device must be added if polling is required to specify which type and rage.\\
 +====Sub IP====
 +The last part of the device its IP address.\\
 +====Unit-ID====
 +Unit-ID connected to the slave.\\
 +Range in Rocrail is 0...15.\\
 +====Input/Coil range====
 +Both ranges are automatically adjusted to multiples of 8.\\
 +====Ranges====
 +If a range is set from zero to zero the polling for that type is disabled.\\
 +
 +
 +
 + \\
 +
 +=====Addressing=====
 +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/Node-ID will be used as IP suffix, for example if an output bus is **44**, the IP address will be **192.168.0.44**.\\
 +Slaves are addressed by the Object port number.\\
 +
 +====Sensor====
 +|< >|
 +^ Modbus ^ Rocrail ^
 +| SubIP | NodeID |
 +| Module | High part of address |
 +| Address | Low part of address |
 +
 +Rocrail sensor address = Module * 256 + Address\\
 +
 +====Block Interface====
 +The TrackDriver is addressed as follows:
 +|< >|
 +^ Modbus ^ Rocrail ^
 +| SubIP | NodeID |
 +| Module | Port |
 +| Register address | Address |
 +The 16bit register value range is 0...1000.\\
 +The direction is defined by bit 15.\\
 +
 +
 + \\
 +
 +=====Coils=====
 +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.\\
 +
 + \\
 +
 +=====Polling=====
 +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.\\
 +
 +====Discrete Inputs====
 +Input registers are reported as [[:sensor-int-en#type|sensor default type]].\\
 +
 +====Coils====
 +Coiuls are reported as output field events.\\
 +
 +====Input Registers====
 +Input registers are reported as [[:sensor-int-en#type|sensor register type]].\\
 +
 +====Holding Registers====
 +Holding registers are reported as [[:sensor-int-en#type|sensor register type]].\\
 + \\
 +
 +=====Service=====
 +If the port is set > 1024, a Modbus service will be started; Rocrail will accept Modbus request on this port.\\
 +Supported requests:
 +  - **Write Single Coil**, this will be evaluated as an output field event.
 +For all other requests an exception response will be send back.\\
 +
 + \\
 +=====PLC Address Types=====
 +^ Mnemonic ^ Type ^ Size ^ Modbus ^ Rocrail ^
 +|  I  | Digital Input | bit | Discrete Input | Sensor |
 +|  Q  | Digital Output | bit | Coil | Output/Switch |
 +|  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 |
 +
 +
 + \\
 +
 +=====Public Functions=====
 +{{:modbus:modbus-functions-en.png}}\\
 +
 + \\
 +=====Links=====
 +{{ :modbus:modbus-sim.png?0x200}}
 +  * http://www.modbus.org/
 +  * http://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf
 +  * http://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf
 +  * http://www.plcsimulator.org/