2-117
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Timer Instructions
2
TON
The following figure shows a programming example and timing chart when PT is T#10ms. Variable abc
will change to TRUE 10 ms after variable A changes to TRUE.
• Use the TP instruction (page 2-123) for a timer that changes the timer output to TRUE when timing
starts and then changes the timer output to FALSE when the set time is reached.
• Use the TOF instruction (page 2-120) for a timer that starts when In changes to FALSE and then
changes the timer output to FALSE when the elapsed time reaches the set time.
• To reduce timer execution time, use the Timer instruction (page 2-129), which times in increments of
100 ms.
• ET and Q are updated only when the instruction is executed. Therefore, Q does not change to TRUE
precisely when the elapsed time from when the timer starts reaches PT. Q changes to TRUE the next
time the instruction is executed after the elapsed time from when the timer starts reaches PT. The
change in Q can therefore occur with a delay of up to one task period.
• Set PT and ET in nanoseconds (ns), but remember the timing accuracy is 100 ns.
• The timer starts as soon as operation starts if In is already TRUE.
• If T#0ms or a negative number is set for PT, Q will change to TRUE as soon as the value of In
changes to TRUE.
• You can change the value of PT while the value of In is TRUE. Operation is as follows:
• If this instruction is in a master control region and the master control region is reset, the timer is reset.
The value of ET changes to 0 and the value of Q changes to FALSE.
Additional Information
Precautions for Correct Use
Timer status Value of Q
Value of PT after it is
changed
Operation
After comple-
tion of timing
TRUE --- The value of Q remains TRUE.
The value of ET also does not change. (It remains at
the value of PT before it was changed.)
Timing in
progress
FALSE PT ≥ ET Timing is continued. When the value of ET reaches
the value of PT, the value of Q changes to TRUE and
ET is no longer incremented.
PT < ET The value of Q changes to TRUE immediately. Incre-
menting ET stops immediately.
TON_instance(A, T#10ms, abc, def);
LD ST
abc
A
def
T#10ms
TON
In Q
PT ET
TON_instance
In=A
Q=abc
TRUE
FALSE
TRUE
FALSE
ET=def
PT=T#10ms