91
0000
CP
R
CNT 04
#0150
0002
0001
0103
CNT 04
0410
Address Instruction Operands
000 LD 0000
001 AND 0001
002 LD 0002
003 OR 0410
004 CNT 04
# 0150
005 LD CNT 04
006 OUT 0103
Counters that can count past 9,999 can be programmed by using one CNT to
count the number of times another CNT has counted to zero from SV.
In the following example, 0000 is used to control when CNT 01 operates.
CNT 01, when 0000 is ON, counts down the number of OFF to ON changes
in 0001. CNT 01 is reset by its Completion Flag, i.e., it starts counting again
as soon as its PV reaches zero. CNT 02 counts the number of times the
Completion Flag for CNT 01 goes ON. Bit 0002 serves as a reset for the en-
tire extended counter, resetting both CNT 01 and CNT 02 when it is OFF.
The Completion Flag for CNT 02 is also used to reset CNT 01 to inhibit CNT
01 operation, once SV for CNT 02 has been reached, until the entire ex-
tended counter is reset via 0002.
Because in this example the SV for CNT 01 is 100 and the SV for CNT 02 is
200, the Completion Flag for CNT 02 turns ON when 100 x 200 or 20,000
OFF to ON changes have been counted in 0001. This would result in 0103
being turned ON.
0103
CP
R
CNT 01
#0100
CP
R
CNT 02
#0200
CNT 01
0002
CNT 02
0000 0001
0002
CNT 01
CNT 02
Address Instruction Operands
000 LD 0000
001 AND 0001
002 LD NOT 0002
003 OR CNT 01
004 OR CNT 02
005 CNT 01
# 0100
006 LD CNT 01
007 LD NOT 0002
008 CNT 02
# 0200
009 LD CNT 02
010 OUT 0103
CNT can be used in sequence as many times as required to produce count-
ers capable of counting any desired values.
CNT can be used to create extended timers in two ways: by combining TIM
with CNT and by counting dedicated clock pulse bits.
In the following example, CNT 02 counts the number of times TIM 01 reach-
es zero from its SV. The Completion Flag for TIM 01 is used to reset TIM 01
so that is runs continuously and CNT 02 counts the number of times the
Completion Flag for TIM 01 goes ON (CNT 02 would be executed once each
time between when the Completion Flag for TIM 01 goes ON and TIM 01 is
Example 3: Extended
Counter
Example 4:
Extended Timers
Instruction Set Section 3-7