MODBUS
TCP Master/Slave Communication
6.3 MODBUS TCP Master Communication (RECV)
6.3.1 Read Data from an External Device
Instructions
In master communication, PLC has the sending right, and executes communication by
sending commands to devices that support MODBUS, and receiving responses. Messages in
accordance with the protocol are automatically generated by PLC. In the user program,
reading can be done simply by specifying the station no. and memory address and executing
RECV commands.
External device
supporting Modbus-TCP
(Hex) 01 03 00 00 00 02
(Hex) 01 03 04 00 64 00 00
Command message
Response message
・・・・・・・・
・・・・・・
・・・・・・・・
・・・・・・
0
DT101
100
DT100
・・・・・・・・
・・・・・・
・・・・・・・・
・・・・・・
0
40002
100
40001
PLC
Specify and read address based on RECV command
Note: The above figure indicates the data part of Modbus function. In communication via LAN, a header including size information of the sent data is added.
Sample program
•
Send MODBUS commands (03) from the LAN port of the CPU unit, read data from the data
area of an external device 40001 - 40002 (MODBUS address 0000H - 0001H), and write the
content into PLC's data register DT100 - DT101.
•
Confirm that Connection 1 is established in the master mode (X90), and that the sending
process is not in progress for the same port (Y90), and start up the SEND command.
•
In the UNITSEL command, specify the slot No. (LAN port: U100) and the connection No. (U1).
•
In the RECV command, specify and execute the types of MODBUS commands, as well as
the partner station no. (H0301), initial address (H0), No. of data (U2), and initial address on
the PLC side to save data (DT100). For the address of the partner device, please check
operating instructions, etc. of the relevant device.
6-4
Summary of Contents for FP7 CPU Unit
Page 8: ...Table of Contents vi ...
Page 9: ...1 Communication Functions of CPU Unit ...
Page 19: ...2 Installation and Wiring ...
Page 23: ...3 Configuration ...
Page 35: ...4 Setting and Operation of User Connection ...
Page 41: ...5 MEWTOCOL Master Slave Communication ...
Page 50: ...MEWTOCOL Master Slave Communication 5 10 ...
Page 51: ...6 MODBUS TCP Master Slave Communication ...
Page 63: ...7 General Purpose Communication ...
Page 74: ...General Purpose Communication 7 12 ...
Page 75: ...8 Specifications ...
Page 89: ...Record of changes Manual No Date Record of Changes WUME FP7LAN 01 Mar 2013 First Edition ...
Page 90: ......
Page 91: ......