Lecture 5’s sequence
5.1 Counter Instructions
5.2 Up-Counter
5.3 Down-Counter
5.4 Incremental Encoder-Counter Applications
5.5 Examples
5.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.
5.1. Counter Instructions
Electronic counters can count-up,
count down, or be combined to
count-up and down.
Although most counters used in industry
are up-counters, numerous applications
require the implementation of down-
counters or of combination up/down-
counters.
5.1. Counter Instructions
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.
5.1. Counter Instructions
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 down-counter is decremented the counter is energized.
by 1 each time the rung containing
the counter is energized.
Lecture 5’s sequence
5.1 Counter Instructions
5.2 Up-Counter
5.3 Down-Counter
5.4 Incremental Encoder-Counter Applications
5.5 Examples
5.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.
5.2. Up Counter
Up-Counter timing diagram
Lecture 5’s sequence
5.1 Counter Instructions
5.2 Up-Counter
5.3 Down-Counter
5.4 Incremental Encoder-Counter Applications
5.5 Examples
5.3. Down Counter
A down-counter will count down or decrement by 1 each time the counted
event occurs.
Down-counter timing diagram
5.3. Down Counter
Normally the down-counter is used in conjunction with the up-counter to
form an up/down counter.
Up-down counter timing diagram
Lecture 5’s sequence
5.1 Counter Instructions
5.2 Up-Counter
5.3 Down-Counter
5.4 Incremental Encoder-Counter Applications
5.5 Examples
5.5. Incremental Encoder-Counter Applications
The incremental optical
encoder creates a series of
square waves as its shaft is
rotated.
The encoder disk interrupts
the light as the encoder
shaft is rotated to produce
the square wave output
waveform.
5.5. Incremental Encoder-Counter Applications
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.
Lecture 5’s sequence
5.1 Counter Instructions
5.2 Up-Counter
5.3 Down-Counter
5.4 Incremental Encoder-Counter Applications
5.5 Examples
5.6. Examples
Example 1: Develop PLC Programming Batch Process ladder logic program
according to the logic given below:
Ingredient A is sent to the tank first by energizing
solenoid 1. The flow meter gives one pulse for every
gallon of flow. Solenoid Valve will be open until 200
gal has poured in.
After ingredient A is in the tank, 200 gal of ingredient
B should be added. The process of adding follows the
same procedure as ingredient A.
Once step 2 is done, the mixer motor starts and runs
for 10s.
After mixing is complete, solenoid 3 should open, let
the mixed batch goes to the finished tank.
When the tank is empty, the low-level sensor turns
ON to open solenoid 3 to close and restarts the
process again.
5.6. Examples
Example 2: Parts are moving on the conveyor from one process line to other with a constant
speed. Out of 1000 parts, one part is taken out for quality check. Implement automation of this
process in PLC using Ladder Diagram programming language:
To detect the parts, detector such as
proximity switch, optical sensors is used.
Give this detection, as an input to Up
Counter which is incremented with each
part’s detection.
Set counter preset value to 1000.
Operate Solenoid for a few seconds until the
part is diverted for quality check.
5.6. Examples
Example 3: Objects are moving on a conveyor 1. When an empty box is detected, conveyor starts
and 5pcs are packed in a box. When box is filled, it is carried to the storage area via conveyor 2.
Implement automation of this process in PLC using Ladder Diagram programming language:
Use proximity switches to detect moving objects on the conveyor 1 and to detect an empty box on conveyor 2.
Use counter to count number of objects to be packed.
Use timer such that when 5pcs are detected,
conveyor runs for a while and stops when 5th
object is finally collected in the box.
When number of parts to be packed are detected
timer is activated. When timer is over, it stops the
conveyor until next empty box is detected.
Assuming time taken by the last 5th object is
2secs to be collected.
5.6. Examples
Example 4: In this process, conveyor M1 is used to stack metal plates onto conveyor M2. The
photoelectric sensor provides an input pulse to the PLC counter each time a metal plate drops
from conveyor M1 to M2. When 15 plates have been stacked, conveyor M2 is activated for 5s by
the PLC timer. The operation of the program can be summarized as follows:
When the Start button is pressed, Conveyor
M1 begins running.
After 15 plates have been stacked, conveyor
M1 stops and Conveyor M2 begins running.
After conveyor M2 has been operated for
5s, it stops, and the sequence is repeated
automatically.
5.6. Examples
Example 5: This program is designed to indicate how many parts pass a given process point
per minute. The operation of the program can be summarized as follows:
When the start switch is closed, both the timer and counter are
enabled.
The counter is pulsed for each part that passes the parts sensor.
The counting begins and the timer starts timing through its 1-
minute time interval.
At the end of 1-minute, the timer done bit causes the counter
rung to go false.
Sensor pulses continue but do not affect the PLC counter.
The number of parts for the past minute is represented by the
accumulated value of the counter.
The sequence is reset by opening and closing the start switch.
5.6. Examples
Example 6: Different objects are moving on a conveyor belt. Let’s say, circular
balls, square blocks and rectangular blocks. All three types of objects are collected
in the same sized box. As these types are different in size and shapes as well,
number of objects to be placed are different for each type. Set counter value
according to different sized objects’ detection. Implement automation of this in
PLC using Ladder Diagram programming language.
5.6. Examples
Example 7: Drilling of Parts
Set lower and upper limit of a motor
to stop and start the drilling process.
This is done for precise drilling and to
obtain uniformity.
Pressure operated clamping device is
used to hold the objects firmly. This is
operated by 20psig air supply which is
provided when an object is detected.
Limit detection object is placed on the
motor to detect upper and lower limit
by the switches.
5.6. Examples
Example 8:
5.6. Examples
Example 8: PLC Car Parking
Here we consider two lights indication for cars control. Red lights prohibit cars
entering or leaving while green lights allow cars entering and leaving.
Initially we will keep green lights ON and red light OFF
When car enters at the passage from the entry of the ground floor, both red
lights (ground floor and basement) will be ON.
Other car entering and leaving is prohibited during the process till the car
passes through the single passage.
When passage is clear both green lights (ground floor and basement) will be
ON and allow other cars entering from the ground floor or basement.
5.6. Examples
Example 9: This program is designed to prevent a machine operator from starting a motor due
to overload condition that has tripped off more than 5 times in an hour. The operation of the
program can be summarized as follows:
The normally open overload (OL) relay contact momentarily
closes each time an overload current is sensed.
Every time the motor stops due to an overload condition, the
motor start circuit is locked out for 5 min.
If the motor trips off more than 5 times in an hour, the motor
start circuit is permanently locked out and cannot be started
until the reset button is actuated.
The lock-out pilot light is switched on whenever a permanent
lock-out condition exists.
Stop button is used to stop operation of the system any time.