Chap.12 Modbus Rtu Master

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Chap.

12 MODBUS RTU Protocol(Master)

Chap.12 MODBUS RTU Protocol (Master)


MODBUS RTU Driver of LS Industrial Systems is available since V1.02 so if you use the previous version, please apply XP-Builder and XGT Panel software that are beyond V1.02 from our web-site.

12.1 MODBUS Protocol Outline


MODBUS protocol that is the specified open protocol used for server-client is operated by data reading/writing base don function code. The communication that adopts MODBUS protocol applies server-client function dealt with only one client. Characteristics Signal system Starting bit Data bit Parity bit Stop bit Error check Start of frame RTU Mode 8 bit binary code 1 8 Even, Odd, None 1 or 2 CRC (Cyclical Redundancy Check) 3.5 Characters no response time

The number of data per 1 character

12.1.1 Frame Structure


The frame structure of MODBUS RTU mode is as below. Classification Size(byte) Start Idle time Station No. 1 Function code 1 Data N Error check 2 End Idle time

(1) Characteristics of RTU mode (a) It adopts hexadecimal number for communication. (b) Starting character indicates unit No. and the end of frame indicates CRC error check for identifying the frame. (c) It identifies start and end of the frame by adding idle time of 1 bit. (d) It has at least 3.5 character time of interval between frames and when passing 1.5 character time, it is regarded as independent frame. (2) Address Area (a) It is composed of 1 byte. (b) When using XGT Cnet I/F module, 0~31 can be applied for the unit No. (c) 0 is used for client local number. (d) Server includes its address to the response frame to show a clients response. (3) Data Area (a) It transmits data through hexadecimal number(Hex.) and data structure changes depending on each function code. (b) It replies with response data when receiving normal frame. (c) It replies with error code when receiving abnormal frame. (4) Error Check Area Through CRC checking method of 2 byte, it judges whether the frame is normal or not

(5) MODBUS Address Regulations The address of data starts from 0 and it is equal to the value obtained by subtracting 1 from MODBUS memory. Namely, MODBUS address 2 is the same as address 1 of data.

12-1

Chap.12 MODBUS RTU Protocol(Master)

12.1.2 Displaying Data and Address


In terms of displaying data and address of MODBUS protocol, the main characteristics are as below. (1) It basically adopts hexadecimal number(Hex.). (2) The meaning of each function code is as below. Code(Hex) 01 02 03 04 05 06 0F 10 Used for Reading individual/continuous bit Reading individual/continuous bit Reading individual/continuous word Reading individual/continuous word Writing individual bit Writing individual word Writing continuous bit Writing continuous word Using area Bit output Bit input Word output Word Input Bit output Word output Bit output Word output Address 0XXXX 1XXXX 4XXXX 3XXXX 0XXXX 4XXXX 0XXXX 4XXXX Max. Response data 2000Bit 2000Bit 125Word 125Word 1Bit 1Word 1968Bit 120Word

12.2 Wiring Diagram


The wiring method of XGT Panel and PLC connected through MODBUS communication may be different depending on the manufacturer. For proper wiring, refer to each PLCs manual. The description on wiring of LS Industrial Systems XGT PLC will be provided hereupon.

12.2.1 RS-232C
When connecting MODBUS communication through RS-232C mode, the wiring method is the same as general wiring method for RS232C.

12-2

Chap.12 MODBUS RTU Protocol(Master)

12.2.2 RS-422
When connecting MODBUS communication through RS-422 mode, the wiring method is the same as general wiring method for RS-422.

12.2.3 RS-485
When connecting MODBUS communication through RS-485 mode, the wiring method is the same as general wiring method for RS-485.

12-3

Chap.12 MODBUS RTU Protocol(Master)

Notice (1) Suggestions


The array of connector and pin may be different depending on the PLC type. Check the end switch of XGT Panel. It is basically set as terminator type. A shielded wire is recommended for stable communication. For shield wiring, refer to the Chap.2.

12.3 Communication Setting


XGT Panel can be connected through various kinds of devices that adopt MODBUS(RTU) communication with RS-232C, RS-422/485 mode. Setting methods are different depending on the manufacturer so for more details, refer to each device manual. For example, description on XGK PLC will provided hereupon.

12.3.1 The example of setting PLC(XGK)


The communication for PLC(XGK) is set at XG-PD.

(1) Connection Setting Select Online->Connection Setting. After setting connection options for user environment, click Connection. (2) Reading I/O Data Select Online->Reading I/O Data to interpret the information of module embedded in the current base.

12-4

Chap.12 MODBUS RTU Protocol(Master)

(3) Double-click the related Cnet I/F module to execute basic setting screen and establish communication mode, communication speed, modem type, data bit, stop bit, unit No. of connection setting menu. (4) Select RTU server for operation mode. (a) If you select MODBUS RTU server for operation mode, executing MODBUS is active. (5) Setting MODBUS (a) Starting address of bit reading area : Indicates the starting address of bit reading area with 5 digits. The former 4 digits indicate word value and the remaining 1 digit means bit value. th th Ex.) In the case of M00000 : The 0 bit of 0 word of M device is set as starting address of bit reading area. (b) Starting address of bit writing area : Indicates the starting address of bit writing area with 5 digits. The former 4 digits indicate word value and the remaining 1 digit means bit value. th th Ex.) In the case of M00100: The 0 bit of 10 word of M device area is set as starting address of bit reading area. (c) Starting address of word reading area: Indicates the starting address of word reading area with 4 digits. th Ex.) In the case of M00200: The 200 word of M device area is set as starting address of word reading area. (d) Starting address of word writing area: Indicates the starting address of word writing area with 4 digits. th Ex.) In the case of M00300: The 300 word of M device area is set as starting address of word writing area. (6) Writing Parameter (a)Click Online-Writing parameter. (b)After clicking the module whose basic setting is completed at basic setting, click OK button. (c)After clicking OK button, complete Parameter Writing and reset the module individually. (7) Checking operation (a) Click Online-System Diagnosis (b) After clicking the related module, press the right mouse button for frame monitoring and status by services to check whether communication is normal or not.

12-5

Chap.12 MODBUS RTU Protocol(Master)

12.3.2 The example of setting XGT Panel


You can set the communication for XGT Panel through XP-Builder.

(1) Setting controller Select Schneider Electric Industry for the manufacturer and for the item, select MODBUS RTU Master. (2) Connection Property Select the proper connection type for your own working environment. (3) Setting detailed connection option Select the proper transmission speed, data bit, parity, stop bit for your own working environment.

The unit No. is the opposite devices No. that is under MODBUS communication. If you have wrong unit No., time out will be displayed at the upper place of XGT Panel screen. Check the unit No. again. If there is no menu to set unit No. at PLC or PLC communication module, set the unit No. as 0 at XP-Builder. 12-6

Chap.12 MODBUS RTU Protocol(Master)

(4) Download established communication details to XGT Panel.

Notice (1) Suggestions


In the case of communication error, check if the parameters including transmission speed and data bit are correct. If time out is shown at the upper place of a screen, check the unit No.

12.4 Available Device


The available device for XGT Panel is as below. Area allowed for connection Device Available range Output contacts Input contacts Output register Input register 0 - 65535 0 - 65535 0 - 65535 0 - 65535 Reading(function code) Available (01) Available (02) Available (03) Available (04) Remarks Writing(function code) Available (05) Available (05) Available (06,16) Available (06,16) -

Notice (1) Suggestions For the details on device, refer to MODBUS Protocol manual of Schneider. Use it within device area. The maximum device value may be different depending on PLC so refer to the PLC manual to be connected.

12-7

You might also like