0% found this document useful (0 votes)
391 views38 pages

SIMATIC - GW With S7-1200 Modbus RTU

This document provides examples of using a Modbus RTU slave (GW-7662) to communicate with a Modbus master in a SIMATIC TIA Portal environment. It demonstrates how to configure the GW-7662 in TIA Portal, and provides examples of reading and writing digital and analog inputs/outputs between the Modbus slave and PLC.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
391 views38 pages

SIMATIC - GW With S7-1200 Modbus RTU

This document provides examples of using a Modbus RTU slave (GW-7662) to communicate with a Modbus master in a SIMATIC TIA Portal environment. It demonstrates how to configure the GW-7662 in TIA Portal, and provides examples of reading and writing digital and analog inputs/outputs between the Modbus slave and PLC.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

GW-7662 (Modbus RTU Slave)

How to Communicate with Modbus master?


Example for SIMATIC TIA portal
P re c e d i n g O p e rat i o n
E xa m p l e 1 : M o d b u s m a ste r
E xa m p l e 2 : M o d b u s m a ste r
E xa m p l e 3 : M o d b u s m a ste r
E xa m p l e 4 : M o d b u s m a ste r

re a d / w r i te D O f ro m / to P LC
re a d / w r i te AO f ro m / to P LC
re a d D I d ata f ro m P LC
re a d A I d ata f ro m P LC

Preceding Operation
Check wire connection between GW-7662 & Modbus devices.
How to check the wire connection?
C o m m u n i c a t i o n w i t h P L C ( L E D = > A P : O N , B O OT: O F F, E R R : O F F ) .
H o w t o c o n f i g u r e G W - 7 6 6 2 i n S I M AT I C T I A p o r t a l ?
D o w n l o a d P F N _ To o l u t i l i t y.
P F N _ To o l
D o w n l o a d M o d b u s R T U m a s t e r u t i l i t y.
MBRTU tool

Modbus master read/write 16-channel DO from/to PLC


SIMATIC S7-1200
PROFINET IO Controller
(Master)

Modbus Master

PROFINET
Comport Setting:

GW-7662

115200, n, 8, 1

Modbus RTU

Modbus RTU Slave (DO)


PROFINET IO device Modbus ID:2
Data Address: 00001~00016
(Slave)
Data Length: 2

Modbus master read and write 16-channel DO to PLC

Modbus master read and write 16-channel DO to PLC


3. Upload

1. Set Modbus settings

2. Add Modbus Slave Type

Modbus master read and write 16-channel DO to PLC


The first input 8 bytes and output 8 bytes are allocated for system. (1~8)
The 9th byte to the 32th byte are allocated for Modbus. (9~32)

IB9 => used to receive DO 1~8 from Modbus master


IB10 => used to receive DO 9~16 from Modbus master
I9.0~7 => used to receive DO 1~8 from Modbus master
I10.0~7 => used to receive DO 9~16 from Modbus master

Modbus master read and write 16-channel DO to PLC


Confirm GW-7662s COM port setting is the same with Modbus master tool

Modbus master read and write 16-channel DO to PLC


Send Modbus command (FC 0F) to change DO status(0xAA, 0x55)

1. Send DO Data
0xAA => for DO 1~8
0x55 => for DO 9~16
2. Receive Resp.

Modbus master read and write 16-channel DO to PLC


PLC will receives DO status(0xAA, 0x55) at PLC address IB9, IB10

Modbus master read and write 16-channel DO to PLC


Send Modbus command (FC 05) to change DO status
Set DO ch-5(Modbus address: 00005): ON

1. Send query cmd

2. Receive Resp.

Modbus master read and write 16-channel DO to PLC


PLC will receives DO status at PLC address I9.4(ch-5)

Modbus master read and write 16-channel DO to PLC


Send Modbus command (FC 01) to read DO status

1. Send query cmd

2. Receive DO data
0xBA => for DO 1~8
0x55 => for DO 9~16

Modbus master read/write 3-channel AO from/to PLC


SIMATIC S7-1200
PROFINET IO Controller
(Master)

Modbus Master

PROFINET
Comport Setting:

GW-7662

115200, n, 8, 1

Modbus RTU

Modbus RTU Slave (AO)


PROFINET IO device Modbus ID:4
Data Address: 40001~40003
(Slave)
Data Length: 3

Modbus master read/write 3-channel AO from/to PLC

Modbus master read/write 3-channel AO from/to PLC


3. Upload

1. Set Modbus settings

2. Add Modbus Slave Type

Modbus master read/write 3-channel AO from/to PLC


The first input 8 bytes and output 8 bytes are allocated for system. (1~8)
The 9th byte to the 32th byte are allocated for Modbus. (9~32)

