155
CNT can be used in sequence as many times as required to produce counters
capable of counting any desired values.
Address Instruction
00000 LD 000000
00001 AND 000001
00002 LD NOT 000002
00003 OR C0001
00004 OR C0002
00005 CNT 0001
#0100
00006 LD C0001
00007 LD NOT 000002
00008 CNT 0002
#0200
00009 LD C0002
00010 OUT 000203
CNT 0002 #0200
CP
R
0000
00
0000
01
CNT 0001 #0100
CP
R
0000
02
C0001
C0002
C0001
0000
02
C0002
0002
03
Operands
CNT can be used to create extended timers in two ways: by combining TIM with
CNT and by counting Auxiliary Area clock pulse bits.
In the following example, C0002 counts the number of times T0001 reaches
zero from its SV. The Completion Flag for T0001 is used to reset T0001 so that it
runs continuously and C0002 counts the number of times the Completion Flag
for T0001 goes ON (C0002 would be executed once each time between when
the Completion Flag for T0001 goes ON and T0001 is reset by its Completion
Flag). T0001 is also reset by the Completion Flag for C0002 so that the extended
timer would not start again until C0002 was reset by 000001, which serves as the
reset for the entire extended timer.
Because in this example the SV for T0001 is 5.0 seconds and the SV for C0002
is 100, the Completion Flag for C0002 turns ON when 5 seconds x 100 times,
i.e., 500 seconds (or 8 minutes and 20 seconds), have expired. This would result
in 000201 being turned ON.
00000 LD 010000
00001 LD 000001
00002 CNT 0002
#0100
00003 LD 000000
00004 AND NOT 010000
00005 AND NOT C0002
00006 TIM 0001
#0050
00007 LD T0001
00008 OUT 010000
00009 LD C0002
00010 OUT 000200
Address Instruction Operands
CNT 0002 #0100
CP
R
0000
00
TIM 0001 #0050
0100
C0002
0100
0000
01
T0001
0100
00
00
C0002
0002
00
00
In the following example, C0001 counts the number of times the 1-second clock
pulse bit (A50102) goes from OFF to ON. Here again, 000000 is used to control
CNT operation.
Example 3:
Extended Timers
Timer and Counter Instructions Section 5-13