Mitsubishi — Chapter 8 Application Instructions API 100-149

9 Application Instructions API 150-199 Program Example 13: 1. Sending the function code K23 (H17) through COM2 (RS-485): Read/Write many word devices M1002 Set communication protocol as 9600, 8, E, 1 Retain communication protocol Set communication timeout as 100ms M1143 = OFF ASCII mode M1143 = ON RTU mode The data is read from the address H1100. The data is written into the address H1000. The data is read into D3000. The data is written from D4000. The length of the data which is read is K2. The length of the data which is written is K2. X0 Sending request X0 D20: Length of the data read D21: Length of the data written D10:The index value indicates the register into which the data is read.

D11: The index value indicates the register from which the data is written. D0: Address from which the data is read D1: Address into which the data is written Function code: K23 The data is read from/written into multiple word devices. M1127 Connection device address: K1 Processing received data ASCII mode : The received ASCII data is stored in the registers starting from D3000. RTU mode : The received data is stored in the registers starting from D3000 in Hex value. Reset M1127 2. ASCII Mode: (M1143=OFF) When X0=ON, MODRW executes the function specified by the function code H17. PLC-A  PLC-B, PLC-A sends: “01 17 1100 0002 1000 0002 04 1770 0012 06” PLC-B  PLC-A, PLC-A receives:

“01 17 04 0100 1766 66” Registers in PLC-A for received data (responding messages) DVP-PLC Application Manual 9-28 MOV H87 D1120 SET M1120 MOV K100 D1129 RST M1143 SET M1143 MOV H1100 D0 MOV H1000 D1 MOV K3000 D10 MOV K4000 D11 MOV K2 D20 MOV K2 D21 SET M1122 MODRW K1 K23 D0 D10 D20 RST M1127 Register Data Description D3000 Low byte ‘0’ 30 H ADR 1 ADR 0 D3000 High byte ‘1’ 31 H D3001 Low byte ‘1’ 31 H CMD 1 CMD 0 D3001 High byte ‘7’ 37 H D3002 Low byte ‘0’ 30 H Number of data (bytes) D3002 High byte ‘4’ 34 H D3003 Low byte ‘0’ 30 H Contents of the address 1100H D3003 High byte ‘1’ 31 H D3004 Low byte ‘0’ 30 H D3004 High byte ‘0’ 30 H D3005 Low byte ‘1’ 31 H Contents of the address 1101H D3005 High byte ‘7’ 37 H D3006 Low byte ‘6’ 36H D3006 High byte ‘6’ 36H