You are on page 1of 30

Modbus

Modbus Serial (Server)

Modbus Serial (S)  There are two ways to select ML200 as Modbus server: 1) CPU; 2) Snet I/F module
- CPU
- Snet I/F
2MLI CPU as Modbus server
Modbus Serial (C)
- Snet I/F
1. Configuration
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F
1
Modbus Client

 There are two ports in 2MLI. One is SoftMaster programming port and the other is
the built-in Modbus server port.
Modbus
Modbus Serial (Server)
2. SoftMaster setting
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

 Double-click 'Basic Parameter' and select 'MODBUS Setup'.


 Select its communication parameter and set its memory area for Modbus server.
 Here we set DI area as %MW0000, DO area as %MW0100, AI area as %MW1000 and
AO area as %MW2000, which are starting word register.
Modbus
Modbus Serial (Server)
3. Modbus Setup in 2MLI
Modbus Serial (S)
- CPU
- Snet I/F  As other PLC functions as Modbus client, 2MLI CPU is regarded as Modbus server
Modbus Serial (C) having Modicon address.
- Snet I/F
ML200
Modbus TCP/IP (S)
- FEnet I/F
0xxxx 1xxxx
Modbus TCP/IP (C)
- FEnet I/F (bit output) (bit input)

Read by code 01 Read by code 02


Write by 05, 15

SoftMaster Basic parameter

4xxxx 3xxxx
(word output) (word input)

Read by 03 Read by 04
Write by 06, 16
Modbus
Modbus Serial (Server)
4. Modbus Function code/memory mapping
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

 If Modbus client uses function code 06, for example, it will preset 4xxxx-corresponding
area of Modbus server device. Now %M area area starting %MW2000 is set as 40000
and it will be preset by function code 06. Refer to the following slide.
Modbus
Modbus Serial (Server)
 When the built-in Modbus server of 2MLI CPU is set as previous slide,
Modbus Serial (S)
- CPU if Modbus client uses function code 16 (preset multiple registers) and preset 3 words, then it will
- Snet I/F preset 3 registers of 4xxxx area of Modbus server. And 2MLI corresponding area for 4xxxx is set
Modbus Serial (C) as %MW2000. Therefore %MW2000~%MW2002 area will be preset by Modbus client.
- Snet I/F The following is the relationship between Modbus client and Modbus server (2MLI).
Modbus TCP/IP (S)
- FEnet I/F
 When the built-in Modbus server of 2MLI 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
Modbus TCP/IP (C)
- FEnet I/F area of Modbus server which means 5bits of %MW100 (bit: %MW100.0~%MW100.4).
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 %MW0 (bit: %MW0.0~%MW0.5).
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 %MW2000 (%MW2000~%MW2001).
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 %MW1000 (%MW1000~%MW1002).
5) if Modbus client uses function code 05 (force single coil), then it will force 1bit of 0xxxx area
which is %MW0.0.
6) if Modbus client uses function code 06 (preset single register), then it will preset single register
of 4xxxx area which is %MW2000.
7) if Modbus client uses function code 15 (force multiple coils) and force 12bits, then it will force
0xxxx area which means 12bits of %MW0 (bit: %MW0.0~%MW0.11).
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 %MW2000~%MW2002.
Modbus
Modbus Serial (Server)
2MLI Snet I/F module as Modbus server
Modbus Serial (S)
- CPU
- Snet I/F 1. Configuration
Modbus Serial (C)
- Snet I/F
Modbus Client
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

 You are supposed to select Modbus server in SM-NM to communicate with Modbus
client module.
Modbus
Modbus Serial (Server)
e.g.) Modbus Function code/memory mapping
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F
Modbus
Modbus Serial (Server)
2. SoftMaster-NM setting
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F
Channel 1 and 2 type should be
Modbus TCP/IP (S) identical to its hardware type.
- FEnet I/F
If channel 2 type is not equal to its
Modbus TCP/IP (C) real hardware, even though that
- FEnet I/F channel is not used, it does not run
normally.

bit device

 To communicate with Modbus client, basic


parameter setting in SM-NM will do. word device

 Note that bit area is denoted as bit device and


word area is done as word.
Modbus
Modbus Serial (Server)
2. SoftMaster-NM setting
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

 [Online]—[Connect]—[Write Parameter].
