XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set...

58
XGB-U COMMUNICATION

Transcript of XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set...

Page 1: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

XGB-U COMMUNICATION

Page 2: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

- CONTENTS -

1. XGB-U Cnet overview

1.1 XGB-U Built-in Cnet

1.1.1 feature

1.1.2 Specification

1.1.3 Cable wiring

1.1.4 Parameter

1.2 XGB-U expansion Cnet module

1.2.1 feature

1.2.2 Cable wiring

1.2.2 Parameter

Page 3: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

- CONTENTS -

2. XGT Protocol

2.1 Communication protocol

2.2 Configuration example

2.2.1 Standard parameter

2.2.2 P2P parameter

2.2.3 Frame monitor

3. Modbus Protocol

3.1 Configuration example

3.1.1 Standard parameter

3.1.2 P2P parameter

3.1.3 Frame monitor

Page 4: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

- CONTENTS -

4. User frame definition

4.1 Head, Body, Tail, BCC

4.2 Configuration example

4.2.1 Request frame

4.2.2 Response frame

4.2.3 Frame monitor

Page 5: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

- CONTENTS -

Appendix

1. Interlock program

2. P2PSN program (1:N communication case)

Page 6: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1. XGB-U Cnet overview

Page 7: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1.1.1 Feature

1.1 XGB-U built-in communication

1. XGB-U Cnet Overview

P2P (User defined protocol, XGT client, Modbus ASCII/RTU client, LS bus client)

XGT Server (LS dedicated protocol)Modbus ASCII/RTU server

1) XGB-U Built-in Cnet(computer link network) has RS232C 1ch, RS-485 1ch.2) Each channel can set Client/Server.3) If Built-in Cnet act as Client, P2P block no.1 fixed. (Built-in Ethernet is fixed to P2P block no.2)4) XGT protocol, Modbus protocol, User defined protocol support.5) It provides communication function in which multidrop, up to 32 connection is available in case of using RS-485.6) Setting of diverse communication speed is available. (1200/2400/4800/9600/19200/38400/57600/115200bps)7) 1:1 and 1:N communication are available.8) Various diagnosis service including frame monitor.

USB loader

XG5000

XGB-U XGB-U

RS-232C/485RS-232C/485

HMI

1 / 47

Page 8: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1.1.2 Specification

1. XGB-U Cnet Overview

ItemSpecification

Channel 1 Channel 2

Serial communication method

RS-232C RS-485

Operation mode(operation define by channel)

P2P

Act as communication client-XGT dedicated protocol client-Modbus ASCII/RTU client-User defined communication-LS bus client

Server-XGT dedicated protocol server-Modbus ASCII/RTU server

Data type

Data bit 7 or 8

Stop bit 1 or 2

Parity bit Even/Odd/None

Synchronization type Asynchronous type

Transmission speed(bps)1200/2400/4800/9600/19200/38400/57600/115200 bps available

Station No. settingSetting range: 0~255Max. station No. available: 32 stations

Transmission distance Max. 15m Max. 500m

Diagnosis function Check available by XG5000 diagnosis service

2 / 47

Page 9: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1.1.3 Cable wiring

For communication via XGB-U built-in RS-485 channel, termination resistor from external must be connected.Termination resistor has the function to prevent distortion of signal by reflected wave of cable for long-distance communication, and the same resistance (1/2W) as characteristic impedance of cable must be connected to terminal of network.

* Termination resistor

1. XGB-U Cnet Overview

Recommended termination resister: 1/2W, 120Ω, 5% tolerance

3 / 47

Page 10: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

* Wiring example with HMI * Wiring example with another XGB-U

1. XGB-U Cnet Overview

4 / 47

Page 11: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1.1.4 Parameter

(1) Standard setting parameter

(2) Advanced setting parameter

- Type: Built-in Cnet channels are fixed to Channel1=RS232C, Channel2=RS485.

- Speed: Select baud rate 1200, 2400, 4800, 9600, 19200, 38400,

57600,76800, 115200 bps available .- Station No: Set PLC’s station number from 0 to 255.

- Operation mode: The meaning of each items is as follows.

- Data bit: 7 or 8 bit available

- Stop bit: None, Even, Odd available.

