Top Banner
Modbus Modbus Modbus Serial (Server) XGK CPU as Modbus server There are two ways to select XGK as Modbus server: 1) CPU; 2) Cnet I/F module 1 2 There are two ports in XGK. One is XG5000 programming port and the other is the built-in Modbus server port. 1. Configuration Modbus Client Modbus Serial (S) - CPU - Cnet I/F Modbus Serial (C) - Cnet I/F Modbus TCP/IP (S) - FEnet I/F Modbus TCP/IP (C) - FEnet I/F
29
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Modbus_XGT

ModbusModbusModbus Serial (Server)

XGK CPU as Modbus server

There are two ways to select XGK as Modbus server: 1) CPU; 2) Cnet I/F module

1

2

There are two ports in XGK. One is XG5000 programming port and the other isthe built-in Modbus server port.

1. Configuration

Modbus Client

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 2: Modbus_XGT

ModbusModbus

Double-click 'Basic Parameters' and select 'MODBUS Setup'.Select its communication parameter and set its memory area for Modbus server.Here we set DI area as M0000, DO area as M0100, AI area as D00000 and AO areaas D01000, which are starting word register.

Modbus Serial (Server)

2. XG5000 settingModbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 3: Modbus_XGT

ModbusModbus

As other PLC functions as Modbus client, XGK CPU is regarded as Modbus serverhaving Modicon address.

0xxxx(bit output)

Read by code 01Write by 05, 15

1xxxx(bit input)

Read by code 02

4xxxx(word output)

Read by 03Write by 06, 16

3xxxx(word input)

Read by 04

XGK

XG5000 Basic parameter

3. Modbus Setup in XGK

Modbus Serial (Server)

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 4: Modbus_XGT

ModbusModbus

4. Modbus Function code/memory mapping

If Modbus client uses function code 06, for example, it will preset 4xxxx-corresponding area of Modbus server device. Now D register area starting D1000 is set as 40000and it will be preset by function code 06. Refer to the following slide.

Modbus Serial (Server)

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 5: Modbus_XGT

ModbusModbus

When the built-in Modbus server of XGK CPU is set as previous slide,1) if Modbus client uses function code 01 (read coil status) and reads 5bits, then it will read 0xxxx

area of Modbus server which means 5bits of M0100 word (bit: M01000~M01004) as set in XG5000.2) if Modbus client uses function code 02 (read input status) and read 6bits, then it will read 1xxxx

area of Modbus server which means 6bits of M0000 word (bit: M00000~M00005).3) if Modbus client uses function code 03 (read holding registers) and read 2words, then it will

read 4xxxx area of Modbus server which means 2words from D01000 (word: D01000~D01001).4) if Modbus client uses function code 04 (read input registers) and read 3 words, then it will read

3xxxx area of Modbus server which means 3words from D00000 (word: D00000~D00002).5) if Modbus client uses function code 05 (force single coil), then it will force 1bit of 0xxxx area

which is M00000.6) if Modbus client uses function code 06 (preset single register), then it will preset single register

of 4xxxx area which is D01000.7) if Modbus client uses function code 15 (force multiple coils) and force 12bits, then it will force

0xxxx area which means 12bits of M0000 word (bit: M00000~M0000B).8) if Modbus client uses function code 16 (preset multiple registers) and preset 3 words, then it will

preset 3registers of 4xxxx area which means D01000~D01002.

When the built-in Modbus server of XGK CPU is set as previous slide,if Modbus client uses function code 16 (preset multiple registers) and preset 3 words, then it willpreset 3registers of 4xxxx area of Modbus server. And XGK corresponding area for 4xxxx is setas D01000. Therefore D01000~D01002 registers will be preset by Modbus client. The following is the relationship between Modbus client and XGK (Modbus server).

Modbus Serial (Server)

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 6: Modbus_XGT

ModbusModbus

XGK Cnet I/F module as Modbus server

You are supposed to select Modbus server in XG-PD to communicate with Modbusclient module.

1. Configuration

Modbus Client

Modbus Serial (Server)

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 7: Modbus_XGT

ModbusModbus

2. XG-PD setting

To communicate with Modbus client, basic parameter setting in XG-PD will do.Note that bit area is denoted as bit device andword area is done as word.

