Professional Documents
Culture Documents
06 Tech Modbus en
06 Tech Modbus en
Part 1 : Part 2 : Part 3 : Part 4 : Reference documents - WEB sites Definitions Modbus frame description Security of transmission
Part 5 :
Part 6 :
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
Physical layer
Main characteristics resume
Section 6 - Slide 1 / 27
Section 6 - Slide 2 / 27
WEB sites
Modbus.org : http://www.modbus.org
Modicon site for Modbus users.
Section 6 - Slide 3 / 27
Part 2 : Dfinitions
Modbus protocol
MODBUS Protocol is a messaging structure created by MODICON company to connect PLC to programming tools. It is now widely used to establish master-slave communication between intelligent devices. MODBUS is independent of the physical layer. It can be implemented using RS232, RS422, or RS485 or over a variety of media (e.g. fiber, radio, cellular, etc...).
Section 6 - Slide 4 / 27
Part 2 : Dfinitions
7 Application 6 Presentation
Modbus
5
4 3
Session
Transport Network
2
1
Link
Physical
Part 2 : Dfinitions
Modbus TCP/IP
MODBUS TCP/IP uses TCP/IP and Ethernet 10 Mbit/s or 100 Mbits/s to carry the MODBUS messaging structure.
Modbus
TCP IP
Section 6 - Slide 6 / 27
Part 2 : Dfinitions
Modbus Plus
MODBUS PLUS is a higher speed network 1 Mbit/s token passing derivative that uses the MODBUS messaging structure.
7 Application 6 Presentation 5 4 3 2 1 Session Transport Network Link Physical
Modbus
Part 2 : Dfinitions
ASCII mode allows time intervals of up to 1 second to occur between characters without causing an error.
Section 6 - Slide 8 / 27
Address
Function
Data
Checksum
silence
3A Hex
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
0D Hex 0A Hex
Section 6 - Slide 9 / 27
Address field
Address Function Data Checksum
Valid slave device addresses are in the range of 0 ... 247 decimal. The individual slave devices are assigned addresses in the range of 1 ... 247. Value 0 is reserved for broadcast messages (no response). Request : A master addresses a slave by placing the slave address in the address field of the message. Response : When the slave sends its response, it places its own address in this address field of the response to let the master know which slave is responding.
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
Section 6 - Slide 10 / 27
Function field
Address Function Data Checksum
The function code field tells the slave what kind of action to perform.
Response :
For a normal response, the slave simply echoes the original function code.
For an exception response, the slave returns a code that is equivalent to the original function code with its most significant bit set to a logic 1.
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
Section 6 - Slide 11 / 27
Data field
Address Function Data Checksum
The data field contains additional information which the slave must use to take the action defined by the function code. This can include items like register addresses, quantity of items to be handled, etc...
Response :
If no error occurs, the data field contains the data requested. If an error occurs, the field contains an exception code that the master application can use to determine the next action to be taken.
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
Section 6 - Slide 12 / 27
Checksum field
Address Function Data Checksum
Valid codes are in the range of 0 ... 255 decimal. Modbus RTU uses CRC : Modbus ASCII uses LRC :
Request :
The checksum is re-calculated by the slave and compared to the value sent by the master. If a difference is detected, the slave will not construct a response to the master.
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
Section 6 - Slide 13 / 27
Request :
1 byte 1 byte 2 bytes 2 bytes 2 bytes
CRC16
Response :
1 byte 1 byte 2 bytes 2 bytes 2 bytes 2 bytes
CRC16
Section 6 - Slide 14 / 27
Request :
1 byte 1 byte 2 bytes 2 bytes 2 bytes
Word address
Value of word
CRC16
Response :
1 byte 1 byte 2 bytes 2 bytes 2 bytes
Word address
Value of word
CRC16
Section 6 - Slide 15 / 27
Frame exemple in RTU mode Function code = 16 (dcimal) : Write Multiple Registers
Request :
1 byte 1 byte 2 bytes 2 bytes 1 byte 2 bytes 2 bytes
CRC16
Response :
1 byte 1 byte 2 bytes 2 bytes
2 bytes
CRC16
Section 6 - Slide 16 / 27
Frame checking
LRC or CRC is applied to the entire message.
Continuous stream
The entire message frame must be transmitted as a continuous stream. If a silent interval (more than 1.5 character times RTU mode or 1 second ASCII mode) occurs before completion of the frame, the receiving device flushes the incomplete message and assumes that the next byte will be the address field of a new message.
Section 6 - Slide 18 / 27
The master is configured by the user to wait for a predetermined timeout interval before aborting the transaction. This interval is set to be long enough for any slave to respond normally.
If the slave detects a transmission error, the message will not be acted upon.
The slave will not construct a response to the master. Thus the timeout will expire and allow the master's program to handle the error.
Section 6 - Slide 19 / 27
RS485 is the most common physical layer used on Modbus. The RS485 standard allows variants of different characteristics : polarisation line terminator distribution of a reference potential number of slaves length of the bus
Section 6 - Slide 20 / 27
The new Telemecanique devices conform to the Modbus specification published in 2002 on the Modbus.org web site.
Section 6 - Slide 21 / 27
Master
650
650
120 1 nF
D1
120 1 nF
D0 Common
Slave 1
Slave 2
Maximum length of bus Maximum number of stations (without repeater) Maximum length of tap links Bus polarisation Line terminator Common polarity
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
1000 m at 19200 bps 32 (31 slaves) 20 m for one tap link 40 m divided by the number of tap links 650 at 5V and common for the master 120 - 0,25Wm in series with 1nF 10V Yes (Common) connected to the PG
Section 6 - Slide 22 / 27
Master
4,7 K
4,7 K
D(B)
120 1 nF D(A) 0 VL 5V 4,7 K 4,7 K 4,7 K 5V 4,7 K 120 1 nF
Slave 1
Slave 2
Maximum length of bus Maximum number of stations (without repeater) Maximum length of tap links Bus polarisation Line terminator Common polarity
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
1000 m at 19200 bps 29 (28 slaves) 20 m for one tap link 40 m divided by the number of tap links 4,7 K at 5V and common for the master and slaves 120 - 0,25Wm in series with 1nF 10V Yes (0 VL) and high impedance place between 0 VL and the ground in each station
Section 6 - Slide 23 / 27
L+(A/A )
Slave 1
Slave 2
Maximum length of bus Maximum number of stations (without repeater) Maximum length of tap links Bus polarisation Line terminator Common polarity
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
1300 m at 19200 bps 32 (31 slaves) 3m 470 at 5V and common for the master 150 No
Section 6 - Slide 24 / 27
Master
Rp
Rp
120
D1 D0 Common 5V 4,7 K
120 1 nF
1 nF
Slave 1
4,7 K
Slave 2
If the master is fitted with a 470 polarisation, it s possible to connect a maximum of 18 slaves with 4,7 K polarisation
Maximum length of bus Maximum number of stations (without repeater) Maximum length of tap links Bus polarisation Line terminator Common polarity
P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004
1000 m at 19200 bps At most 32 stations (depending on Rp and the number of 4,7 K 20 m for one tap link 40 m divided by the number of tap links
Rp should be validated by calculating the equivalent polarisation Re according to the polarisation of the master and slave stations. Re must be between 162 and 650
120 - 0,25Wm in series with 1nF 10V Yes (Common) connected to the PG
Section 6 - Slide 25 / 27
Topology:
Maximum distance:
Data rate:
Section 6 - Slide 26 / 27
Method of accessing the medium: Transmission method: Max. useful data size:
Transmission security:
LRC or CRC Start and stop delimiters Parity bit Continuous stream
Section 6 - Slide 27 / 27