Omron CJ - REFERENCE MANUAL 02-2010 Reference Manual page 245

Table of Contents

Advertisement

Example Timer and Counter Applications
Example 1: Long-term Timers
The following program examples show three ways to create long-term timers with standard TIM and
CNT instructions.
1) Two TIM Instructions
In this example, two TIM instructions are combined to make a 30-minute timer.
0.00
T0001
T0002
2) TIM and CNT Instructions
In this example, a TIM instruction and a CNT instruction are combined to make a 500-second timer.
TIM 0001 generates a pulse every 5 s and CNT 0002 counts these pulses. The set value for this
combination is the timer interval
With this combination, the long-term timer's PV is actually the PV of a counter, which is maintained
through power interruptions.
100.00
0.01
0.00
100.00
Start
Count up
3) Clock Pulse and CNT Instruction
In this example, a CNT instruction counts the pulses from the 1-s clock pulse to make a 700-second
timer.
If the First Cycle Flag (A200.11) is ORed with the counter's reset input (CIO 0.01), the counter's PV will
be reset to the SV (0700) when program execution begins rather than resuming the count from the
previous PV.
P_1s (1-s clock)
0.00
0.01
A20011
C0001
CS/CJ/NSJ Series Instructions Reference Manual (W474)
(900 seconds)
Instruction Operands
LD
TM
(900 seconds)
LD
TM
LD
2.00
OUT
counter SV. In this case, the timer SV would be 5 s
Instruction Operands
(100 times)
LD
LD
CNT
LD
(5 seconds)
AND NOT
AND NOT
TIM
100.00
LD
OUT
2.01
LD
OUT
Instruction Operands
LD
AND
LD NOT
CNT
3. Instructions
0.00
1
#9000
T0001
2
#9000
T0002
2.00
100 = 500 s.
100.00
0.01
2
#0100
0.00
100.00
C0002
1
#0050
T0001
100.00
C0002
2.01
0.00
1s
0.01
1
#0700
C0001
2.02
3
209

Advertisement

Table of Contents
loading

Table of Contents