bit device

word device

Modbus Serial (Server)

Channel 1 and 2 type should be identical to its hardware type.If channel 2 type is not equal to its

real hardware, even though that channel is not used, it does not run normally.

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 8: Modbus_XGT

ModbusModbus

2. XG-PD setting

[Online]—[Connect]—[Write Parameter].Modbus server parameter is set up in basic parameter section.[Reset].After downloading parameter, select [Reset].

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Modbus Serial (Server)

Page 9: Modbus_XGT

ModbusModbus

As other PLC functions as Modbus client, XGT Cnet I/F module is regarded as Modbus server having Modicon address.

0xxxx(bit output)

Read by code 01Write by 05, 15

1xxxx(bit input)

Read by code 02

4xxxx(word output)

Read by 03Write by 06, 16

3xxxx(word input)

Read by 04

XGK

XG5000 Basic parameter

3. XG-PD setup in detail

If Modbus client uses function code 06, for example, it will preset 4xxxx-corresponding area of Modbus server device. Now D register area starting D1000 is set as 40000and it will be preset by function code 06.

Modbus Serial (Server)

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 10: Modbus_XGT

ModbusModbus

XGK Cnet I/F module as Modbus client

You are supposed to select P2P and Modbus client in XG-PD to communicate with Modbus server device.

1. Configuration

Modbus Client

Modbus Serial (Client)

Modbus Server

Station: 1Station: 2

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 11: Modbus_XGT

ModbusModbus

2. XG-PD setting: basic parameter

Select Use P2P in Active mode of basic parameter setting.Now let's set P2P part. Refer to the next slide.

Modbus Serial (Client)

Channel 1 and 2 type should be identical to its hardware type.

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 12: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 13: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

This setting means Cnet I/F module is to read one bit (00000) from station #2 (Modbus server) when M1 bit turns on. Since its read area is 00000 (Modbus bit output area) we know that Modbus client (Cnet I/F module) uses function code 01.In the above, single for method is selected. This means single bit is read and it hasnothing to do with function code. If you choose continuous, Cnet I/F module reads continuous bits using function code 01 as long as it holds the above setting.

Modbus function: 01 (read coil status)bit areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 14: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

Modbus function: 02 (read input status)

This setting means Cnet I/F module is to read one bit (10000) from station #2 (Modbus server) when M0 bit turns on. Since its read area is 10000 (Modbus bit input area) we know that Modbus client (Cnet I/F module) uses function code 02.In the above, single for method is selected. This means single bit is read and it hasnothing to do with function code. If you choose continuous, Cnet I/F module reads continuous bits with function code 02 as long as it holds the above setting.

bit areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 15: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

Modbus function: 03 (read holding registers)

This setting means Cnet I/F module is to read one word (40000) from station #2 (Modbus server) when M2 bit turns on. Since its read area is 40000 (Modbus word output area) we know that Modbus client (Cnet I/F module) uses function code 03.In the above, single for method is selected. This means single word is read. If you choose continuous, Cnet I/F module reads continuous words with function code 03 as long as it holds the above setting.

word areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 16: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

Modbus function: 04 (read input registers)

This setting means Cnet I/F module is to read one word (30000) from station #2 (Modbus server) when M3 bit turns on. Since its read area is 30000 (Modbus word input area) we know that Modbus client (Cnet I/F module) uses function code 04.In the above, single for method is selected. This means single word is read. If you choose continuous, Cnet I/F module reads continuous words with function code 04 as long as it holds the above setting.

word areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 17: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

Modbus function: 05 (force single coil)

This setting means Cnet I/F module is to write one bit (K0) to station #2 (Modbusserver) 00000 area when M4 bit turns on. Since its force area is 00000 (Modbus bit output area) we know that Modbus client (Cnet I/F module) uses function code 05.In the above, single for method is selected. This means single bit is written.If you choose continuous, Cnet I/F module forces continuous (multiple) bits with function code 15 instead of 05.

bit areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 18: Modbus_XGT

ModbusModbus