- Parity bit: 1 or 2 bit available.

- Response waiting: It means the time from sending frame to receiving. it is

available when active mode is set to “Use P2P”.

- Delay time: It means that frame is sent at user-defined frame send timing

with delay as setting delay time. it is available when communication type is

RS-485.

- Delay time between characters: It means interval between characters in

one frame. it is always available regardless of active mode. In case of that

waiting time is set to 0, it is applied 3.5 character time as communication

speed. It means the required time to send 1 character and it is variable

depends on communication speed. In case of that communication speed

is 9600bps, how to calculate 3.5 Character Time Character time = (number

of bits of 1 character(11)/communication time) * 3.5

= (11/9600)*3.5 = 4.01ms

1. XGB-U Cnet Overview

5 / 47

Page 12: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1.2.1 Feature

1.2 XGB-U expansion Cnet module

1) XGB-U expansion Cnet(computer link network) module has RS232C 1ch(XBL-C21A) or RS-422/485 1ch(XBL-C41A).2) A channel can set Client/Server.3) XGB-U can expand Max. 2 communication module. 4) If first communication module act as a Client, it is fixed to P2P block NO. 3 second communication module(more slot

number) act as a Client, it is fixed to P2P block NO. 4. Built-in Cnet: P2P NO.1 fixed, Built-in Ethernet: P2P NO.2 fixed 5) XGT protocol, Modbus protocol, User defined protocol support.7) It provides communication function in which multidrop, up to 32 connection is available in case of using RS-422/485.8) Setting of diverse communication speed is available. (1200/2400/4800/9600/19200/38400/57600/115200bps)9) 1:1 and 1:N communication are available.10) Various diagnosis service including frame monitor.

1. XGB-U Cnet Overview

6 / 47

Page 13: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1.2.2 Cable wiring

(1) XBL-C21A RS232C modem connection

[ No.9, RI signal is not used in XBL-C21A module ]

(2) XBL-C21A RS232C null modem connection

[ 3-line type of connection ( no handshake) ]

(3) XBL-C41A RS-422 connection

(4) XBL-C41A RS-485 connection

1. XGB-U Cnet Overview

* Modem pin No. depends on the type of modem

*

7 / 47

Page 14: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1.2.2 Cable wiring

(5) XBL-C41A RS-422 multidrop connection

(7) XBL-C41A RS-485 multidrop connection

For communication via XBL-C41A RS-422/485 channel, termination resistor from external must be connected.Termination resistor has the function to prevent distortion of signal by reflected wave of cable for long-distance communication, and the same resistance (1/2W) as characteristic impedance of cable must be connected to terminal of network.

* Termination resistor

1. XGB-U Cnet Overview

Cnet (5pin)External device No.1 External device No.2

(6) XBL-C41A RS-422 connection when XBL-C41A is between external devices Recommended termination resister: 1/2W, 120Ω, 5% tolerance

8 / 47

Page 15: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1.2.3 Parameter

(1) Standard setting parameter

(2) Advanced setting parameter

- Type: Cnet module can use channel 2 only. (XBL-C21A has RS232C 1channel, XBL-C41A has RS-422/485 1channel.)

- Speed: Select baud rate 1200, 2400, 4800, 9600, 19200, 38400,

57600,76800, 115200 bps available .- Station No: Set PLC’s station number from 0 to 255.

- Operation mode: The meaning of each items is as follows.

- Data bit: 7 or 8 bit available (If use Modbus ASCII, select 7)

- Stop bit: None, Even, Odd available.

- Parity bit: 1 or 2 bit available.

- Response waiting: It means the time from sending frame to receving. it is

available when active mode is set to “Use P2P”.

- Delay time: It means that frame is sent at user-defined frame send timing

with delay as setting delay time. it is available when communication type is

RS-485.

- Delay time between characters: It means interval between characters in

one frame. it is always available regardless of active mode. In case of that

waiting time is set to 0, it is applied 3.5 character time as communication

speed. It means the required time to send 1 character and it is variable

depends on communication speed. In case of that communication speed

is 9600bps, how to calculate 3.5 Character Time Character time = (number

of bits of 1 character(11)/communication time) * 3.5

