Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
34 views

Chapter 4.2 Programming Counters - A

Uploaded by

son06022003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Chapter 4.2 Programming Counters - A

Uploaded by

son06022003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 72

Chapter 4

PLC
Programming

Copyright (c) 2017 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education
Section 4.6

Counter Instructions
Section 4.6.1

Counter Instructions
Programmed
counters serve the
same function as
mechanical counters.

Every time the actuating lever is moved over, the


counter adds one number.

Resetting to zero is done with a pushbutton located


on the side of the unit.
Electronic counters
can count up, count
down, or be
combined to count
up and down.
Source: Photo courtesy Omron Industrial
Automation, www.ia.omron.com.

Although the majority of counters used in industry


are up-counters, numerous applications require the
implementation of down-counters or of
combination up/down-counters.
All PLC manufacturers offer some form of
counter instruction.

One common counter application is keeping track of


the number of items moving past a given point.
PLC counter instructions are similar to timers
except that they do not operate on an internal
clock but are dependent on external or
program sources for counting

Generic coil-
formatted
up-counter
instruction.
The counter reset instruction must be used in
conjunction with the counter instruction.

The counter reset


coil is given the
same address as
the counter that it is
to reset.

Up-counters are
always reset to zero.
Generic block-formatted counter.

All PLC counters operate, or count, on the leading


edge or off-to-on transition of the input condition.
PLC counters can be programmed to count up to
a preset value or to count down to a preset value.

The up-counter is incremented by


1 each time the rung containing
the counter is energized.

The down-counter decrements by


1 each time the rung containing
the counter is energized.
Section 4.6.2

Up-Counter
The up-counter is used to count false-to-true
transitions of an input instruction and then
trigger an event after a required number of
counts or transitions.

The up-counter output instruction will


increment its accumulated value by 1 each
time the counted event occurs.
SLC 500 Up-Counter program
SLC 500 Up-Counter timing diagram
Simulated Up-Counter program
The Allen-Bradley SLC 500 counter file is file 5.
Count-Up Count-Down Done (DN) bit - is
(CU) enable (CD) enable bit true (1) whenever
bit - is true - is true (1) the accumulated
(1) whenever whenever the value is equal to or
the count-up count-down greater than the
counter counter preset value of the
instruction is instruction is counter, for either
true. true. the count-up or the
count-down
counter.
Overflow (OV)
Underflow (UN) bit is - true
bit is - true (1)
when the counter counts
whenever
below -32,768. The counter
the counter
will wrap around to +32,767
counts past its
and continue counting down
maximum
toward 0.
value, +32,767.
On the next
count, the
counter will
wrap around
to -32,768 and
will continue
counting to 0.
Update The preset value The
Accumulator (PRE) word - accumulated
(UA) bit- is used specifies the value value (ACC)
in conjunction that the counter word - is the
with an external must count to current count
high-speed before it changes based on the
counter. the state of the number of
done bit. times the rung
goes from false
to true.
SLC 500 up-counter instruction.
Timer/counter menu from the RSLogix toolbar.

CTU (Count-Up) Increments the accumulated value at


each false-to-true transition and retains the accumulated
value when an off/on power cycle occurs.
CTD (Count-Down) Decrements the accumulated value
at each false-to-true transition and retains the
accumulated value when an on/off power cycle
occurs.
HSC (High-Speed Counter) Counts high-speed pulses
from a high-speed input.
PLC counter program used to stop a motor
from running after 10 operations.
Simulated counter program used to stop a motor
Can-counting program
Simulated can-counting
program.
ControlLogix 5000 Counter Instruction
A one-shot, or transitional, contact is often used
to automatically clear or reset a counter.

The one-shot can be


triggered from a
momentary signal
or from a signal that
comes on and stays
on for some time.

It stays on for one scan only and then goes off.

It stays off until the trigger goes off, and then


comes on again.
The off-to-on transitional
contact provides a one-
shot pulse when the
trigger signal makes a
off-to-on transition.

The on-to-off transitional


contact provides a one-
shot pulse when the
trigger signal makes a
on-to-off transition.
The Allen-Bradley SLC 500 one-shot rising
(OSR) instruction is an input instruction
that triggers an event to occur one time.
Up-counter with a programmed one-shot rising
(OSR) off-to-on transitional contact instruction.
Simulated up-counter with a programmed
one-shot rising (OSR) contact instruction.
OSR instruction used to freeze rapidly
displayed LED values.

Closing the momentary pushbutton PB (I:1/0) will


freeze and display the value at that point in time.
Simulation of OSR instruction used to
freeze rapidly displayed LED values.
Alarm monitor program.
Simulated alarm monitor program.
Section 4.6.3

Down-Counter
A down-counter will count down or decrement
by 1 each time the counted event occurs.

Generic up/down
counter program.

Normally the down-counter is used in conjunction with


the up-counter to form an up/down-counter.
Up/down counter program counting diagram.
Parking garage counter program.
Simulated parking garage counter program.
Count-down Counter Instruction

The information to be
entered into the
instruction is the
same as for the
count-up instruction.
Count-down Counter Instruction Program
Simulation of Count-down Counter
Instruction Program
Up/down-counter program.
Simulated up/down-counter program.
Continuous monitoring of items in process.

The accumulated count of


the counter continuously
indicates the number of
in-process parts.
Program that provides continuous
monitoring of items in process.
Simulated program that provides
continuous monitoring of items in process.
Section 4.6.4

Cascading Counters
Depending on the
application, it may be
necessary to count events
that exceed the
maximum number
allowable per counter
instruction. One way of
accomplishing this count
is by interconnecting, or
cascading, two counters. Source: Photo courtesy Omron Industrial
Automation, www.ia.omron.com.
Counting beyond the maximum count program.
Simulated counting beyond the maximum
count program.
Cascading counters for extremely large counts.
Simulated program for extremely large counts.
24-hour
clock
program.
Simulated 24-hour clock program.
Monitoring the
time of an event
program
Simulated
time of an
event
program.
Section 4.6.5

Incremental
Encoder-Counter
Applications
Incremental
encoders are used
to track motion.

They provide a specific


number of equally spaced
pulses per revolution or
per inch or millimeter of
linear motion. Source: Photo courtesy Avtron, www.avtron.com.
Incremental encoders
output pulses each time
and only when the shaft is
turned.

The encoder disk


interrupts the light as the
encoder shaft is rotated to
produce the square wave
output waveform.
Cutting objects to a specified length.

The object is advanced for a specified distance and


measured by encoder pulses to determine the correct
length for cutting.
Counter program used for length measurement.
Section 4.6.6

Combining
Counter and Timer
Functions
Automatic
stacking
program
Motor
lock-out
program

Source: This material and associated


copyrights are proprietary to, and used
with the permission of Schneider
Electric.
Product flow rate program.

Source: Photo courtesy Omron Industrial


Automation, www.ia.omron.com.
Timer driving a counter to produce an
extremely long time-delay period.
Section 4.6.7

High-Speed Counters
The maximum counting frequency of a
PLC is limited by the scan time of the
processor.

When the frequency of input signal is higher


than that of the scan time, it is necessary to
utilize a high-speed counter (HSC), to avoid
errors.

The HSC instruction may be imbedded in the


CPU, or fixed hardware, or a separate
module.
Allen-Bradley MicroLogix
controller high-speed up-
counter instruction.

➢ Has an imbedded high-speed counter.


➢ Perform counts of events between the scan of the
program. Then, when the program actually scans
through it can see the count value that the counter
has reached.
➢ Typical controller has one 20 KHz high-speed
counter, which is able to count 20,000 pulses per
second.

You might also like