Modbus Tcp Master Communication (Send); Write Data Into An External Device - Panasonic FP7 CPU Unit User Manual

Lan port communication
Table of Contents

Advertisement

6.4 MODBUS TCP Master Communication (SEND)

6.4.1 Write Data into 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 and writing can be done simply by specifying the station no. and memory address and
executing SEND/RECV commands.
PLC
DT100
100
DT101
0
・・・・・・
・・・・・・・・
・・・・・・
・・・・・・・・
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 a MODBUS command (16) from the LAN port of the CPU unit, and write the content of
PLC's data register DT100 - DT101 into the data area of an external device 40001 - 40002
(MODBUS address 0000H - 0001H).
• 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 SEND command, specify and execute the PLC initial address (DT100), No. of data
(U2), MODBUS command (16 = H10), partner device station no. (H01), and initial address
(H0). For the address of the partner device, please check operating instructions, etc. of the
relevant device.
R0
DF
Clear to send
master
communication flag
R100
SEND.US
Command message
(Hex) 01 10 00 00 00 02 04 00 64 00 00
(Hex) 01 10 00 00 00 02
Response message
Specify and write address based on SEND command
X90
Y90
Sending master
communication flag
UNITSEL
DT100
U2
S
n
6.4 MODBUS TCP Master Communication (SEND)
R100
SEND
execution
relay
U100
U1
S1
S2
H1001
H0
DT0
D1
D2
D3
External device
supporting Modbus-TCP
40001
100
40002
0
・・・・・・
・・・・・・・・
・・・・・・
・・・・・・・・
SEND execution conditions
Clear to send flag: ON
Sending flag: OFF
Settings for communication port
S1: CPU LAN port (U100)
S2: Connection 1 (U1)
Execute SEND command
S: Data saving area (DT100)
n: No. of sent data (U2)
D1: MODBUS code (H10) and
partner station no. (H01)
D2: "Transmit to" address (H0)
D3: Execution result code (DT0)
6-9

Advertisement

Table of Contents
loading

Table of Contents