Modbus server parameter is set up in basic parameter section.
 [Reset].
After downloading parameter, select [Reset].
Modbus
Modbus Serial (Server)
3. SoftMaster-NM setup in detail
Modbus Serial (S)
- CPU
- Snet I/F
 As other PLC functions as Modbus client, Snet I/F module is regarded as
Modbus server having Modicon address.
Modbus Serial (C)
- Snet I/F
ML200
Modbus TCP/IP (S)
- FEnet I/F
0xxxx 1xxxx
(bit output) (bit input)
Modbus TCP/IP (C)
- FEnet I/F
Read by code 01 Read by code 02
SoftMaster Basic parameter Write by 05, 15

4xxxx 3xxxx
(word output) (word input)

Read by 03 Read by 04
Write by 06, 16

 If Modbus client uses function code 06, for example, it will preset 4xxxx-corresponding
area of Modbus server device. Now %M area starting %MW2000 is set as 40000
and it will be preset by function code 06.
Modbus
Modbus Serial (Client)
Snet I/F module as Modbus client
Modbus Serial (S)
- CPU
- Snet I/F 1. Configuration
Modbus Serial (C)
- Snet I/F Modbus Server
Modbus Client
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

Station: 2
Station: 1

 You are supposed to select P2P and Modbus client in SM-NM to communicate
with Modbus server device.
Modbus
Modbus Serial (Client)
2. SM-NM setting: basic parameter
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F
Channel 1 and 2 type
Modbus TCP/IP (C) should be identical to its
- FEnet I/F hardware type.

 Select Use P2P in Active mode of basic parameter setting.


 Now let's set P2P part. Refer to the next slide.
Modbus
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F
2
Modbus TCP/IP (C)
- FEnet I/F 1
Modbus
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 01 (read coil status)
- Snet I/F
user-edit area bit area
Modbus Serial (C)
- Snet I/F
1
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C) 2


- FEnet I/F

 This setting means Snet I/F module is to read one bit (00000) from station #2
(Modbus server) when %MX1 bit turns on. Since its read area is 00000 (Modbus bit
output area) we know that Modbus client (Snet I/F module) uses function code 01.
 In the above, single for command type is selected, which means single bit is read and
it has nothing to do with function code. If you choose continuous, Snet I/F module
reads continuous bits using function code 01 as long as it holds the above setting.
Modbus
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 02 (read input status)
- Snet I/F user-edit area
bit area
Modbus Serial (C)
- Snet I/F
1
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C) 2


- FEnet I/F

 This setting means Snet I/F module is to read one bit (10000) from station #2
(Modbus server) when %MX0 bit turns on. Since its read area is 10000 (Modbus bit
input area) we know that Modbus client (Snet I/F module) uses function code 02.
 In the above, single for command type is selected. This means single bit is read and
it has nothing to do with function code. If you choose continuous, Snet I/F module
reads continuous bits with function code 02 as long as it holds the above setting.
Modbus
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 03 (read holding registers)
- Snet I/F
user-edit area word area
Modbus Serial (C)
- Snet I/F
1
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C) 2


- FEnet I/F

 This setting means Snet I/F module is to read one word (40000) from station #2
(Modbus server) when %MX2 bit turns on. Since its read area is 40000 (Modbus word
output area) we know that Modbus client (Snet I/F module) uses function code 03.
 In the above, single for command type is selected. This means single word is read.
If you choose continuous, Snet I/F module reads continuous words with function
code 03 as long as it holds the above setting.
Modbus
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 04 (read input registers)
- Snet I/F user-edit area word area
Modbus Serial (C)
- Snet I/F
1
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C) 2


- FEnet I/F

 This setting means Snet I/F module is to read one word (30000) from station #2
(Modbus server) when %MX3 bit turns on. Since its read area is 30000 (Modbus word
input area) we know that Modbus client (Snet I/F module) uses function code 04.
 In the above, single for command type is selected. This means single word is read.
If you choose continuous, Snet I/F module reads continuous words with function
code 04 as long as it holds the above setting.
Modbus
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 05 (force single coil)
- Snet I/F user-edit area bit area
Modbus Serial (C)
- Snet I/F
1
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C) 2


