Modbus 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. It can be implemented using RS232, RS422, or RS485 or over a variety of media (e.g. Fiber, radio, cellular, etc.)
Modbus 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. It can be implemented using RS232, RS422, or RS485 or over a variety of media (e.g. Fiber, radio, cellular, etc.)
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online from Scribd
Modbus 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. It can be implemented using RS232, RS422, or RS485 or over a variety of media (e.g. Fiber, radio, cellular, etc.)
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online from Scribd
Modbus training Modbus training Part 1 : Reference documents - WEB sites Part 2 : Definitions Part 3 : Modbus frame description Part 4 : Security of transmission Part 5 : PhysicaI Iayer Part 6 : Main characteristics resume Section 6 - SIide 2 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Modbus User guide Reference : TSX DG MOD * Detailed description of the Modbus protocol. X-WAY communication user guide Reference : TSX DR NET * This guide gives common characteristics to X-WAY Schneider networks. Communication appIication specific functions PL7 Micro/Junior/Pro Reference : TLX DS COM PL7 42 * Volume 1 : Common communication application Volume 2 : Modbus bus Part 1 : Reference documents - WEB sites Part 1 : Reference documents - WEB sites Schneider documents Schneider documents Section 6 - SIide 3 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 WEB sites WEB sites Modbus.org : http://www.modbus.org Modicon site for Modbus users. Transparent Factory : http://www.transparentfactory.com Schneider Electric site for Transparent Factory users. Modbus Plus : http://www.modicon.com/techpubs/toc6.html Modbus Plus Planning and installation. Part 1 : Reference documents - WEB sites Part 1 : Reference documents - WEB sites Section 6 - SIide 4 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Modbus protocoI Modbus protocoI MODBUS ProtocoI is a messaging structure created by MODCON company to connect PLC to programming tools. t is now widely used to establish master-slave communication between intelligent devices. MODBUS is independent of the physicaI Iayer. t can be implemented using RS232, RS422, or RS485 or over a variety of media (e.g. fiber, radio, cellular, etc...). Part 2 : Dfinitions Part 2 : Dfinitions Section 6 - SIide 5 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Modbus SeriaI Iine RS485 Modbus SeriaI Iine RS485 MODBUS SeriaI Iine RS485 is a low cost network using a master/slave medium access with a transmission speed from 1,200 to 115 Kbits/s. Application Presentation Session Transport Network Link Physical 7 6 5 4 3 2 1 Master Master - - Slave Slave Modbus RS485 RS485 Part 2 : Dfinitions Part 2 : Dfinitions Section 6 - SIide 6 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Modbus TCP/IP Modbus TCP/IP MODBUS TCP/IP uses TCP/P and Ethernet 10 Mbit/s or 100 Mbits/s to carry the MODBUS messaging structure. Application Preentation Session Transport Network Link Physical 7 6 5 4 3 2 1 SMA / SMA / %RA% J2 ou 82.3 %RA% J2 ou 82.3 Modbus TCP IP Part 2 : Dfinitions Part 2 : Dfinitions Section 6 - SIide 7 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Modbus PIus Modbus PIus MODBUS PLUS is a higher speed network 1 Mbit/s token passing derivative that uses the MODBUS messaging structure. Application Presentation Session Transport Network Link Physical 7 6 5 4 3 2 1 82.4 %oken passing 82.4 %oken passing Modbus RS485 RS485 Part 2 : Dfinitions Part 2 : Dfinitions Section 6 - SIide 8 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Modbus ASCII and Modbus RTU Modbus ASCII and Modbus RTU The MODBUS protocol comes in 2 versions : ASC transmission mode Each eight-bit byte in a message is sent as 2 ASC characters. RTU transmission mode Each eight-bit byte in a message is sent as two four-bit hexadecimal characters. The main advantage of the RTU mode is that it achieves higher throughput. ASC mode allows time intervals of up to 1 second to occur between characters without causing an error. Part 2 : Dfinitions Part 2 : Dfinitions Section 6 - SIide 9 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Modbus frame structure Modbus frame structure Address Checksum Data Function The Modbus frame structure is the same for requests (master to slave messages) and responses (slave to master messages). Modbus ASC Modbus RTU : CR LF 3A ex 0D ex 0A ex Part 3 : Modbus frame description Part 3 : Modbus frame description Address Checksum Data Function silence silence Silence >= 3,5 characters Section 6 - SIide 10 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Address fieId Address fieId Address Checksum Data Function 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. Part 3 : Modbus frame description Part 3 : Modbus frame description Section 6 - SIide 11 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Valid codes are in the range of 1 ... 255 decimal. Request : 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. Function fieId Function fieId Address Checksum Data unction Part 3 : Modbus frame description Part 3 : Modbus frame description Section 6 - SIide 12 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Valid codes are in the range of 0 ... 255 decimal. Request : 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 : f no error occurs, the data field contains the data requested. f an error occurs, the field contains an exception code that the master application can use to determine the next action to be taken. Data fieId Data fieId Address Checksum ata Function Part 3 : Modbus frame description Part 3 : Modbus frame description Section 6 - SIide 13 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Valid codes are in the range of 0 ... 255 decimal. Modbus RTU uses CRC : Cyclycal Reduncy Check (2 byte) Modbus ASC uses LRC : Longitudinal Redundancy Check (1 bytes) Request : The checksum is calculated by the master and sends to the slave. Response : The checksum is re-calculated by the slave and compared to the value sent by the master. f a difference is detected, the slave will not construct a response to the master. Checksum fieId Checksum fieId Address Checksum Data Function Part 3 : Modbus frame description Part 3 : Modbus frame description Section 6 - SIide 14 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Request : Frame exempIe in RTU mode Frame exempIe in RTU mode Function code = 03 : Read Holding Registers $ave Address CRC16 First word address Function code 03 Number oI words to read 1 byte 1 byte 2 bytes 2 bytes 2 bytes Response : $ave Address CRC16 Number oI bytes read Function code 03 Vaue oI the Iirst word 1 byte 1 byte 2 bytes 2 bytes 2 bytes Vaue oI the ast word 2 bytes Part 3 : Modbus frame description Part 3 : Modbus frame description Section 6 - SIide 15 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Request : Frame exempIe in RTU mode Frame exempIe in RTU mode Function code = 06 : Write Single Register $ave Address CRC16 Word address Function code 06 Vaue oI word 1 byte 1 byte 2 bytes 2 bytes 2 bytes Response : Part 3 : Modbus frame description Part 3 : Modbus frame description $ave Address CRC16 Word address Function code 06 Vaue oI word 1 byte 1 byte 2 bytes 2 bytes 2 bytes Section 6 - SIide 16 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Request : Frame exempIe in RTU mode Frame exempIe in RTU mode Function code = 16 (dcimal) : Write Multiple Registers $ave Address CRC16 First word address Function code 16 Number oI words to write 1 byte 1 byte 2 bytes 2 bytes 2 bytes Response : $ave Address CRC16 Function code 16 1 byte 1 byte 2 bytes 2 bytes 2 bytes Part 3 : Modbus frame description Part 3 : Modbus frame description Vaue oI the Iirst word Number oI bytes 1 byte 2 bytes First word address Number oI words to write Section 6 - SIide 17 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Function code exempIes Function code exempIes Part 3 : Modbus frame description Part 3 : Modbus frame description Code Furcl|or 01 (0x01) Read Co||s 02 (0x02) Read 0|screle lrpuls 03 (0x03) Read lo|d|rg Reg|slers 01 (0x01) Read lrpul Reg|slers 05 (0x05) wr|le 3|rg|e Co|| 0 (0x0) wr|le 3|rg|e Reg|sler 15 (0x0F) wr|le Vu|l|p|e Co||s 1 (0x10) wr|le Vu|l|p|e Reg|slers 23 (0x1Z) Read/wr|le Vu|l|p|e Reg|slers 13 (0x28) Read 0ev|ce lderl|l|cal|or Tre corp|ele descr|pl|or ol a|| Vodous requesl |s lree|y ava||ao|e or lre Vodous.org Weo s|le : http://www.modbus.org Section 6 - SIide 18 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Parity checking Even or odd can be optionally applied to each character. Frame checking LRC or CRC is applied to the entire message. Continuous stream The entire message frame must be transmitted as a continuous stream. f a silent interval (more than 1.5 character times RTU mode or 1 second ASC 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. Error checking methods Error checking methods Error checking methods Error checking methods Part 4 : Security of transmission Part 4 : Security of transmission Section 6 - SIide 19 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 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. f 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. Error checking methods Error checking methods Error checking methods Error checking methods Part 4 : Security of transmission Part 4 : Security of transmission Section 6 - SIide 20 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 RS485 physicaI Iayer RS485 physicaI Iayer Part 5 : PhysicaI Iayer Part 5 : PhysicaI Iayer 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 - SIide 21 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 The various versions of the RS485 physicaI Iayer The various versions of the RS485 physicaI Iayer Part 5 : PhysicaI Iayer Part 5 : PhysicaI Iayer The new Telemecanique devices conform to the Modbus specification published in 2002 on the Modbus.org web site. But some Schneider older devices comply with earlier specifications : Uni-Telway Jbus Section 6 - SIide 22 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 New Modbus RS485 standard schematic New Modbus RS485 standard schematic Part 5 : PhysicaI Iayer Part 5 : PhysicaI Iayer Master SIave 1 SIave 2 D1 D0 Common 5 V 650 650 120 1 nF 120 1 nF Maximum length of bus 1000 m at 19200 bps Maximum number of stations (without repeater) 32 (31 slaves) Maximum length of tap links 20 m for one tap link 40 m divided by the number of tap links Bus polarisation 650 at 5V and common for the master Line terminator 120 - 0,25Wm in series with 1nF 10V Common polarity Yes (Common) connected to the PG Section 6 - SIide 23 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Uni-TeIway RS485 schematic Uni-TeIway RS485 schematic Part 5 : PhysicaI Iayer Part 5 : PhysicaI Iayer Master SIave 1 SIave 2 D(B) D(A) 0 VL 5 V 4,7 K 120 1 nF 120 1 nF Maximum length of bus 1000 m at 19200 bps Maximum number of stations (without repeater) 29 (28 slaves) Maximum length of tap links 20 m for one tap link 40 m divided by the number of tap links Bus polarisation 4,7 K at 5V and common for the master and slaves Line terminator 120 - 0,25Wm in series with 1nF 10V Common polarity Yes (0 VL) and high impedance place between 0 VL and the ground in each station 4,7 K 4,7 K 4,7 K 4,7 K 4,7 K 5 V 5 V Section 6 - SIide 24 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Jbus RS485 schematic Jbus RS485 schematic Part 5 : PhysicaI Iayer Part 5 : PhysicaI Iayer Master SIave 1 SIave 2 L-(B/B ') L+(A/A ') 5 V 470 470 150 150 Maximum length of bus 1300 m at 19200 bps Maximum number of stations (without repeater) 32 (31 slaves) Maximum length of tap links 3 m Bus polarisation 470 at 5V and common for the master Line terminator 150 Common polarity No Section 6 - SIide 25 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Mixed RS485 schematic Mixed RS485 schematic Part 5 : PhysicaI Iayer Part 5 : PhysicaI Iayer Master SIave 1 SIave 2 D1 D0 Common 5 V Rp 120 1 nF 120 1 nF Maximum length of bus 1000 m at 19200 bps Maximum number of stations (without repeater) At most 32 stations (depending on Rp and the number of 4,7 K Maximum length of tap links 20 m for one tap link 40 m divided by the number of tap links Bus polarisation 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 Line terminator 120 - 0,25Wm in series with 1nF 10V Common polarity Yes (Common) connected to the PG Rp 4,7 K 4,7 K 5 V SuitabIe poIarization Rp must be caIcuIated If the master is fitted with a 470 poIarisation, it 's possibIe to connect a maximum of 18 sIaves with 4,7 K poIarisation Section 6 - SIide 26 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Main characteristics resume Main characteristics resume TopoIogy: Bus with Iine terminations Maximum distance: With RS485 : 1000 m without repeater Data rate: From 1,200 to 115 Kbits/s Max. no. of devices: With RS485 : 32 master incIuded Part 6 : Main characteristics resume Part 6 : Main characteristics resume Section 6 - SIide 27 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Method of accessing the medium: Master sIave Transmission method: Messaging Max. usefuI data size: 120 words Transmission security: LRC or CRC Start and stop deIimiters Parity bit Continuous stream Main characteristics resume Main characteristics resume Part 6 : Main characteristics resume Part 6 : Main characteristics resume