= (11/9600)*3.5 = 4.01ms

1. XGB-U Cnet Overview

9 / 47

Page 16: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

2. XGT protocol

Page 17: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

* XGT protocol

XGB-U Cnet(Built-in and module both. From now Cnet means Built-in Cnet and Cnet module both.) can act as a Client/Server. If channel act as a Client, set use P2P.If channel act as a Server, set XGT/Modbus ASCII/Modbus RTU server.

P2P (User defined protocol, XGT client, Modbus ASCII/RTU client, LS bus client) XGT Server (LS dedicated protocol), Modbus ASCII/RTU server

XGT series dedicated protocol communication is function executing communication by our dedicated protocol. User can configure the intended communication system between our products without special setting by using reading/writing data of internal device area and monitoring function.

2.1 Communication protocol

2. XGT Protocol

10 / 47

Page 18: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

2. XGT Protocol

Standard setting

P2P parameter setting

Enable P2P link

Write parameter(standard,P2P)

Reset individual module

1. P2P channel setting

2. P2P drive setting

3. P2P block setting

1. Connection setting

2. Time setting

3. Operation settingStandard setting

Write parameter (standard)

Reset individual module

1. Connection setting

2. Time setting

3. Operation setting

Act as Server Act as Client

There are Client and Server in serial communication. Before start Cnet communication, choose Cnet is whether Client or Server. When Cnet is Server, only need standard setting. Waiting until some device sending request message. When Cnet is Client, need P2P setting extra. Cnet first send request message to other device and receive response.

* Serial communication

11 / 47

Page 19: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

2.2 Configuration example (XGT protocol)

Used Channel: Built-in Cnet channel2 RS-485Mode: XGT Client (Master)Station: 1Speed: 19,200 bps

Used Channel: Built-in Cnet Channel2 RS-485Mode: XGT Server (Slave)Station: 2Speed: 19,200 bps

Station 1

R00000~1

R00010~11

Station 2

M0000~1

M0010~11

Write request to Station 2

Let’s make a example of Cnet(XGT protocol) using two XGB-U.Station1 is Client. Station2 is Server. Only Client PLC needs P2P setting.

2 word(M0000~M0001) in Server PLC is sent to Client PLC 2 word. (Saved in R0000~R0001 in Client PLC)

To communicate between Client and Server, protocol must be same.Data bit, parity bit, stop bit, speed(baud rate) also be same.

2. XGT Protocol

Read request to Station 2

12 / 47

Page 20: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

(1) Standard setting

- Speed: 19200 bps It must same with Server.- Station No.: 1 It must be different from other device.- Operation mode: P2P Client must set P2P setting.

2.2.1 Standard parameter

Client PLC Server PLC

- Speed: 19200 bps It must same with Client.- Station No.: 2 It must be different from other device.- Operation mode: XGT server Server always wait for Client’s

request. If Server select XGT server, Client also use XGT protocol. Unless communication doesn’t work.

2. XGT Protocol

13 / 47

Page 21: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

(2) Advanced setting

- Speed, Parity bit, Stop bit: Must be same with Server.

Client PLC Server PLC

- Speed, Parity bit, Stop bit: Must be same with Client.

2. XGT Protocol

14 / 47

Page 22: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

2.2.2 P2P parameter

Server PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work.

Client PLC’s P2P setting step is shown as below.

Built-in Cnet right click -> add item -> P2P communication -> P2P block 01 (Built-in Cnet is fixed always P2P 01)

2. XGT Protocol

15 / 47

Page 23: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1. Index: Each P2P block has 32 index. XGK, XGI, XGR Cnet has 64 index.

2. Ch: Cnet has two channels. If you choose XGT client in P2P channel, driver setting set XGT client automatically.

3. P2P function: You can choose ‘Read’ or ‘Write’. Read operations for transmitting a message to send data on the server, and extracts the data in the response frame transmitted from the server. Writing operation for transmitting a message to send data from the client to the server, and verify the result by analyzing the response frame to the communication from the server.

4. Conditional flag: Enter the time of data transmission by using special flag(F device) or bit contact. When the bit on(rising edge), message send.

