Mitsubishi — Chapter 7 Application Instructions API 50-88

7 Application Instructions API 50-99 13. For the special auxiliary relays M1120 ~ M1161 and special data registers D1120 ~ D1131 relevant to RS-485 communication, see remarks for more details. Program Example 1: 1. Use COM2 on the PLC to carry out RS-485 communication. 2. Write the data to be transmitted in advance into registers starting from D100 and set M1122 (sending request flag) as On. 3. When X10 = On, RS instruction will be executed and PLC will start to wait for the sending and receiving of data. D100 starts to continuousl send out 10 data and when the sending is over, M1122 will be automatically reset to Off (DO NOT use the program to execute RST M1122).

After 1ms of waiting, PLC will start to receive the 10 data. Store the data in consecutive registers starting from D120. 4. When the receiving of data is completed, M1123 will automatically be On. After the program finishes processing the received data, M1123 has to be reset to Off and the PLC will start to wait for the sending and receiving of data again. DO NOT use the program to continuously execute RST M1123. M1002 Set up communication protocol 9600,7,E,1 Retain communication protocol Sending request pulses Set up communication time-out 100ms Write in the data to be transmitted in advance Set up sending request X10 Receiving completed Process of received data M1123 The flag is reset.

Receiving of data is completed the flag is reset. Program Example 2: Use COM2 on the PLC to carry out RS-485 communication. Switching between 8-bit mode (M1161 = On) and 16-bit mode (M1161 = Off) 1. 8-bit mode: The head code and tail code of the data are set up by M1126 and M1130 together with D1124 ~ D1126. When PLC is executing RS instruction, the head code and tail code set up by the user will be sent out automatically. M1161 = On indicates PLC in 8-bit conversion mode. The 16-bit data will be divided into the higher 8 bits and lower 8 bits. The higher 8 bits are ignored and only the lower 8 bits are valid for data transmission.

DVP-PLC APPLICATION MANUAL 7-98 MOV H86 D1120 SET M1120 MOV K100 D1129 SET M1122 RS D100 K10 D120 K10 RST M1123 M1 X RS D100 K4 D120 K7