3. Instruction Set Program example 8: COM1 (RS-232) / COM3 (RS-485), Function Code H06 1. Function code K6 (H06): Write in single Word device. 2. Set the value to be written into VFD-B in the register specified by operand S . 3. PLC COM1/COM3 will not process the received data. 4. Take the connection between PLC (PLC COM3) and VFD-B for example, the tables below explains the status when PLC COM3 writes in single Word device in VFD-B (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 receiving timeout as 100ms M1320 = ON ASCII mode M1320 = OFF RTU mode X0 Sending request X0 Data length Data register: D50=H1770 Data address: H2000 Function code: K6 Write in single Word data Connection device address: K1 M1318 Receiving completed Received data ASCII mode: No processing on received data . RTU mode: No processing on received data .
Reset M1318 3-381 D1076 Low byte 8C H CRC CHK Low D1077 Low byte 1E H CRC CHK High MOV H87 D1109 SET M1136 MOV K100 D1252 RST M1320 SET M1320 SET M1316 MODRW K1 K6 H2000 D50 K1 RST M1318