5. Command type: (1) Single: Read or write max. four data of memory area to destination station. Ex) M01, M10, M20, M30 (2) Continuous: Read or write continuous data to destination station Ex) M01~M10

6. Data type: In XGT protocol, choose 1bit, 1byte, 2byte, 4byte, 8byte.

7. Data size: It is activate when command type is continuous.

8. Destination station number: It means destination station number and setting range is 0~31.

9. Setting: 1) When Read command

(1) Read area: Device area of data saved in destination station(Server). (2) Save area: Device area of self station to save the data

2) when write command(1) Read area: Device area of self station to send the data(2) Save area: Device area of data saved in destination station(Server).

2. XGT Protocol

16 / 47

Page 24: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

Write to PLC after set standard setting and P2P setting.It means all changed information apply to PLC. Go to online write

Only Client need enable link.It means unlock the P2P block to use communication as Client.

Check the P2P block that you want to use. After write, communication start.

Client and Server must do this step Only Client do this step Only Client do this step

DO Client PLC

DO Server PLC

DO Client PLC DO Client PLC

2. XGT Protocol

17 / 47

Page 25: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

2.2.3 Frame monitor

After enable link, Client PLC send message to Server. Server response to the message. These step is called communication.In XG5000 you can diagnosis using frame monitor. Frame monitor shows all message. Go to Online -> Communication module setting -> System Diagnosis -> right click on module -> frame monitorIn frame monitor window select channel and start. And then message shown up. Blue message is transmission(TX). Red message is receive(RX). Also change view type HEX or ASCII. You can save all message as a csv file.

2. XGT Protocol

Write request frame monitor

18 / 47

Page 26: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

3. Modbus protocol

Page 27: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

3. Modbus Protocol

* Modbus protocol

Modbus protocol is a standardized open protocol for client-server communication. It operates send/receive data by function code. Device to device communication using Modbus protocol, use client-server feature to handle only one client.There are two communication modes of Modbus, ASCII and RTU.

When receiving the abnormal frame from client, server transmits error code and exceptional code. Error code is function code adding 80(Hex) and exceptional code indicate the specific error content. Each code has following content.

Example) Request message: 01 04 00 0A 00 02 C8 84Response message: 01 84 02 4C 2A -> 01: station number, 84: function code 04 + 80 = 84

02: error code(address error)

In case of normal communication, process step is as follows. In case of abnormal communication, process step is as follows.

Characteristic ASCII mode RTU mode

Coding method ASCII mode 8 bit binary code

No. of data per one character

Start bit 1 1

Data bit 7 or 8 7 or 8

Parity bit Even, Odd, None Even, Odd, None

Stop bit 1 or 2 1 or 2

Error check LRC(Longitudinal Redundancy Check) CRC(Cyclical Redundancy Check)

Start of frame Colon (:) 3.5 Character no response time

19 / 47

Page 28: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

3.1 Configuration example

Used Channel: Built-in Cnet channel2 RS-485Mode: Modbus Client (Master)Station: 1Speed: 19,200 bps

Used Channel: Built-in Cnet Channel2 RS-485Mode: Modbus Server (Slave)Station: 2Speed: 19,200 bps

Let’s make a example of Cnet(Modbus protocol) using two XGB-U. Station1 is Client. Station2 is Server. Only Client PLC needs P2P setting.2 word(M0000~M0001) in Server PLC is sent to Client PLC 2 word. (Saved in R0000~R0001 in Client PLC)

To communicate between Client and Server, protocol must be same.Data bit, parity bit, stop bit, speed(baud rate) also be same.

3. Modbus Protocol

Station 1

R00000~1

R00010~11

Station 2

M0000~1

M0010~11

Write request to Station 2

Read request to Station 2

20 / 47

Page 29: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

(1) Standard setting

- Speed: 19200 bps It must same with Server.- Station No.: 1 It must be different from other device.- Operation mode: P2P Client must set P2P setting.

3.1.1 Standard parameter

Client PLC Server PLC

- Speed: 19200 bps It must same with Client.- Station No.: 1 It must be different from other device.- Operation mode: Modbus RTU server Server always wait for

Client’s request. If Server select Modbus RTUserver, Client also use Modbus RTU protocol. Unless communication doesn’t work.

