Counter Data File - PLC 1 & PLC 2 Class Notes

advertisement
Counter
The
CTU CTD instruction counts
upward & Down wards over a range
Each time the rung goes from falseto-true.
We can make an Up-Down counter
by using a separate up and down
counter instructions using the same
address/structure
Counter Data File
•
•
•
•
•
•
•
•
CU – count up enable
CD – count down enable
DN – done bit
OV – overflow bit
UN – underflow bit
UA – update accumulated value (not used)
PRE – Preset value word
ACC – Accumulated value word
Word values
•
Accumulator Value – Number of false to
true transitions that have occurred since the
counter was last reset.
• Preset Value – Value which the counter
must count up to until the PLC sets the done
bit.
PLC5
Values between -32,768 and 32,767
CONTROLOGIX
Values between 2,147,483,647to -2,147,483,648
Address Structure
•The Counter uses the typical element
addressing scheme.
•Examples:
PLC 5
• C5:0.ACC
• C11:33/DN
• C5:2/OV
• C12:4/UN
Contrologix
•Counter.PRE
•Counter.ACC
•Counter.DN
Counter Uses
Count
the number of items being produced
or tested
Maintain
the level in a tank by counting the
number of gallons in and drained
Keeping
track of very long duration time
periods by combining a timer and counter
Counting
(pulses)
frequency, encoder, tachometer
Counter Examples
•
•
•
•
•
•
Straight counting in a process
Sum of two counts
Difference of two counts
Timed interval starts when count reaches
preset value
Count of events after fixed interval
Rate is determined by dividing count by
time interval
Timer
The TON instruction is a non-retentive timer
that accumulates time when the instruction is
enabled (rung-condition-in is true).
The TOF instruction is a non-retentive timer
that accumulates time when the when enable
goes false (rung-condition-in is false).
The RTO instruction is a retentive timer that
accumulates time when the instruction is
enabled.
Timer Data File Elements
EN – timer enabled
TT – timer timing
DN – done bit
PRE – Preset value word
ACC – Accumulated value word
Word values
Accumulator Value – Number of clock cycles
that have occurred since the timer was
enabled.
Preset Value – Value which the timer must
count up to until the PLC sets the done bit.
Values between 0 and 32,767
Time Base
The timers have a time base by which they
are clocked.
Valid Time Bases are:
1 second
0.1 seconds
Address Structure
The Timer uses the typical element
addressing scheme.
Examples:
T4:0.ACC
T11:33/DN
T4:2/TT
T12:4/EN
T15:56.1/0 = T15:56.PRE/0
T16:29.2/15 = T16:29.ACC/15
Timer On Delay (TON)
Enable – Set whenever the input rung is true
Timer Timing – Set when enable is true and
accumulated value is less than the preset
value.
Done – Set when the enable is true and the
accumulated value is greater than or equal to
the preset value.
Timer Off Delay (TOF)
Enable – Set whenever the input rung is true
Timer Timing – Set when enable goes false
and accumulated value is less than the preset
value.
Done – Set when the enable or timer timing
bit is true
Retentive Timer (RTO)
Enable – Set whenever the input rung is true
Timer Timing – Set when enable goes true
and accumulated value is less than the preset
value.
Done – Set when the enable is true and the
accumulated value is greater than or equal to
the preset value. Does not reset accumulated
value when enable is false.
Timer Uses
TON
Create a short pulse at the beginning of a
longer input condition (.TT bit)
Delay the start of a function for defined
period of time from the start of some other
function (.DN bit)
TOF
Used to create longer output functions
derived from short input functions using (.DN
bit)
Generate
a short pulse at he end of a long
input function by using (.TT bit)
Timer Uses
RTO
Used to accumulate time for maintenance
functions or for diagnostic programs
Other Uses
count time, Extend push button inputs, Delay
inputs, De-bounce Inputs
Timer Examples To Try
•Alternate on and off of two outputs:
Two alternately flashing lights. The time for
the two lights could be different.
•Multiple On Delay: Two different events
start at different time intervals after an initial
starting time reference point.
•Multiple Off Delay: Two different functions
remain on for two different time intervals
after a process is turned off.
Timer Examples To Try
•Interval time within a cycle: We may
require that an output come on 7.5 seconds
after system start up, remain on for 4.5
seconds, and then go off and stay off. The
interval would then be repeated only after the
system is shut off and then turned back on.
•On Delay:
Output B comes on at a specific
set time after output A is turned on. When A
is turned off, B goes off.
Timer Examples To Try
•Off Delay: Both A and B have been turned
on at the same time. Both are in operation.
When A is turned off, B remains on for a
specific set time period before going off.
•Limited On Time: A and B go on at the
same time. B goes off after specific set time
period, but A remains on.
•Repeat Cycling: An output pulses on and
quickly off at a constant preset time interval.
•One-Shot Operation: Output B goes on
for a specified time after output A is turned
on. Output B will run for its specified time
interval even if A is turned off during the B
timing interval.
Download