IW9 => used to receive AO 1 from Modbus master


IW11 => used to receive AO 2 from Modbus master
IW13 => used to receive AO 3 from Modbus master

Modbus master read/write 3-channel AO from/to PLC


Confirm GW-7662s COM port setting is the same with Modbus master tool

Modbus master read/write 3-channel AO from/to PLC


Send Modbus command (FC 10) to change AO status(0x1122, 0x3344, 0x5566)

1. Send AO Data
0x1122 => for AO 1
0x3344 => for AO 2
0x5566 => for AO 3
2. Receive Resp.

Modbus master read/write 3-channel AO from/to PLC


PLC will receives AO status(0x1122, 0x3344, 0x5566) at PLC address IW9, IW11, IW13

Modbus master read/write 3-channel AO from/to PLC


Send Modbus command (FC 06) to change AO status
Set AO ch-2(Modbus address: 40002): 0xABCD

1. Send query cmd

2. Receive Resp.

Modbus master read/write 3-channel AO from/to PLC


PLC will receives AO status(0xABCD) at PLC address IW11

Modbus master read/write 3-channel AO from/to PLC


Send Modbus command (FC 03) to read AO status

1. Send query cmd

2. Receive AO data
0x1122 => for AO 1
0xABCD => for AO 2
0x5566 => for AO 3

Modbus master read 14-channel DI from PLC


SIMATIC S7-1200
PROFINET IO Controller
(Master)

Modbus Master

PROFINET
Comport Setting:

GW-7662

115200, n, 8, 1

Modbus RTU

Modbus RTU Slave (DI)


PROFINET IO device Modbus ID:3
Data Address: 10001~10014
(Slave)
Data Length: 2

Modbus master read 14-channel DI from PLC

Modbus master read 14-channel DI from PLC


3. Upload

1. Set Modbus settings

2. Add Modbus Slave Type

Modbus master read 14-channel DI from PLC


The first input 8 bytes and output 8 bytes are allocated for system. (1~8)
The 9th byte to the 32th byte are allocated for Modbus. (9~32)

QB9 => used to refresh DI 1~8


QB10 => used to refresh DI 9~14
Q9.0~7 => used to refresh DI 1~8
Q10.0~5 => used to refresh DI 9~14

Modbus master read 14-channel DI from PLC


Confirm GW-7662s COM port setting is the same with Modbus master tool

Modbus master read 14-channel DI from PLC


Send Modbus command (FC 02) to read DI status

1. Send query cmd

2. Receive DI data
0x00 => for DI 1~8
0x00 => for DI 9~14

Modbus master read 14-channel DI from PLC


Modify QB9, QB10 to 0xAA, 0x15

Modbus master read 14-channel DI from PLC


Send Modbus command (FC 02) to read DI status again

1. Send query cmd

2. Receive DI data
0xAA => for DI 1~8
0x15 => for DI 9~14

Modbus master read 4-channel AI from PLC


SIMATIC S7-1200
PROFINET IO Controller
(Master)

Modbus Master

PROFINET
Comport Setting:

GW-7662

115200, n, 8, 1

Modbus RTU

Modbus RTU Slave (AI)


PROFINET IO device Modbus ID:5
Data Address: 30001~30004
(Slave)
Data Length: 4

Modbus master read 4-channel AI from PLC

Modbus master read 4-channel AI from PLC


3. Upload

1. Set Modbus settings

2. Add Modbus Slave Type

Modbus master read 4-channel AI from PLC


The first input 8 bytes and output 8 bytes are allocated for system. (1~8)
The 9th byte to the 32th byte are allocated for Modbus. (9~32)

QW9 => used to refresh AI 1


QW11 => used to refresh AI 2
QW13 => used to refresh AI 3
QW15 => used to refresh AI 4

Modbus master read 4-channel AI from PLC


Confirm GW-7662s COM port setting is the same with Modbus master tool

Modbus master read 4-channel AI from PLC


Send Modbus command (FC 04) to read AI status

1. Send query cmd

2. Receive AI data
0x0000 => for AI 1
0x0000 => for AI 2
0x0000 => for AI 3
0x0000 => for AI 4

Modbus master read 4-channel AI from PLC


Modify QW9, QW11, QW13, QW15 to 0x1122, 0x3344, 0x5566, 0x7788

Modbus master read 4-channel AI from PLC


Send Modbus command (FC 04) to read AI status again

1. Send query cmd

2. Receive AI data
0x1122 => for AI 1
0x3344 => for AI 2
0x5566 => for AI 3
0x7788 => for AI 4

You might also like