You are on page 1of 29

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

Modbus

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

XGK CPU as Modbus server 1. Configuration

1
Modbus Client

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

Modbus Serial (Server)


2. XG5000 setting
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

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 area as D01000, which are starting word register.

Modbus Serial (Server)


3. Modbus Setup in XGK
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

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

XGK 0xxxx
(bit output)
Read by code 01 Write by 05, 15 XG5000 Basic parameter

1xxxx
(bit input)
Read by code 02

4xxxx
(word output) Read by 03 Write by 06, 16

3xxxx
(word input) Read by 04

Modbus Serial (Server)


4. Modbus Function code/memory mapping
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

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 40000 and it will be preset by function code 06. Refer to the following slide.

Modbus Serial (Server)


When the built-in Modbus server of XGK CPU is set as previous 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

if Modbus client uses function code 16 (preset multiple registers) and preset 3 words, then it will preset 3registers of 4xxxx area of Modbus server. And XGK corresponding area for 4xxxx is set as D01000. Therefore D01000~D01002 registers will be preset by Modbus client. The following is the relationship between Modbus client and XGK (Modbus server). 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.

Modbus Serial (Server)


XGK Cnet I/F module as Modbus 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

Modbus

1. Configuration
Modbus Client

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

Modbus Serial (Server)


2. XG-PD setting
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

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.

bit device

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

Modbus Serial (Server)


2. XG-PD setting
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

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

Modbus Serial (Server)


3. XG-PD setup in detail
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

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

XGK 0xxxx
(bit output)
Read by code 01 Write by 05, 15

1xxxx
(bit input)
Read by code 02

XG5000 Basic parameter

4xxxx
(word output) Read by 03 Write by 06, 16

3xxxx
(word input) Read by 04

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 40000 and it will be preset by function code 06.

Modbus Serial (Client)


XGK Cnet I/F module as 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

Modbus

1. Configuration
Modbus Client Modbus Server

Station: 2 Station: 1

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

Modbus Serial (Client)


2. XG-PD setting: basic parameter
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

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

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

Modbus Serial (Client)


2. XG-PD setting: P2P
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

2 1

Modbus Serial (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

Modbus

2. XG-PD setting: P2P Modbus function: 01 (read coil status)


user-edit area bit area

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 has nothing 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 Serial (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

Modbus

2. XG-PD setting: P2P Modbus function: 02 (read input status)


user-edit area bit area

1 2

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 has nothing 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.

Modbus Serial (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

Modbus

2. XG-PD setting: P2P Modbus function: 03 (read holding registers)


user-edit area word area

1 2

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.

Modbus Serial (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

Modbus

2. XG-PD setting: P2P Modbus function: 04 (read input registers)


user-edit area word area

1 2

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.

Modbus Serial (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

Modbus

2. XG-PD setting: P2P Modbus function: 05 (force single coil)


user-edit area bit area

1 2

This setting means Cnet I/F module is to write one bit (K0) to station #2 (Modbus server) 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.

Modbus Serial (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

Modbus

2. XG-PD setting: P2P Modbus function: 06 (preset single register)


user-edit area word area

1 2

This setting means Cnet I/F module is to write one word (D0) to station #2 (Modbus server) 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) words with function code 16 instead of 06.

Modbus Serial (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

Modbus

2. XG-PD setting: P2P Modbus function: 15 (force multiple coils)


user-edit area bit area

1 2

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 written with 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.

Modbus Serial (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

Modbus

2. XG-PD setting: P2P Modbus function: 16 (preset multiple registers)


user-edit area word area

1 2

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 written with 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.

Modbus Serial (Client)


2. XG-PD setting
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

[Online][Connect][Write Parameter]

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

Modbus TCP/IP (Server)


XGK Cnet I/F module as Modbus 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

Modbus

1. Configuration
Modbus TCP/IP Client Modbus Server

Hub

IP address: 200.200.200.20

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 TCP/IP (Server)


2. XG-PD setting
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

bit device

To communicate with Modbus TCP/IP client, basic parameter setting in XG-PD will do.
word device

Note that bit area is denoted as bit device and word area is done as word.

Modbus TCP/IP (Server)


2. XG-PD setting
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

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

Modbus TCP/IP (Client)


XGK FEnet I/F module as 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

Modbus

1. Configuration
Modbus TCP/IP Client

Modbus Server

Hub

IP address: 200.200.200.100

IP address: 200.200.200.30

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

Modbus TCP/IP (Client)


2. XG-PD setting: basic parameter
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

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

Modbus TCP/IP (Client)


2. XG-PD setting: P2P
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

2 1

Server IP

Modbus TCP/IP (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

Modbus

2. XG-PD setting: P2P Modbus function: 04 (read input registers)


user-edit area word area

1 2

This setting means FEnet I/F module is to read 10words (30000) from station #2 (Modbus TCP/IP server) 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 30000 to 3000A data are saved in D100 to D109 in XGK. If you choose single, it reads single word with function code 04. For the rest of P2P block setting is similar to that of Modbus Serial (Client).

Modbus TCP/IP (Client)


2. XG-PD setting
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

[Online][Connect][Write Parameter]

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

You might also like