Lab 6
Lab 6
Lab No: 06
Semester VIII
Section A
Date 22 – 04 – 2023
Lab # 6 Counters
Objective:
Understanding the concept of counters.
Understanding the applications of countersin industrial automation.
Designing and implementing a control system that uses counter function to control a
process or machine.
Introduction:
Counters:
In automation, counters are a type of variable that is used to keep track of the number of
times a particular event has occurred. They are commonly used to count the number of
cycles, operations, or events that occur during a process.
Count Up (CU) Bit: The Count Up enable bit indicates the CTU instruction is enabled. The
data type used is Boolean indicated as BOOL.
Count Down (CD) Bit: The Count Down enable bit indicates the CTD instruction is enabled.
Done (DN) Bit: The done bit changes state whenever the accumulated value reaches the
preset value. The data type used is Boolean indicated as BOOL.
Overflow (OV) Bit: The overflow bit indicates the counter exceeded the upper limit of 2,
147, 483, 647. The counter then roles over to -2, 147, 483, 648 and begins counting up again.
The data type used is Boolean indicated as BOOL.
Underflow (UN) Bit: The underflow bit indicates that the counter exceeded the lower limit
of -2, 147, 483, 647. The counter then roles over to 2, 147, 483, 647 and begins counting
down again. The data type used is Boolean indicated as BOOL.
Preset (PRE) Bit: It specifies the value which the accumulated value must reach before the
instruction sets the done bit. The data type used is Double integer indicated as DINT.
Accumulator (ACC) Bit:It specifies the number of transitions the instruction has counted.
The timing diagram illustrates the functioning of all the bits in sequence.
Types of Counters:
Count Up
A count up counter is one that increments its count value by 1 each time it receives a clock
pulse. For example, if the initial count value is zero and the
counter receives a clock pulse, the count value will become 1.
With each subsequent clock pulse, the count value will
increase by 1, such as 2, 3, 4, and so on.
Count Down
A count down counter, on the other hand, decrements its count value by 1 each time it
receives a clock pulse. For example, if the initial count value is
10 and the counter receives a clock pulse, the count value will
become 9. With each subsequent clock pulse, the count value
will decrease by 1, such as 8, 7, 6, and so on.
When the rung condition changes from low to high, the accumulator value increases by 1.
When the accumulated value becomes equal to preset, the done bit of the counter turns on.
Applications of counters:
Tasks:
Exercise 1:
Let us consider a system in which we have a switch to turn on a light when the switch is
pressed 10 times the light should energize. We should also have a reset button.
Ladder Diagram
Light on
Counter Reset:
Exercise 2:
A motor will be controlled by two switches. The Go switch will start the motor and the Stop
switch will stop it. If the Stop switch was used to stop the motor, the Go switch must be
thrown twice to start the motor. When the motor is active a light should be turned on. The
Stop switch will be wired as normally closed (Active Low).
Ladder Diagram:
Motor on:
Ladder Diagram:
Light flashing:
A pressed 5 times:
Exercise 4:
System can be stop at any time by pressing stop and remain continue working from its previous state.
Fill each box with five balls and start conveyor 2 for 5 sec.
Ladder Diagram:
System Reset:
Conveyor on:
This lab covered the significance of counters in automation systems, which are used to keep
track of the number of events that occur. Count up and count down counters were explored,
and several exercises were completed to demonstrate their applications. The exercises
included controlling a light to turn on after a switch was pressed ten times, controlling a
motor with two switches and an indicator light, flashing a light for a specific duration when a
button was pushed, and controlling the filling of boxes on a conveyor belt. These exercises
showed how counters can be used in various automation systems to perform different tasks,
from tracking production quantities to controlling time-based processes. Overall, this lab
demonstrated the versatility and usefulness of counters in automation systems.