Modbus Rtu Master Communication (Send); Write Data Into An External Device - Panasonic AFP7CPS4E User Manual

Fp7 series, programmable controller
Table of Contents

Advertisement

8.4 MODBUS RTU Master Communication (SEND)

8.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-RTU, 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 instructions.
PLC
DT100
100
DT101
0
・・・・・・
・・・・・・・・
・・・・・・
・・・・・・・・
 Sample program
 Send commands from the COM1 port of the CPU unit, and write the content of PLC's data
register DT100 - DT101 into the data area of an external device (station no. 1) 40001 - 40002.
 Confirm that the unit is in the master mode (XC), and that the sending process is not in
progress for the same port (YC), and start up the SEND instruction.
 In the UNITSEL instruction, specify the slot No. (U0) and the COM. port No. (U1).
 In the SEND instruction, specify and execute the PLC initial address (DT100), No. of data
(U2), MODBUS function code to be used (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
Master
communication
R100
Clear to send flag
SEND.US
(Note 1) Operand [S1] of SEND instruction is specified by combining two hexadecimal digits of MODBUS function
code with two hexadecimal digits of partner device station no. When the MODBUS function code is 16, specify
H10 for [D1].
(Note 2) When the partner device is FP series PLC, Operand [S2] of SEND instruction can be specified using the
Device No.
(Note 3) The unit number and COM port number in the above program is applied when the COM.1 port of the CPU
unit is used.
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com
Command message
(Hex) 01 10 00 00 00 02 04 00 64 00 00 (CRC)
(Hex) 01 10 00 00 00 02 (CRC)
Response message
Specify and write station no. and address based on SEND instruction
XC
YC
Master
communication
Sending active flag
UNITSEL
DT100
U2
H1001
S
n
8.4 MODBUS RTU Master Communication (SEND)
R100
Execute
SEND
U0
U1
S1
S2
H0
DT0
D1
D2
D3
External device
supporting Modbus-RTU
40001
100
40002
0
・・・・・・
・・・・・・・・
・・・・・・
・・・・・・・・
SEND execution conditions
Clear to send flag: ON
Sending active flag: OFF
Settings for communication port
S1: Slot 0 (U0)
S2: COM1 (U1)
SEND process
S: Data saving area (DT100)
n: No. of sent data (U2)
D1: MODBUS code (H10) and
partner device station no. (H01)
D2: "Transmit to" address (H0)
D3: Execution result code (DT0)
8-9

Advertisement

Table of Contents
loading

Table of Contents