Timers and Counters - Texas A&M University

Download Report

Transcript Timers and Counters - Texas A&M University

Timer Instructions
Overview
Instructions: Use the Page Up and
Page Down keys to navigate through
this presentation. When you are done
viewing the presentation, close this
window.
Timers: Applications
Delay motors from starting at the same time
when a switch is closed (TON Done bit)
Keep track of downtime – machine is up
most of the time and down sometimes (RTO
ACC bit)
Open a valve for a given time after a switch
is closed (e.g.,10 seconds)
Measure the cycle time of a process (RTO
ACC bit)
Fall 2014 - S. Hsieh2
Examples
Keep track of total time required to make a
batch of a product (RTO ACC bit)
Turn mixing motor off 2 minutes after the
switch is closed (TON – Timing bit)
Hold clamp on for 25 seconds after glue is
applied after a switch is closed then open
(TOF – Timing bit)
Open a valve 27 seconds after a switch is
turned close. If interrupted, the valve should
close and the time be reset to 0. (TON –
Timing bit)
Fall 2014 - S. Hsieh3
Categories of Timer Instructions
TON (Timer on delay)
Timer remains true for a preset time interval
TOF (Timer off delay)
Timer remains false for a preset time interval
RTO (Retentive timer on delay)
Timer remains on for a preset time interval
Parts of a Timer Instruction
Word 0: Control word
Enable bit(.EN) -- is set when the rung is
true
Timer Done Bit (.DN)-- changes state when
accumulated value reaches a preset value
Timer Timing bit (.TT)-- is set while the timer
is incrementing its accumulated value
Parts of a Timer Instruction
(cont.)
Word 1: Preset Value (.PRE)
the value the timer must reach before the controller
sets the DN bit. When ACC = PRE, the DN bit is set.
PRE can be used to control an output device.
Word 2: Accumulated Value (.ACC)
the time elapsed since the timer was last reset.
When ACC is enabled, the timer updates it
continually.
Parameters to Enter
Accumulated value (.ACC)
Preset value (.PRE)
Time base - the duration of each time
base unit
Duration of timer =
(preset value - accumulator value) * time base
TON Instruction
TON stands for...
TIMER DELAY ON
Time delay period is from the instant the
rung goes TRUE until the DN bit is turned
on
TON can be used to...
Create a short pulse at the beginning of a
longer input condition;
Delay the start of a function for a defined
period of time from the start of some
other function
TON Ladder Diagram
TON operation
When the rung goes TRUE, the EN and TT
bits go on.
When the accumulated value (ACC)
reaches the preset value (PRE),
TT bit goes off
EN bit stays on
DN bit turns on
TON operation
(cont.)
When the rung goes from TRUE to FALSE
and the accumulated value (ACC) is less
than the preset value (PRE)
EN and TT bits turn off
Accumulated value is reset to 000
Timer reset instructions can be used to
clear ACC
TON EN bit
Is set when rung conditions are TRUE
Remains set until rung conditions go
FALSE
TON TT bit
Is set when
rung conditions are TRUE
AND
ACC < PRE
Remains set until
rung conditions go FALSE
TON DN bit
Is set when ACC = PRE
Remains set until rung conditions go
FALSE
Worked Out Problems
Turn on L1 if sw1 is closed for 12
seconds.
When sw1 is closed, turn on motors 10,
11, and 12. Turn off motors 10, 11, and
12 at five-second intervals when sw1 is
opened.
TOF Instruction
TOF stands for...
TIMER DELAY OFF
Time delay period is from the instant the
rung goes TRUE to FALSE until the DN bit
is turned off
TOF can be used to...
Create longer output functions derived
from short input functions;
Generate a short pulse at the end of a
long input function
Sheng-Jen (“Tony”) Hsieh, Texas A&M
University
TOF Timer Instruction
 TOF instruction begins to count time base intervals
when the rung makes a true-to-false transition.
 As long as rung conditions remain false, the timer
increments its accumulated value (ACC) each scan
until it reaches the preset value (PRE).
 The controller resets the accumulated value when
rung conditions go true regardless of whether the
timer has timed out
Sheng-Jen (“Tony”) Hsieh, Texas A&M
University
Using the TOF Status Bits
Where, the bit is set means set to 1
TOF Ladder Diagram
TOF operation
When the rung goes TRUE, the EN and
DN bits go on.
When the accumulated value (ACC)
reaches the preset value (PRE),
DN bit goes off
AC is reset to 000
TOF operation
(cont.)
When the rung goes from TRUE to FALSE and
the accumulated value (ACC) is less than the
preset value (PRE)
DN bit stays on
Timer begins to accumulate time for the delay
period
TT bit goes on and stays on for preset time, then
resets
Timer reset instructions cannot be used to
clear ACC
TOF EN bit
Is set when rung conditions are TRUE
Remains set until rung conditions go
FALSE
TOF TT bit
Is set when
rung conditions are TRUE to FALSE
AND
AC < PR
Remains set until
rung conditions go TRUE again
TOF DN bit
Is set when rung conditions are TRUE
When rung conditions go from TRUE to
FALSE and ACC < PRE
Remains set until
ACC = PRE
RTO Instruction
RTO stands for...
RETENTIVE TIMER DELAY ON
Similar to TON
Time delay period is from the instant the
rung goes TRUE until the DN bit is turned
on (like TON)
RTO can be used for...
Maintenance functions;
Diagnostic programs
Sheng-Jen (“Tony”) Hsieh, Texas A&M
University
RTO Timer Instruction
Use the RTO instruction to turn an output on or
off after its timer has been on for a preset time
interval.
The RTO instruction is a retentive instruction
that lets the timer stop and start without
resetting the accumulated value (ACC).
Sheng-Jen (“Tony”) Hsieh, Texas A&M
University
Using the RTO Status Bits
 To reset the ACC value and status bits, you must
program a reset (RES) instruction with the same
address
Timer: RTO
RTO operation
(Like TON) When the rung goes TRUE,
the EN and TT bits go on.
(Like TON) When the accumulated value
(ACC) reaches the preset value (PRE),
TT bit goes off
EN bit stays on
DN bit turns on
RTO operation
(cont.)
When the rung goes from TRUE to FALSE
and the accumulated value (AC) is less
than the preset value (PR)
EN and TT bits turn off
Accumulated value is NOT reset
Timer reset instructions must be used to
clear AC
RTO EN bit
(like TON) Is set when rung conditions
are TRUE
(like TON) Remains set until rung
conditions go FALSE
RTO TT bit
(like TON) Is set when
rung conditions are TRUE
AND
AC < PR
(like TON) Remains set until
rung conditions go FALSE
OR
when the DN bit is set
RTO DN bit
(like TON) Is set when AC => PR
Remains set until the appropriate RES
instruction is enabled
Close this window and
then select items 4, 5, 6
TON, TOF, and RTO
Simulation.