12. Communication Design Examples M1140 C0 counts once when data receiving error occurs. M1141 Reset the flag M1140 C0 counts once when parameter error occurs. Reset the flag M1141 Program Description: z Initialize PLC RS-485 communication port and set the communication format as MODBUS RTU, 19200, 8, N, 2. The RS-485 communication format of AC motor drive should be the same with PLC. z Reset D0 and D1 when PLC is powered up so as to ensure the drive is in the Stop status z When X0 is activated, the drive will run forward (D0 = H12) in 30Hz (D1 = 3000). z When X1 is activated, the drive will run in reverse (D0 = H22) in 20Hz (D1 = K2000) z When X2 is activated, the drive will stop.
(D0 = H1, D1 = 0) z There are only 4 situations for MODBUS communication: flag M1127 for normal communication and M1129, M1140, M1141 for communication errors. Counter C0 counts once when any of the 4 flags is ON. Therefore, the program assures the communication reliability by monitoring the On/Off status of the 4 flags and performs 2 MODBUS instructions in order by the value in counter C0. z The master frequency and output frequency stored in D1050 and D1051 will be sent to D2 and D3. z Once PLC starts running, the read/write actions for AC motor drive will be performed repeatedly according to [LD=] instructions. DVP-PLC Application Examples 12-13 CNT C0 K10 RST M1140 CNT C0 K10 RST M1141