Kaiyi — 6.19.2 Explanation of Communication Instructions

Chapter 6 Applied Instruction 6.19.2 Explanation of Communication Instructions Symbol: S : Initial transmission device Word m : Number of data which is sent Word D : Initial reception device Word n : Number of data which is received Word Explanation: 1. The instruction is for the CPU module equipped with RS-485 or RS-232. Data has to be stored in m data registers starting from the data register specified by S , and users need to set n data registers starting from the data register specified by D . If S and D are modified by the index registers, please do not alter the values in the index registers during the execution of the instruction. Otherwise, a read error or a write error will occur.

2. If there is no need for the data to be sent, m can be 0. If there is no need for the data to be received, n can be 0. 3. The instruction can be used several times in the program, but one instruction is executed at a time. 4. During the execution of the instruction RS, the alteration of the data which is sent is invalid. 5. If the peripheral device is equipped with RS-485 or RS-232, and the communication protocol used with the device is openly published, users can use the instruction RS to transmit the data between the PLC and the peripheral device. 6. If the communication protocol used with the device is consistent with Modbus, users can use the instruction MODRW. 7.

Please refer to the additional remark below for more information about SM96~SM105, which are related to RS485 or RS-232. 8. m : The size of the data which is sent (0~1000 bytes) 9. n : The size of the data which is received (0~1000 bytes) Example 1: 8-bit mode (SM106/SM107 is ON.)/16-bit mode (SM106/SM107 is OFF.): 1. 8-bit mode: The command which is edited is stored in the initial transmission device, and the command which will be sent include the head code and the tail code. The 16-bit data is divided into the high 8-bit data and the low 8-bit data. The high 8-bit data is ignored, and the low 8-bit data can be sent or received. (Take standard Modbus for example.) Sending the data:

(PLC→External equipment) 6-378 API Instruction code Operand Function 1800 RS S, m, D, n Transmitting the user-defined communication command Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S        m          D        n          Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH -