PLC Timer Programming for Beginners
In this article, we will be talking about the PLC timer. We will explain what PLC timers are, how they work, the different types of timers, and give some examples of how they are used.
PLC timers are internal PLC instructions that can be used to delay input and output signals in the PLC program.
These timers operate like relay timers but you cannot hold a PLC timer in your hand and they do not need to be connected to wires to operate.
Types of PLC timers
There are three main types of PLC timers:
– The on-delay timer,
– The off-delay timer,
– The retentive on-delay timer.
PLC timer values
All of these PLC timers have a timer file name, a preset value, an accumulated value, a timer enabled bit, a timer timing bit, and a timer done bit.
Timer file name
The timer file name is a PLC tag. This tag is where you can find the timer’s preset and accumulated values and the timer enabled, timing, and done bits.
Some PLCs create the timer file name for you and other PLCs have you create the timer file name.
For all of my timer examples, I will use the timer file name Timer1. I will also use a selector switch to enable and disable the timers.
Timer preset value
The timer preset value is the number that shows the delay length of the timer.
This number can be changed by just typing it in or you can have the PLC write a number into this value. This number does not change during the timer’s normal operation.
Timer accumulated value
The timer accumulated value is the number that shows how long the timer has been timing.
The timer accumulated value does not function the same on all of these timers. I will explain how this value accumulates time as I explain how each timer works.
Timer enabled bit
The timer enabled bit will be on when the timer is enabled.
Timer timing bit
The timer timing bit will be on when the timer is timing.
Timer done bit
The timer done bit does not function the same on all of these timers. I will explain how the timer done bits works as I explain how each timer works.
PLC timer examples
For my PLC timer examples, I will be using Studio 5000, which is the PLC programming software for Allen-Bradley ControlLogix PLCs.
But the things you will learn here in these examples can be applied to any other PLC software. Because the overall timer functions are pretty much the same for any other PLC brand.
On-delay timer
For the first example, I will talk about the on-delay timer.
Let’s start by placing a new on-delay timer instruction on a PLC rung with a selector switch input.
Type the timer file name Timer1.
Next, enter the timer preset so that it equals ten seconds. Notice that I typed ten thousand, I did this because the time base of the timer I used is in milliseconds and ten thousand milliseconds equals ten seconds.
Not all PLC timers use the same time base, some have time bases that cannot be changed while others will give you multiple time base options.
This PLC on-delay timer is now set up and ready to use.
How does an on-delay timer work?
Next, I will discuss what happens to the PLC on-delay timer when the selector switch gets turned on and off.
– When you turn on the selector switch, the timer enabled bit and timer timing bit turn on and the timer’s accumulated value starts accumulating time.
– If you leave the selector switch on, the timer’s accumulated value will reach ten thousand. When it does, the timer will stop accumulating time, the timer timing bit will turn off, and the timer done bit will turn on.
– At this point, when you turn off the selector switch the timer accumulated value will reset back to zero, and the timer enabled and timer done bits will turn off.
– If you turn off the selector switch before the timer is done timing, the timer accumulated value will reset back to zero and all of the timer bits will be off.
On-delay timer applications
On-delay timers are used a lot in PLC programs and in many different ways. For example, an on-delay timer can be used on a conveyor’s start button.
The timer could be set up so that the start button would need to be pushed and held for five seconds before the conveyor would start.
Another on-delay timer could also be set up to sound a conveyor start-up warning horn and light.
Off-delay timer
Now let’s talk about off-delay timers.
Setting up an off-delay timer is the same as an on-delay timer, place the timer off-delay instruction on a PLC rung with a selector switch input and type ten thousand in the timer’s preset.
How does an off-delay timer work?
Next, I will discuss what happens to the PLC off-delay timer when the selector switch gets turned on and off.
– When you turn on the selector switch, the timer’s accumulated value resets to zero, and the timer enabled bit and the timer “done bit” turn on.
– When you turn off the selector switch, the timer accumulated value will start accumulating time, the timer enabled bit will turn off, the timer timing bit will turn on and the timer done bit will stay on.
– If you leave the selector switch off, the timer’s accumulated value will reach ten thousand. When it does, the timer will stop accumulating time, the timer timing bit and the timer done bit will turn off.
– If you turn on the selector switch before the timer is done timing, the timer accumulated value will reset back to zero, the timer enabled bit will turn on, the timer timing bit will turn off and the timer done bit will stay on.
Off-delay timer applications
Off-delay timers are used when you need something to stay running longer than everything else. For example, cooling fans and pumps might continue to run after a machine pauses from doing work.
Retentive on-delay timer
Retentive on-delay timers are a lot like on-delay timers. They get set up the same way and the bits react in the same way.
The only major difference with retentive on-delay timers is how the timer accumulated value acts when you turn the selector switch on and off and that it needs a reset bit.
How does an retentive on-delay work?
– For an retentive on-delay, when the selector switch is turned on, the retentive on-delay timer accumulated value starts accumulating time, the timer enabled bit turns on, and the timer timing bit turns on.
– If the selector switch is left on, the accumulated value will reach ten thousand, the timer will stop accumulating time, the timer enabled bit will stay on, the timer timing bit will turn off, and the timer done bit will turn on.
– At this point, if the selector switch is turned off, the accumulated value will stay ten thousand, the timer enabled bit will turn off, the timer timing bit will stay off, and the timer done bit will stay on.
– If the selector switch is turned back on, only the timer “enabled bit” will turn on, everything else will stay the same.
To reset the accumulated value of a retentive on-delay timer, a timer reset bit will need to be added to the PLC program. I will use a momentary push button to trigger this reset bit.
– When the selector switch is off and the timer reset button is pushed, the timer accumulated value will reset to zero and the timer done bit will turn off.
Retentive on-delay Applications
Retentive on-delay timers can be used to track the runtime of equipment. They can be set up to trigger an indicator light to let someone know the equipment has run long enough and requires maintenance to inspect and clean it.
Summary
In review, by reading this article you have learned about:
– The three main types of PLC timers:
- On-delay,
- Off-delay,
- Retentive on-delay.
– You also learned that these timers have:
- A preset value,
- An accumulated value,
- An enabled bit,
- A timing bit,
- A done bit.
– You have also learned some examples of where these timers are used.
Please let us know if you have any questions about the three main types of PLC timers in the comments below and we will get back to you in less than 24 hours.
Got a friend, client, or colleague who could use some of this information? Please share this article.
Join the Top 1% of Automation Engineers
Start Your 7-day Free TrialLearn from Industry Experts
With a 7-day trial, then €25/month