Programmable Logic
Controllers
Mr. Ali Al-Dabbagh
Programming Counter and Timer
1
Lecture (8)
Lecture Objectives
After completing this lecture, you will be able to:
• Apply combinations of counters and timers to control systems.
• Know the set and reset switches.
• Understanding the condition switches.
2
Example
3
classwork Activity
4
PLC can-counting program. Design ladder program, the operation of the
program can be summarized as follows:
• Counts the total number of cans coming off an assembly line for final
packaging.
• Each package must contain 10 parts.
• When 10 cans are detected, initiate the box closing sequence.
• Counts the total number of packages filled in a day. (The maximum
number of packages per day is 300.)
• A pushbutton is used to restart the total part and package count from
zero daily.
Counter Up-Down (CTUD)
5
One application for an up/down-counter is to keep count of the cars that
enter and leave a parking garage. Write PLC program that could be used
to implement this. The operation of the program can be summarized as
follows:
• As a car enters, the enter switch triggers the up-counter output
instruction and increments the accumulated count by 1.
• As a car leaves, the exit switch triggers the down-counter output
instruction and decrements the accumulated count by 1.
• Whenever the accumulated value of 150 equals the preset value of
150, the counter output is energized by the light up the Full sign.
• A reset button has been provided to reset the accumulated count.
Applications of TON and CTU
6
Many PLC applications use both the counter function and the timerfunction. Figure bellow illustrates an automatic stacking program thatrequires both a timer and counter.
In this process, conveyor M1 is usedto stack metal plates onto conveyorM2. The photoelectric sensorprovides an input pulse to the PLCcounter each time a metal platedrops from conveyor M1 to M2.When 15 plates have been stacked,conveyor M2 is activated for 5 s bythe PLC timer. The operation of theprogram can be summarized asfollows:
Applications of TON and CTU
7
• 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 5 s, it stops and the sequence
is repeated automatically.
Applications of TON and CTU
8
• Design ladder program to make attention with Red lamp after 10 days tochange the spare part of the motor in the factory
Condition Switches
9
Condition Switches
10
Condition Switches
11
12
13
Questions & Answers
14
15