- FEnet I/F

 This setting means Snet I/F module is to write one bit (%MW10000.0) to station #2
(Modbus server) 00000 area when %MX4 bit turns on. Since its force area is 00000
(Modbus bit output area) we know that Modbus client uses function code 05.
 In the above, single for command type is selected. This means single bit is written.
If you choose continuous, Snet I/F module forces continuous (multiple) bits
with function code 15 instead of 05.
Modbus
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 06 (preset single register)
- Snet I/F user-edit area word area
Modbus Serial (C)
- Snet I/F
1
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C) 2


- FEnet I/F

 This setting means Snet I/F module is to write one word (%MW2000) to station #2
(Modbus server) 40000 area when %MX5 bit turns on. Since its preset area is 40000
(Modbus word output area) we know that Modbus client uses function code 06.
 In the above, single for command type 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
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 15 (force multiple coils)
- Snet I/F
user-edit area bit area
Modbus Serial (C)
- Snet I/F
1
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C) 2


- FEnet I/F

 This setting means Snet I/F module is to write multiple bits (10bits: %MW3000.0 ~
%MW3000.9) to station #2 (Modbus server) 00000~00009 area when %MX6 bit turns on.
Since its force area is 00000 (Modbus bit output area), Snet I/F uses function code 05.
 In the above, continuous for command type is selected. This means multiple bits are
written with function code 15. If you choose single, then Data size cell is disabled and
Snet I/F module forces single bit with function code 05.
Modbus
Modbus Serial (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 16 (preset multiple registers)
- Snet I/F
user-edit area word area
Modbus Serial (C)
- Snet I/F
1
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C) 2


- FEnet I/F

 This setting means Snet I/F module is to write multiple words (10words: %MW5000 ~
%MW5009) to station #2 (Modbus server) 40000 area when %MX7 bit turns on. Since
its preset area is 40000 (Modbus word output area), Snet I/F uses function code 16.
 In the above, continuous for command type 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
Modbus Serial (Client)
2. SM-NM setting
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

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

 [Online]—[Reset]
 [Online]—[Enable Link]
Modbus
Modbus TCP/IP (Server)
2MLI FEnet I/F module as Modbus server
Modbus Serial (S)
- CPU
- Snet I/F 1. Configuration
Modbus Serial (C)
- Snet I/F Modbus Server
Modbus TCP/IP Client
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

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
Modbus TCP/IP (Server)
2. SM-NM setting
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

bit device

 To communicate with Modbus TCP/IP client,


basic parameter setting in SM-NM will do.
word device  Note that bit area is denoted as bit device and
word area is done as word.
Modbus
Modbus TCP/IP (Server)
2. SM-NM setting
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

 [Online]—[Connect]—[Write Parameter].
Modbus server parameter is set up in basic parameter section.
 [Reset].
After downloading parameter, select [Reset].
Modbus
Modbus TCP/IP (Client)
2MLI FEnet I/F module as Modbus client0
Modbus Serial (S)
- CPU
- Snet I/F 1. Configuration
Modbus Serial (C)
- Snet I/F
Modbus TCP/IP Client Modbus Server
Modbus TCP/IP (S)
- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

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 SM-NM to
communicate with Modbus server device.
Modbus
Modbus TCP/IP (Client)
2. SM-NM setting: basic parameter
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

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


Modbus
Modbus TCP/IP (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


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

Server IP
Modbus
Modbus TCP/IP (Client)
2. SM-NM setting: P2P
Modbus Serial (S)
- CPU Modbus function: 04 (read input registers)
- Snet I/F
user-edit area word area
Modbus Serial (C)
- Snet I/F

Modbus TCP/IP (S) 1


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F 2

 This setting means FEnet I/F module is to read 10words (30000) from station #2 (Modbus TCP/IP
server) at every 1 second (_T1S 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 command type is selected, which means multiple words are read
and 30000 to 3000A data are saved in %MW1000 to %MW1009. 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
Modbus TCP/IP (Client)
2. SM-NM setting
Modbus Serial (S)
- CPU
- Snet I/F

Modbus Serial (C)


- Snet I/F

Modbus TCP/IP (S)


- FEnet I/F

Modbus TCP/IP (C)


- FEnet I/F

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

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

You might also like