MODBUS
RTU
Master/Slave Communication
8-4
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.
External device
supporting Modbus-RTU
(Hex) 01 03 00 00 00 02 (CRC)
(Hex) 01 03 04 00 64 00 00 (CRC)
Command message
Response message
DT100
100
DT101
0
・・・・・・
・・・・・・・・
・・・・・・
・・・・・・・・
40001
100
40002
0
・・・・・・
・・・・・・・・
・・・・・・
・・・・・・・・
PLC
Specify and read station no. and address based on RECV instruction
Sample program
Send commands from the COM1 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.
R0
Master
communication
Clear to send flag
R100
UNITSEL
U0
U1
RECV.US
DT0
U2
DT100
H0301
H0
XC
YC
Master
communication
Sending active flag
R100
Execute
RECV
Settings for communication port
S1: Slot 0 (U0)
S2: COM1 (U1)
Starting conditions for RECV
execution
Clear to send flag: ON
Sending active flag: OFF
RECV processing
S1: MODBUS code (H03) and
partner device station no. (H01)
S2: Partner device address (H0)
(corresponds to H0: 40001)
n: No. of data (U2)
D1: Data saving area (DT100)
D2: Execution result code (DT0)
(
)
DF
S1
S2
S1
S2
n
D1
D2
(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.
(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: [email protected]
Содержание AFP7CPS4E
Страница 1: ...Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 10: ...Table of Contents viii Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 21: ...2 Names and Functions of Parts Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 24: ...Names and Functions of Parts 2 4 Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 25: ...3 Wiring the COM Port Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 45: ...3 I O Allocation Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 52: ...I O Allocation 4 8 Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 57: ...6 PLC Link Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 97: ...9 General Purpose Communication Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 114: ...General Purpose Communication 9 18 Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 115: ...4 Troubleshooting Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 124: ...Troubleshooting 10 10 Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...
Страница 125: ...11 Specifications Phone 800 894 0412 Fax 888 723 4773 Web www clrwtr com Email info clrwtr com ...