Omron C28K Video Game Controller User Manual


 
82
5-11 Timer and Counter Instructions
TIM and TIMH are decrementing ON-delay timer instructions which require a
TC number and a set value (SV).
CNT is a decrementing counter instruction and CNTR is a reversible counter
instruction. Both require a TC number and a SV. Both are also connected to
multiple instruction lines which serve as an input signal(s) and a reset.
HDM(61) is used to create a 2-kHz high-speed drum counter; RDM(60) is
used to create a reversible drum counter. RDM(60) cannot be used to create
a high-speed counter. If you require a high-speed counter, use HDM(61).
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 00 through 47. No prefix is required when using a TC
number as a definer in a timer or counter instruction. Once defined as a tim-
er, 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 for operands that require bit data or for oper-
ands that require 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 lo-
cation 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 by designating the TC number
used to define that timer or counter to access the memory location that holds
the PV.
Note that “TIM 00” is used to designate the Timer instruction defined with TC
number 00, to designate the completion flag for this timer, and to designate
the PV of this timer. The meaning of the term in context should be clear, i.e.,
the first is always an instruction, the second is always a bit operand, and the
third is always a word operand. The same is true of all other TC numbers
prefixed with TIM or CNT. In explanations of ladder diagrams, the completion
flag and PV accessed through a TC number are generally called the comple-
tion flag or the PV of the instruction (e.g., the completion flag of TIM 00 is the
completion flag of TC number 00, which has been defined using TIM).
An SV can be input as a constant or as a word address in a data area. If an
IR area word assigned to an Input Unit is designated as the word address,
the Input Unit can be wired so that the SV can be set externally through
thumbwheel switches or similar devices. Timers and counter wired in this
way can be set externally only during RUN or MONITOR mode. All SVs, in-
cluding those set externally, must be in BCD.
Timer and Counter Instructions Section 5-11