3. Modbus Protocol

21 / 47

Page 30: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

(2) Advanced setting

- Speed, Parity bit, Stop bit: Must be same with Server.

Client PLC Server PLC

- Speed, Parity bit, Stop bit: Must be same with Client.

3. Modbus Protocol

22 / 47

Page 31: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

ModbusAddress

PLCAddress

0x40000 M0000

0x40001 M0001

0x40009 M0009

0x4000A M0010

0x4000F M0015

0x40010 M0016

(3) Server setting

3.1.1 Standard parameter

In case of Modbus RTU/ASCII server setting, it is not required setting others except for Standard settings.Modbus protocol is a standardized open protocol for client-server(Client-Server) communication. It needs modbusaddress map. When PLC act as Server, you select start address for modbus address map. When Client write request message for Server address M0000~M0001. Server set start address for word write areato M0000. In this case Client request write to Server’s first and second word data using Modbus address 0x40000.

Client

R00000

R00001

Server

M0000

M0001

Write request to Server

2word write to 0x40000

Server set the first address for modbus address is M0

3. Modbus Protocol

23 / 47

Page 32: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

ModbusAddress

PLCAddress

0x30000 M0010

0x30001 M0011

0x30009 M0019

0x3000A M0020

0x3000F M0025

0x30010 M0026

(3) Server setting

3.1.1 Standard parameter

Client

R00010

R00011

Server

M0010

M0011

2word Read to 0x30000

Server set the first address for modbus address is M10

3. Modbus Protocol

Read request to Station 2

• Detail explanation in next page

24 / 47

Page 33: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

ModbusAddress

PLCAddress

0x30000 M0010

0x30001 M0011

0x30009 M0019

0x3000A M0020

0x3000F M0025

0x30010 M0026

Purpose FunctionModbus

Address

Function code

Read Write

Bit Read Read 0x 1xxxx 01 -

Bit Write R/W 0x 0xxxx 02 05 (single bit)0F (multi bit)

Word Read Read 0x 3xxxx 04 -

Word Write R/W 0x 4xxxx 03 06 (single word)16(h10) (multi word)

(example 0x40000)

0x : HEX address4 : Function code is selected using this device. It can read/write data in word

units. For write message, function code 16(h10) use. For read message, function code 03 use. (For read message, device 3 or 4 available. 3 means function code 04.)

0000 : Modbus address. 0000 is first Modbus address.

ModbusAddress

PLCAddress

0x40000 M0000

0x40001 M0001

0x40009 M0009

0x4000A M0010

0x4000F M0015

0x40010 M0016

(3) Server setting

3.1.1 Standard parameter

Modbus Server setting is finished. Client should recognize Server’s first address.

<Function code>

3. Modbus Protocol

25 / 47

Page 34: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

3.1.2 P2P parameter

Server PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work.

Client PLC’s P2P setting step is shown as below.

Built-in Cnet right click -> add item -> P2P communication -> P2P block 01 (Built-in Cnet is fixed always P2P 01)

3. Modbus Protocol

26 / 47

Page 35: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

1. Index: Each P2P block has 32 index. XGK, XGI, XGR Cnet has 64 index.

2. Ch: Cnet has two channels. If you choose Modbus RTU client in P2P channel, driver setting set Modbus RTU client automatically.

3. P2P function: You can choose ‘Read’ or ‘Write’. ‘Read’ means receive and save Server’s data. ‘write’ means send data to Server. In other words control Server.

4. Conditional flag: Enter the time of data transmission by using special flag(F device) or bit contact. When the bit on(rising edge), message send.

5. Command type: (1) Single: Read or write max. four data of memory area to destination station. Ex) M01, M10, M20, M30 (2) Continuous: Read or write continuous data to destination station Ex) M01~M10

6. Data type: In Modbus RTU/ASCII protocol, choose bit or word.

7. Data size: It is activate when command type is continuous.

8. Destination station number: It means destination station number and setting range is 0~31.

9. Setting: 1) When Read command

(1) Read area: Device area of data saved in destination station(Server). (2) Save area: Device area of self station to save the data

2) when write command(1) Read area: Device area of self station to send the data(2) Save area: Device area of data saved in destination station(Server).

