Mitsubishi — 3.8 Counters

Chapter 3 Devices Example: LD X0.0 RST C0 X0.0 LD X0.1 X0.1 CNT C0 K5 LD C0 C0 Y0.0 OUT Y0.0 1. If X0.0 is ON, the instruction RST will be executed, the present value of C0 will become zero, and the output contact will be reset to OFF. 2. If X0.1 is turned from OFF to ON, the present value of the counter will increase by one. 3. If the present value of C0 matches the setting value K5, the contact C0 will be ON (Present value of C0=Setting value=K5). K5 will be retained even if X0.1 is turned from OFF to ON again. X0.1 0 1 2 3 4 5 Present value of C0 Setting value 0 Y0.0, C0 contact 32-bit up/down counter: 1.

The setting value of a 32-bit general up/down counter must be in the range of K-2,147,483,648 to K2,147,483,647. The states of the special auxiliary relays SM240~SM255 determine whether the 32-bit general up/down counters C240~C255 count up or count down. For example, C240 will count up if SM240 is OFF, and C240 will count down if SM240 is ON. 2. The setting value of a 32-bit up/down counter can be a constant preceded by K, or the value stored in two consecutive data registers. A setting value can be a positive value, or a negative value. 3. If a power cut occurs when a general counter counts, the present value of the counter will be cleared.

If a power cut occurs when a latching counter counts, the counter value and the state of the contact which are before the power cut will be retained, and the latching counter will not continue to count until power is restored. 4. If a counter counts up from the present value 2,147,483,647, the next value following 2,147,483,647 will be -2,147,483,648. If a counter counts down from the present value -2,147,483,648, the next value following -2,147,483,648 will be 2,147,483,647. 3-9 RST C0 CNT C0 K5 0.0