This setting means Cnet I/F module is to write one word (D0) to station #2 (Modbusserver) 40000 area when M5 bit turns on. Since its preset area is 40000 (Modbus word output area) we know that Modbus client (Cnet I/F module) uses function code 06.In the above, single for method is selected. This means single word is written.If you choose continuous, Cnet I/F module presets continuous (multiple) wordswith function code 16 instead of 06.

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

Modbus function: 06 (preset single register)word areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 19: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

Modbus function: 15 (force multiple coils)

This setting means Cnet I/F module is to write multiple bits (10bits: P100~P109) to station #2 (Modbus server) 00000~00009 area when M6 bit turns on. Since its force area is 00000 (Modbus bit output area) we know Cnet I/F module uses function code 05.In the above, continuous for method is selected. This means multiple bits are writtenwith function code 15. If you choose single, then Data size cell is disabled and Cnet I/F module forces single bit with function code 05.

bit areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 20: Modbus_XGT

ModbusModbus

This setting means Cnet I/F module is to write multiple words (10words: D100~D109) to station #2 (Modbus server) 40000 area when M7 bit turns on. Since its preset area is 40000 (Modbus word output area) we know Cnet I/F module uses function code 16.In the above, continuous for method is selected. This means multiple words are writtenwith function code 16. If you choose single, then Data size cell is disabled and Cnet I/F module presets single word with function code 6.

2. XG-PD setting: P2P

Modbus Serial (Client)

1

2

Modbus function: 16 (preset multiple registers)word areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 21: Modbus_XGT

ModbusModbus

2. XG-PD setting

[Online]—[Connect]—[Write Parameter]

[Online]—[Enable Link][Online]—[Reset]

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Modbus Serial (Client)

Page 22: Modbus_XGT

ModbusModbus

XGK Cnet I/F module as Modbus server

1. Configuration

Modbus TCP/IP Client

Modbus TCP/IP (Server)

Modbus Server

IP address: 200.200.200.20

Hub

IP address: 200.200.200.200

You are supposed to select Modbus TCP/IP server in XG-PD to communicate with Modbus client module.

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 23: Modbus_XGT

ModbusModbus

2. XG-PD setting

To communicate with Modbus TCP/IP client,basic parameter setting in XG-PD will do.Note that bit area is denoted as bit device andword area is done as word.

bit device

word device

Modbus TCP/IP (Server)

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 24: Modbus_XGT

ModbusModbus

2. XG-PD setting

[Online]—[Connect]—[Write Parameter].Modbus server parameter is set up in basic parameter section.[Reset].After downloading parameter, select [Reset].

Modbus TCP/IP (Server)

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 25: Modbus_XGT

ModbusModbus

XGK FEnet I/F module as Modbus client

1. Configuration

Modbus TCP/IP (Client)

Modbus TCP/IP Client Modbus Server

IP address: 200.200.200.100 IP address: 200.200.200.30

Hub

You are supposed to select P2P and Modbus TCP/IP client in XG-PD to communicate with Modbus server device.

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Page 26: Modbus_XGT

ModbusModbus

2. XG-PD setting: basic parameter

Now let's set P2P part. Refer to the next slide.

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Modbus TCP/IP (Client)

Page 27: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

1

2

Server IP

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Modbus TCP/IP (Client)

Page 28: Modbus_XGT

ModbusModbus

2. XG-PD setting: P2P

1

2

Modbus function: 04 (read input registers)

This setting means FEnet I/F module is to read 10words (30000) from station #2 (Modbus TCP/IPserver) at every 1 second (F93 turns on). Since its read area is 30000 (Modbus word input area) we know that Modbus TCP/IP client uses function code 04.In the above, continuous for method is selected. This means multiple words are read and 30000to 3000A data are saved in D100 to D109 in XGK. If you choose single, it reads single word withfunction code 04. For the rest of P2P block setting is similar to that of Modbus Serial (Client).

word areauser-edit area

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Modbus TCP/IP (Client)

Page 29: Modbus_XGT

ModbusModbus

2. XG-PD setting

[Online]—[Connect]—[Write Parameter]

[Online]—[Enable Link][Online]—[Reset]

Modbus Serial (S)- CPU- Cnet I/F

Modbus Serial (C)- Cnet I/F

Modbus TCP/IP (S)- FEnet I/F

Modbus TCP/IP (C)- FEnet I/F

Modbus TCP/IP (Client)