ModbusAddress

Serveraddress

Clientsaved address

0x40000 M0000 R00000

0x40001 M0001 R00001

0x40009 M0009 R00009

0x4000A M0010 R00010

0x4000F M0015 R00015

0x40010 M0016 R00016

3. Modbus Protocol

ModbusAddress

Serveraddress

Clientsaved address

0x30000 M0010 R00010

0x30001 M0011 R00011

0x30009 M0019 R00019

0x3000A M0020 R00020

0x3000F M0025 R00025

0x30010 M0026 R00026

27 / 47

Page 36: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

Write to PLC after set standard setting and P2P setting.It means all changed information apply to PLC. Go to online write

Only Client need enable link.It means unlock the P2P block to use communication as Client.

Check the P2P block that you want to use. After write, communication start.

Client and Server must do this step Only Client do this step Only Client do this step

DO Client PLC

DO Server PLC

DO Client PLC DO Client PLC

3. Modbus Protocol

28 / 47

Page 37: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

3.1.3 Frame monitor

After enable link, Client PLC send message to Server. Server response to the message. These step is called data communication. In XG5000 you can diagnosis using frame monitor. Frame monitor shows all message. Go to Online -> Communication module setting -> System Diagnosis -> right click on module -> frame monitorIn frame monitor window select channel and start. And then message shown up. Blue message is transmission(TX). Red message is receive(RX). Also change view type HEX or ASCII. You can save all message as a csv file.

3. Modbus Protocol

Write request frame monitor

29 / 47

Page 38: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4. User frame definition

Page 39: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4. User frame definition

* User frame definition

There are many protocols according to producer of communication device and it is impossible to supports diverse protocols. So if the user defines protocols and writes program, Cnet allows the communication between different devices according to defined protocol. In order to communicate with device which doesn’t use specific protocols (XGT protocol, Modbus protocol), the user can directly define protocol used in the device the user want to communicate and communicate. At this time, the user should define TX and RX frame so that it meets partner device’s protocol.

Cnet make request message and response message using device’s frame.Universally a frame structure consist of head, body, tail.Head is start of message. Body contain most of data. Tail is end of message. Universally frame has error check method.Error check means check all bit in 1 frame using variety method for check communication success. Usually it is in tail.

When communication with device of which protocol is not supported by Cnet Server, device should make Cnet’sprotocol that is supported.Cnet support XGT protocol and Modbus protocol. So device should make XGT or Modbus protocol frame message for communication with XGB Cnet.

30 / 47

Page 40: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4. User frame definition

4.1 Head, Body, Tail, BCC

When writing frame by user definition frame, frame is divided into HEAD that start of frame, TAIL that end of frame and BODY that data area. Each HEAD, TAIL and BODY is divided into segment. Total size of one frame should be less than 1024 byte.

1) Structure of HEAD Input type of segment for HEAD is divided into numerical constant and string constant. In case of numerical constant, it means HEX value and in case of string constant, it means ASCII value.

2) Structure of TAIL Input type of segment for HEAD is divided into numerical constant, string constant and BCC which check frame error. Meaning of numerical constant and string constant is same with HEAD’s. BCC is segment used for checking TRX frame error, only one can be set in the TAIL.

31 / 47

Page 41: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

* BCC error check It is the meaning that the numerical value and the character string which are used in HEAD are used to be equal. BCC is the segment which is used to inspect the error of the TRX frame. It can only set Tail. When BCC is applied, calculation about TRX frame is executed and if calculation is different, relevant frame is ignored to improve the reliability of communication. Calculation methods about each BCC are as follows.

When setting BCC, in case of general method, the user need not set BCC setting range and indication method and in case of dedicated method, the user should set BCC setting range and indication method.

4. User frame definition

32 / 47

Page 42: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

3) Structure of BODY Input type of segment which composes BODY is different according to receive and transmission. In case of transmission, they are divided into string constant, numerical constant and fix sized variable. Meaning of string constant and numerical constant is same with HEAD’s.

