MODBUS RTUMaster/Slave Communication8-48.3 MODBUS RTU Master Communication (RECV)8.3.1 Read Data from an External Device InstructionsIn master communication, PLC has the sending right, and executes communication bysending commands to devices that support MODBUS-RTU, and receiving responses.Messages in accordance with the protocol are automatically generated by PLC. In the userprogram, reading and writing can be done simply by specifying the station no. and memoryaddress and executing SEND/RECV instructions.External devicesupporting Modbus-RTU(Hex) 01 03 00 00 00 02 (CRC)(Hex) 01 03 04 00 64 00 00 (CRC)Command messageResponse messageDT100 100DT101 0・・・・・・ ・・・・・・・・・・・・・・ ・・・・・・・・40001 10040002 0・・・・・・ ・・・・・・・・・・・・・・ ・・・・・・・・PLCSpecify 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 externaldevice (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 inprogress 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), MODBUScommand and partner device station no. to be used (H0301), initial address (40001), No. ofdata (U2), and initial address on the PLC side to save data (DT100). For the address of thepartner device, please check operating instructions, etc. of the relevant device.R0MastercommunicationClear to send flagR100UNITSEL U0 U1RECV.US DT0U2 DT100H0301 H0XC YCMastercommunicationSending active flagR100ExecuteRECVSettings for communication portS1: Slot 0 (U0)S2: COM1 (U1)Starting conditions for RECVexecutionClear to send flag: ONSending active flag: OFFRECV processingS1: MODBUS code (H03) andpartner 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)( )DFS1 S2S1 S2 n D1 D2(Note 1) Operand [S1] of RECV instruction is specified by combining two hexadecimal digits of MODBUS functioncode 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 theDevice No.(Note 3) The unit number and COM port number in the above program is applied when the COM.1 port of the CPUunit is used.Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com