Omron C20K Video Game Controller User Manual


 
84
All of the following examples use OUT in diagrams that would generally be
used to control output bits in the IR area. There is no reason, however, why
these diagrams cannot be modified to control execution of other instructions.
The following example shows two timers, one set with a constant and one set
via input word 01. Here, 0200 will be turned ON 15 seconds after 0000 goes
ON and stays ON for at least 15 seconds. When 0000 goes OFF, the timer
will be reset and 0200 will be turned OFF. When 0001 goes ON, TIM 01 is
started from the SV provided through IR word 01. Bit 0201 is also turned ON
when 0001 goes ON. When the SV in 01 has expired, 0201 is turned OFF.
This bit will also be turned OFF when TIM 01 is reset, regardless of whether
or not SV has expired.
0000
TIM 00
0001
TIM 01
0200
0201
Address Instruction Operands
0000 LD 0000
0001 TIM 00
# 0150
0002 LD TIM 00
0003 OUT 0200
0004 LD 0001
0005 TIM 01
01
0006 AND NOT TIM 01
0007 OUT 0201
TIM 00
#0150
TIM 01
01
Timers operating longer than 999.9 seconds can be formed in two ways. One
is by programming consecutive timers, with the completion flag of each timer
used to activate the next timer. A simple example with two 900.0-second
(15-minute) timers combined to functionally form a 30-minute timer.
0000
TIM 01
TIM 02
0200
Address Instruction Operands
0000 LD 0000
0001 TIM 01
# 9000
0002 LD TIM 01
0003 TIM 02
# 9000
0004 LD TIM 02
0005 OUT 0200
TIM 01
#9000
TIM 02
#9000
900.0 s
900.0 s
In this example, 0200 will be turned ON 30 minutes after 0000 goes ON.
TIM can also be combined with CNT or CNT can be used to count SR area
clock pulse bits to produce longer timers. An example is provided in
5-11-4
COUNTER – CNT
.
TIM can be combined with KEEP(11) to delay turning a bit ON and OFF in
reference to a desired execution condition. KEEP(11) is described in
5-6-3
KEEP – KEEP(11)
.
To create delays, the completion flags for two timers are used to determine
the execution conditions for setting and resetting the bit designated for
KEEP(11). The bit whose manipulation is to be delayed is used in KEEP(11).
Turning ON and OFF the bit designated for KEEP(11) is thus delayed by the
SV for the two timers. The two SV could naturally be the same if desired.
Examples
Example 1:
Basic Application
Example 2:
Extended Timers
Example 3:
ON/OFF Delays
Timer and Counter Instructions Section 5-11