(1) Variable sized variable (in RX frame) Part where size and contents changes are defined as variable sized variable. Variable sized variable can be set in the BODY and after variable sized variable, the user can’t add segment. When using variable sized variable, there should be one among HEAD, TAIL. If the user registers variable sized variable without HEAD, TAIL, when receiving frame, there may be error according to communication status. For reliability of communication, register one among HEAD, TAIL. (In case of Variable sized variable of TX frame, the size is designated in P2P Block setting, so the function and characteristic is same with Fix sized variable of RX frame.)

(2) Fix sized variable (in RX frame) Frame part where size is fixed but contents changes are defined as Fix sized variable. It can be set in the BODY. In case of Fix sized variable, the user can register up to 4. TRX frame standard for user - defined communication of XGT Cnet I/F module is as follows.

4. User frame definition

33 / 47

Page 43: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4.2 Configuration example

RS-485 9600/8/1/None/user defined communication

XGB-U iG5A

XGB-U communicate with two iG5A inverters. iG5A supports Modbus protocol and LS bus protocol. This example using user frame definition making LS bus protocol. In this case XGB-U is Client, iG5A is Server.Client read and write iG5A data. Before making LS bus protocol message frame, iG5A need parameter setting for communicate. DRV parameter setting is only for write request. iG5A parameters as follows.

READ

Set up each drive communication-concerning parameter as follows.For iG5A (station: 1)* DRV-03 [Drive mode]: 3 [RS-485]* DRV-04 [Freq. mode]: 7 [RS-485]* I/O 59 [communication protocol]: 1 [LS bus]* I/O 60 [VFD station number]: 1* I/O 61 [communication speed]: 3 (9600bps)

4. User frame definition

34 / 47

Page 44: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4.2 Configuration example

Client standard setting (station 0)* Speed: 9600bps* Operation mode: P2P (user define)* Data bit: 8* Stop bit: 1* Parity bit: none

After standard setting, Go to P2P channel.P2P driver set User frame definition.

4. User frame definition

35 / 47

Page 45: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4.2.1 Request frame

iG5A parameter address

iG5A read request frame

XGB-U want to read iG5A 8word data. Continuous 8word 0x0007~000E will save in PLC device.Before communication, XGB-U should make request message and response message.Using LS bus frame structure make both messages. You can make head, body, tail by ASCII or HEX.

Read request frame: ENQ 01 R 0007 8 xx EOTRead response frame: ACK 01 R 0123 4567 89AB CDEF 0123 4567 89AB CDEF xx EOT

* xx = BCC (byte sum)* 0123 4567 89AB CDEF 0123 4567 89AB CDEF = 8word data from iG5A 0x0007

iG5A read response frame

Red: head

Blue: body

Green: tail

4. User frame definition

36 / 47

Page 46: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4.2.1 Request frame

1) Message group

Send message group Receive message group

2) Frame structure make

Head make Tail make Body make(body name need)

Next page, enter each component code.

4. User frame definition

37 / 47

Page 47: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

3) head

4.2.1 Request frame

Numerical constant : hexadecimal codeString constant : ASCII code

Numerical constant 05 means h05(1byte).h05 = ASCII for control code Enquiry(ENQ) It is LS bus protocol’s Request message head.

4) tail

LS bus protocol’s frame error check(BCC) position is in front of tail. You must make BCC first. And then make tail.

1. Add BCC 2. BCC settings 3. Select ‘BYTE SUM’ method 4. Byte sum arrange : body(segment 0)~before BCC <It follows LS bus

protocol>5. ASCII conversion check -> it depends on server’s protocol. Byte sum

result express 2byte hexadecimal value. When you check this option, result is converted to ASCII.

6. Swap it means byte sum result 2byte swap. When you change to swap, 2byte result swap. *example) result: 0a f5 -> f5 0a

7. Add line8. Numerical constant 04 make after BCC (h04 = ASCII for control code

End Of Tail (EOT))

* Step for make BCC and tail

4. User frame definition

38 / 47

Page 48: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

5) Body

String constant: 01R00078It follow iG5A read request frame format.

Finally all request message frame made. Go to P2P block and send the frame.

In P2P block, choose body. It means each frame can have several bodies. That’s why only body need name in group making. Over P2P block show only send message. In this case, every second(F00093) XGB-U request read iG5A data. But it doesn’t have receive frame. So it can’t identify response message and save the data. Next step is response frame.

