212
Timer and Counter Instructions Section 5-15
Flags 25407: Step Start Flag; turns ON for one cycle when STEP(08) is executed
and can be used to reset counters in steps as shown below if neces-
sary.
5-15 Timer and Counter Instructions
TIM and TIMH(15) are decrementing ON-delay timer instructions which
require a TC number and a set value (SV). STIM(69) is used to control the
interval timers, which are used to activate interrupt routines.
CNT is a decrementing counter instruction and CNTR(12) is a reversible
counter instruction. Both require a TC number and a SV. Both are also con-
nected to multiple instruction lines which serve as an input signal(s) and a
reset. CTBL(63), INT(89), and PRV(62) are used to manage the high-speed
counter. INT(89) is also used to stop pulse output.
Any one TC number cannot be defined twice, i.e., once it has been used as
the definer in any of the timer or counter instructions, it cannot be used again.
Once defined, TC numbers can be used as many times as required as oper-
ands in instructions other than timer and counter instructions.
TC numbers run from 000 through 511 in the CQM1 PCs and from 000
through 127 in the CPM1/CPM1A/SRM1 PCs. No prefix is required when
using a TC number as a definer in a timer or counter instruction. Once defined
as a timer, a TC number can be prefixed with TIM for use as an operand in
certain instructions. The TIM prefix is used regardless of the timer instruction
that was used to define the timer. Once defined as a counter, a TC number
can be prefixed with CNT for use as an operand in certain instructions. The
CNT is also used regardless of the counter instruction that was used to define
the counter.
TC numbers can be designated as operands that require either bit or word
data. When designated as an operand that requires bit data, the TC number
accesses a bit that functions as a `Completion Flag’ that indicates when the
time/count has expired, i.e., the bit, which is normally OFF, will turn ON when
the designated SV has expired. When designated as an operand that requires
word data, the TC number accesses a memory location that holds the present
value (PV) of the timer or counter. The PV of a timer or counter can thus be
used as an operand in CMP(20), or any other instruction for which the TC
area is allowed. This is done by designating the TC number used to define
that timer or counter to access the memory location that holds the PV.
SNXT(09) 01000
CP
R
CNT 01
#0003
00000
00100
25407
STEP(08) 01000
1 cycle
25407
01000
Start
Address Instruction Operands Address Instruction Operands
00000 LD 00000
00001 SNXT(09) 01000
00002 STEP(08) 01000
00003 LD 00100
00004 LD 25407
00005 CNT 01
# 0003