Modbus general
Modbus Modbus is a widely used, openly published and royalty-free Master-Slave serial line communication protocol. The Modbus specification defines the structure and handling of the messages while the physical layer of the communication is defined by EIA-485 standard. This document gives basic information about Modbus RTU and EIA-485. For detailed information about Modbus protocol visit www.modbus.org. Note that all Fläkt Woods’ devices have individual communication options, register tables and supported functions. These are not presented in this document. The individual documents can be found from www.flaktwoods.com.
Fläkt Woods
9696 GB 2015.05.19
1 (7)
Specifications are subject of alteration without further notice.
Modbus general
Basic principle of MODBUS Master / Slaves protocol Master-Slave protocol means that only one master device and one or more slave devices can be connected to the bus at a time. The communication is always started by the master. The slave does not communicate with other slaves, send request to the master or send message to the master without request from the master. In unicast mode, the master will first send a request message to a specified slave and then listen for a reply from the slave. The slave is identified by a unique address. Address range is 1-247. Master
request
reply
Slave
Slave
Slave
Figure 1: Source material: Modbus over serial line specification and implementation guide In broadcast mode, the master sends a request to all slaves. The broadcast request is send to address 0. The slaves will not sent response to broadcast request. Master
request
Slave
Slave
Slave
Figure 2: Source material: Modbus over serial line specification and implementation guide Maximum theoretical number of slave devices connected to the serial line is 247. The figure of the EIA-485 Unit load used by the device defines the actual maximum number of slaves connected to the serial line without repeater. 32 devices is allowed if the unit load per device is 1. For example the unit load for 227VM-MB, 227PM-MB, 309VM-MB and GT-MB is ¼. Therefore the maximum allowed number of the devices without repeater in a serial line is 128.
Fläkt Woods
9696 GB 2015.05.19
2 (7)
Specifications are subject of alteration without further notice.
Modbus general
Modbus data types
Modbus Frame (RTU)
Information can be stored in the Slave device in two different data types: on/off values and integers. Both of the data types have read-only and read-write options. The Modbus specification does not define use of the registers and therefore all register types might not be supported by the slave.
Modbus specification defines two different transmission modes, RTU and ASCII. The transmission mode defines a data frame of a single byte. RTU is the required transmission mode and RTU is default for all Fläkt Woods’ devices. ASCII mode is rarely supported.
Register Type Discrete Input Coil Input Register Holding Register
Data type Single bit Single bit 16-bit word 16-bit word
Master Access Read-Only Read-Write Read-Only Read-Write
RTU mode message frame is Address 1byte
Note that since fraction numbers are not supported, the values containing fractional part are often scaled to change the value to integer.
Function code 1byte
Data
CRC
End
N*1byte
2byte 3,5 char (CRC_Lbyte, CRC_Hbyte
where Address Specifies the slave. The address must be unique for each device. Function code The function code defines master’s request for the slave. The most common supported function codes are presented in table below. Function 01 02 03 04 05 06 15 16
Description Read Coils Read Discrete Inputs Read Holding Registers Read Input Registeres Write single Coil Write single Register Write Multiple Coils Write Multiple Registers
Data The data field contains information needed to carry out the request or the requested data. CRC Error checking method. Is used to detect that the raw data is not accidental changed during the transmission. End A silent interval between message frames. The silent interval must be at least 3.5 character times. This allows the device to detect that the message is completed.
Communication settings Adjustable serial parameters are baud rate, parity and stop bits. All serial parameters must be the same for all devices on a Serial line. These need to be set separately for each device. Incorrectly set parameters will prevent the slave from responding to a request from the master.
Fläkt Woods
9696 GB 2015.05.19
3 (7)
Specifications are subject of alteration without further notice.
Modbus general
Error handling
EIA-485 Specification
If the slave receives the request, but detects an error, no response is returned.
EIA-485 is a standard which specifies the physical layer of the OSI model for the generator and receiver used in a balanced serial transmission system.
If the slave receives the request without an error, but cannot handle it, the slave can return an exception response informing the master of the nature of the error. Frame of the exception response is: Address 1byte
Function code + 80h 1byte
Error code
CRC
End
1byte
2byte 3,5 char (CRC_Lbyte, C_Hbyte
EIA-485 is a half-duplex multi-point communication network, meaning the data can be transmitted in both directions on a signal carrier, but only in one direction at a time. The data is transmitted via two signal lines. The lines are used for both transmission and reception. Logical stage of the signal is defined as a difference of the signal lines. The differential interpretation combined with a single twisted pair provides effective protection against interference. Note that the naming of the EIA/RS-485 lines varies a lot. The signal lines may need to be swapped around to get the communication working. Incorrect signal polarity cannot harm either device.
Fläkt Woods
9696 GB 2015.05.19
4 (7)
Specifications are subject of alteration without further notice.
Modbus general
Network Topology The recommended network structure has one trunk cable to which devices are connected directly or by short stubs. The stub is defined as a distance from a device to the trunk cable. The stubs should be as short as possible to avoid signal reflection on the line. The maximum stub length is limited by the Modbus specification and should therefore never be longer than 20m. The transmission line should be terminated near each of the two ends of the bus using 120Ω resistors to avoid reflection. The network topology must not be a star, a ring, or a backbone with stars or cluster. Any star, ring, and backbone with stars or cluster must be removed from the network.
Figure 6: Backbone with stars or clusters
Correct installation of an EIA/RS-485 network
Figure 7: Star network Figure 3: Daisy chain
Figure 4: Backbone with studs Incorrect installation of an EIA/RS-485 network (avoid)
Figure 5: Ring
Fläkt Woods
9696 GB 2015.05.19
5 (7)
Specifications are subject of alteration without further notice.
Modbus general
Data Cables
Cable Length
The Modbus/RTU cabling must use twisted pair conductors and the cable should fulfil the EIA-485 specification for 2-wire systems.
The theoretical maximum length of the cable depends on the communication speed and the cable properties such as characteristic impedance and wire gauge. The Modbus specification defines the maximum length for the cable as 1,000 meters when the wire gauge is sufficient. When the baud rate is 19,200 or higher, characteristic impedance with a value of 100 Ohms is recommended.
A single twisted pair must always be used for the data, and another conductor must be used for a signal reference ground between devices. The signal reference grounds of all devices on the same bus must be connected together. Do not use a shield drain wire for the signal reference grounding. Avoid crossing high voltage cables. The cables must be kept separate from major interference sources such as generators, relays or frequency transformer. Shielded cables should be used if the environment has sources of interference. If necessary to eliminate interference, the drain wire of the shielded twisted pair cable can be connected to protective ground. The connection should be made only at one end of the shield, for example always to the cable coming from the controller.
The maximum length depends on the quality of the conductors, the environment and how much of the twisted pair is unwound at each connection point. The actual maximum length may therefore be shorter than defined in the Modbus specification. The higher the communication speed, the more sensitive the system is.
Some of the well-known cable manufactures are Alpha Wire, Batt Cables, Belden, Draka, Nexans and Lapp Kabel. Some cable details are below for quick reference. Manufacturer
Cable Code
Belden
9842
Belden
3106A
Belden
3107A
Batt Cables
91084
Batt Cables
91421
Alpha Wire
6455
Nexans
TRONIC-CY-TP (LiYCY- 0.25 mm2, 2 Twisted TP) 2x2x0.25 Pairs, PVC insulation 2 NOMAK 0.5 mm , 2 Twisted 2X2X0,5+0.5 Pairs, PVC insulation
Draka
Description/ Comments 24AWG, 2 Twisted Pairs, Polyethylene Insulation 22 AWG, 1 Twisted Pair + 1 core, Datalene Insulation 22AWG, 2 Twisted Pairs, Datalene Insulation Batt’s own version of the Belden 9842 LSZH version of the above 22AWG, 2 Twisted Pairs, Foam HDPE Insulation
Draka
Datajamak 2x(2+1)x0.24
0.24 mm , 2 Twisted Pairs, PVC insulation
LappKabel
UNITRONIC 2x0.25
0.24 mm , 2 Twisted Pairs, PVC insulation
Fläkt Woods
9696 GB 2015.05.19
2
2
6 (7)
Specifications are subject of alteration without further notice.
Modbus general
Fault finding check list If no communication • Check that the address of the slave is correct. • Check that the same address is not used for multiply slaves. • Check communication settings (communication mode, baud rate, parity, stop bits). The settings must be the same for all devices in serial line. • Check that signal lines polarity (A, B) is not by accident swapped. • Try to change signal lines (A, B). The naming of the EIA/RS-485 lines varies a lot. • Check connectors and connections to screw terminals. • Check that signal reference ground is connected to all devices If quality of the signal is weak • Check that the serial line is properly terminated near both ends. • Check the network topology. Any star, ring, and backbone with stars or cluster must be removed from the network. • Try to reduce stub lengths. • Check the cable locations. Do not cross any high voltage cables. Try to separate cables and devices from major interference sources. • Check that drain wire of the cable is grounded properly. • Shielding of the data cable might not be sufficient.
Fläkt Woods
9696 GB 2015.05.19
7 (7)
Specifications are subject of alteration without further notice.