iG5A read request frame

6) P2P block

4. User frame definition

39 / 47

Page 49: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4.2.2 Response frame

iG5A read response frame

1) head

h06 01 R 0123 4567 89AB CDEF 0123 4567 89AB CDEF xx h04

For receive response message from iG5A, make response frame. After make the frame, add to P2P block.Response format is as follows.

8word Read request 32 ASCII byte data receive with head and tail.

2) tail

Numerical constant 06 means h06(1byte).h06 = ASCII ACK(Acknowledge) It is LS bus protocol’s Response message head.

BCC and tail are same as request frame.

4. User frame definition

40 / 47

Page 50: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4) P2P block

Add receive frame block save area D200 16byte(8word) data receive iG5A 0x0007~000E save in D200~D207

After write to PLC, communication start. You can check communication status using frame monitor.

3) body

String ‘01R’ = station number ‘01’, command ‘R’Assign memory = when you check it you can set save area in P2P block.ASCII to Hex conversion = iG5A send ASCII data. If you select ASCII to Hex, hexadecimal data is saved in save area. 2byte swap = 1word consist of 2byte. For example, iG5A send h1234 and save in D200. D200 data is h3412. in this case 2byte

swap need. There are ‘none’, ‘2byte’, ‘4byte’, ‘8byte’ in swap category.

16byte data will receive 32byte ASCII data will receiveWhen ASCII communication is used, every digit number is to be converted to ASCII code. h1234 (2byte) 31 32 33 34 (4byte)Because LS bus protocol uses ASCII communication, total 16 bytes number is converter to 32 ASCII code.You will save iG5A data as hexadecimal value. iG5A send ASCII format. So multiply twice byte size.

You can choose Fix sized or variable sized. If you divide save area from receive data, you can add several fix sized variable.But Variable sized variable can input only one. You can’t divide save area. In this case all receive data is continuous.

4. User frame definition

41 / 47

Page 51: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

4.2.3 Frame monitor

Frame monitor steps.1. view by HEX or ASCII. 2. select channel. 3. start 4. save as file (when necessary)

Transmission packet send every second. Because conditional flag set F93 in P2P block. 70msec later receive packet come after request.

4. User frame definition

42 / 47

Page 52: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

Appendix

Page 53: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

Appendix

* P2P setting

Each index means each message’s parameter. This example send 12 message using separate Conditional flag.

Sequential communication method: M0 on request response M1 on request response …. M11 on request response M0 on

Because RS485 using half-duplex. When 1:N communication each message’s conditional flag interlock.

When M00000 is on rising edge, request frame send. After receive response frame, next request frame send.

1. Interlock program

43 / 47

Page 54: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

* Conditional flag M0~M11 interlock program.

1. Interlock program

44 / 47

Appendix

Page 55: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

* Conditional flag M0~M11 interlock program.

1. Interlock program

45 / 47

Appendix

Page 56: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

2. P2PSN program(1:N communicate case)

* P2P setting

In XGB One P2P block have 32 index. In other word, One Cnet module or Built-in Cnet can set Max. 32 parameter. Some case Index number is not enough.There are several servers. Read and write request are also several. It need 50 index.

In this case, there are two solutions. First is divide index using two Cnet Channels. Second is do not check destination number and reduce index. Make a program using P2PSN.

Example) There are six device station No.0~5. XGB-U request read and write same data to each device. You want to leave 30 index for other setting. D0.0 and D0.1 are one second clock.

D0.0 on write request to 0 response from 0 D0.1 on read request to 0 response from 0 D0.0 on write request to 1 response from 1 D0.1 on read request to 1 response from 1 …….. D0.0 on write request to 5 response from 5 D0.1 on read request to 5 response from 5 D0.0 on write request to 0 response from 0 D0.1 on read request to 0 response from 0 D0.0 on REPEAT

46 / 47

Appendix

Page 57: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

2. P2PSN program(1:N communicate case)

* P2PSN programming

47 / 47

Appendix

Page 58: XGB-U COMMUNICATIONServer PLC don’t need P2P parameter setting. When PLC act as Server, just set standard setting and then write to PLC. Server don’t need extra work. Client PLC’s

The end