Mitsubishi — Chapter 8 Application Instructions API 100-149

9 Application Instructions API 150-199 Program example 4: COM1(RS-232) / COM3(RS-485), Function Code H03 (The function code H04 is the same as the function code H03.) 1. Function code K3 (H03): read multiple word devices, up to 16 words can be read. For COM2 ASCII mode, only 8 words can be read. 2. PLC COM1 / COM3 stores the received data in registers starting from S , and the stored data can be transformed and moved by using DTM instruction for applications of other purposes. 3. Take the connection between PLC and VFD-B for example, the tables below explains the status when PLC reads VFD-B status.

(M1320 = OFF, ASCII Mode ), (M1320 = ON, RTU Mode )  If PLC applies COM1 for communication, the below program can be usable by changing: 1. D1109 → D1036: communication protocol 2. M1136 → M1138: retain communication setting 3. D1252 → D1249: Set value for data receiving timeout 4. M1320 → M1139: ASCII/RTU mode selection 5. M1316 → M1312: sending request 6. M1318 → M1314: receiving completed flag M1002 Set communication protocol as 9600,8,E,1 Retain communication setting Set communication timeout as 100ms M1320 = OFF ASCII mode M1320 = ON RTU mode X0 Sending request X0 Data length(word) Data storing register Data address: H2100 Function code:

Read multiple words K3 Receiving completed Connection device address: K1 M1318 Processing received data ASCII mode: The received data is converted to Hex value and stored in registers starting from D0 RTU mode:

The received data is stored in registers starting from D0 Reset M1318 DVP-PLC Application Manual 9-11 Register DATA Explanation D9 Low 0B H Content of address 2103H PLC automatically convert ASCII codes to numerals and store the numeral in D1299 = H0BB8 D10 Low B8 H D11 Low 00 H Content of address 2104H PLC automatically convert ASCII codes to numerals and store the numeral in D1300 = H0000 D12 Low 00 H D13 Low 01 H Content of address 2105H PLC automatically convert ASCII codes to numerals and store the numeral in D1301 = H012D D14 Low 2D H D15 Low 8E H CRC CHK Low D16 Low C5 H CRC CHK High MOV H87 D1109 SET M1136 MOV K100 D1252 RST M1320 SET M1320 SET M1316 MODRW K1 K3 H2100 D0 K6 RST M1318