8.3 MODBUS RTU Master Communication (RECV)
8.3 MODBUS RTU Master Communication (RECV)
8.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 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 COM.1 port of the CPU unit, read data from the data area of an
external device (station no. 1) 40001 - 40002, and write the content into PLC's data register
DT100 - DT101.
● 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 RECV instruction, specify and execute the partner device station no. (U1), MODBUS
command and partner device station no. to be used (H0301), initial address (40001), 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.
(Note 1)
Operand [S1] of RECV instruction is specified by combining two hexadecimal digits of MODBUS
function code with two hexadecimal digits of partner device station no.
(Note 2)
When the partner device is FP series PLC, operand [S2] of RECV instruction can be specified using
the device no.
8-4
Command messages
(Hex)01 03 03 E8 00 02 (CRC)
(Hex)01 03 04 00 64 00 00 (CRC)
Response messages
Perform reading by specifying Unit number and
address using the RECV instruction
External devices that
support MODBUS-RTU
1000
100
1001
0
・・・・・・
・・・・・・・・
・・・・・・
・・・・・・・・
WUME-FP7COM-07