PLC and Scada Projects

PLC Timers and Counters, their types and Practical Uses

Description:

 

 PLC Timers and Counters, their types and Practical Uses- In this article, I am only going to talk about the PLC Timers and counters, this article can be a bit longer as I will be sharing with you the ladder logic diagrams, which will explain the practical uses of PLC Timers and Counters. I am pretty sure you know the importance of Timers and Counters and that’s the reason you are reading this article.

PLC Timers and Counters are frequently used in industries for time delays and production monitoring. There are situations when you need to turn OFF a certain machine after some time, or you need to turn ON a machine after a certain delay when a sensor is activated or a button is pressed. You might have seen a lot of videos on YouTube in which the Bottles, Boxes, etc on a conveyor belt are counted. I hope this article will help you to learn the basics so that you can develop some advanced level monitoring and control systems using the PLC Timers and Counters.
Without any further delay let’s get started!!!


 Amazon Purchase Links:

Fatek PLC, FBs-14MAR2-AC (FBs-14MA):

Fatek PLC programming Cable:

IR adjustable infrared Proximity Sensor 2v to 24V: 

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

What is a Timer?

An automatic mechanism for activating or deactivating a device at a preset time. Let me explain this. A timer is the modified version of a Clock used for measuring specific time intervals.

Timers have mainly two types

  • A Timer which can count from Zero to a certain pre-defined value, which type of the Timer is also known as the Stopwatch.
  • Another type of device which counts down from a specified time interval is more usually called a Timer.

Timers can be classified into two main categories,

Hardware Timers:

            Mechanical timers

            Electromechanical timers

            Electronic timers

Software Timers

            Software applications

            Other types

All the above timers are used only for one purpose which is Time.



Timers in PLC “Fatek”:

PLC Timers and Counters

If you look at the Timer Function Block and Operand are given above. You can clearly see the Time control EN “enable” this an input signal from a button, or Sensor, it has two Operands Tn which is the Timer Number and the Operand PV which is the Preset value of the timer.

In Fatek PLC the total number of timers is 255 (T0 ~ T255) with three different time resolutions or bases, 0.01S, 0.1S, and 1S. These timers with different time resolutions can be used as per the requirement.

Timers and time bases:

T0 ~ T49: 0.01S timer (default as 0.00 ~ 327.67S)

T50 ~ T199: 0.1S timer (default as 0.0 ~ 3276.7S)

T200~T255: 1S timer (default as 0 ~ 32767S)

Timers Time can be calculated using the following formula.

Time = time base X Pre-set value.

Lets, for example, we want to make a 5 seconds delay using the T0 timer which has the time base .01s.

Time = .01 X 500

Time = 5S.

While using the T0 time we will need to select a pre-set value of 500.

Now let’s do the same using the Timer T50 which has the time base .1S

Timer Time = .1 X 50

Timer Time = 5S


PLC Timer Practical use Example1:

Ladder Logic program for a Conveyor belt.

Task:

Write a program that starts the Conveyor Belt after 5 Seconds when a button is pressed. Use a light/buzzer as the indicator. After the Conveyor Belt starts then turn OFF the light. Use timer T50. The button is connected with the X0 input of the PLC. The bulb is connected with the Y0 output and the Conveyor Belt Motor is connected with the output Y1.

Sounds complicated?

Well, at first it looks so complicated, but in PLC Ladder Logic programming this is very simple, I mean very simple. Let’s do.

Open the WinProLadder software.

Note: If you don’t know how to use the WinProLadder software then read my previous articles and then you can resume from here.After you open the WinProLadder Software.

PLC Timers and Counters

Enter Project information. Select a project name, select the Model, write any description if you want and then click on the ok button. Write the following Ladder Logic Program. I hope you know how to use different contacts if not then read my previous articles.


Let me tell you how to add a timer,

PLC Timers and Counters

Click the F key on the keyboard write T as the function name and press the OK button. The following function block will be opened.

PLC Timers and Counters

Simply enter the time number which you want to use let’s say T50 and a pre-set value of 50.

Time = .1 X 50 = 5 seconds delay. This is how you can add a timer. Now let’s continue with our example.

PLC Timers and Counters

This is a very simple yet very powerful program that is most frequently used in industries.

When the Button/Switch connected with the X0 input of the Fatek PLC is pressed the timer T50 is started and meanwhile the bulb indicator connected with the Y0 output is turned ON. When the timer T50 reaches the pre-set value the bulb indicator is turned OFF and the conveyor belt Motor is Turned ON. This Motor will remain ON until we turn OFF the button/switch connected with the input X0.

This program is really amazing, explains two activities, the bulb remains ON for 5 seconds and then Turns OFF and the Conveyor belts Start after a delay of 5 seconds. Now it totally depends on your logic how you use this small piece of code in advanced level projects.


Traffic Light Controller using PLC Timers:

PLC Timers and Counters

No matter we are learning Arduino or 8051 family microcontrollers, as a beginner, we always wish to make traffic control system. In this small project, I am going to write a very simple traffic light control system. I will turn ON each light for 5 seconds and then it repeats forever unless you turn OFF the switch. Let’s start with the Circuit diagram.

Three lights RED, YELLOW, and GREEN are connected with outputs Y0, Y1, and Y2. One switch is connected with X0 to activate and deactivate the traffic control system. Now let’s have a look at the ladder logic diagram of the PLC-based traffic control system.

PLC Timers and Counters

While the switch X0 is turned ON all the lights RED, YELLOW, and GREEN are turned on one by one. This cycle is repeated infinite times until and unless the switch is turned OFF.

I hope, now you have a basic understanding of how to use different timers.



What is a Counter?

In very simple words, a counter is a device which is used for counting anything, you can count pulses, you can count events, you can count physical objects, etc. Unlike the Timers, Counters are also most frequently used in industrial processes where you need to monitor the production.

Counters in PLC “FATEK”:

PLC Timers and Counters

In the above picture, you can clearly see the Function Block and the operands. The Clock CK and the Clear control CLR are the control signals and Cn is the Counter number while the PV is the Preset value. Each time a signal is detected at the clock input the counter is incremented. When a signal is detected at the Clear control input the counter value is reset back to zero. The CUP which is the counter up flag remains low until the counter values reach the Preset value and then the CUP flag gets high.

In Fatek PLC the total number of counters is (C0 ~ C255).

There are a total of 200 16-bit counters (C0 ~ C199). The range of the Preset value can be between 0 ~ 32767. C0 ~ C139 are Retentive Counters and the CV value will be retained when the PLC turns ON or RUN after a power failure or a PLC STOP. For Non-Retentive Counters, if a power failure or PLC STOP occurs, the CV value will be reset to 0 when the PLC turns ON or RUN again.

There are total of 56 32-Bit counters (C200~C255). The range of the Preset value is between 0~2147483647. C200~C239 are Retentive Counters and C240~C255 are Non-Retentive Counters.

To insure the proper counting, the sustain time of the input status of CLK should greater than 1 scan time.

The max counting frequency with this instruction can only up to 20Hz, for higher frequency please use the high-speed soft/hardware counter

When “CLR” is at 1, all of the contact Cn, FO0 (CUP), and CV value of the counter CV are cleared to 0 and the counter stops counting.

When “CLR” is at 0, the counter is allowed to count up. The Counter counts up every time the clock “CK” changes from 0 to 1 (adds 1 to the CV) until the cumulative current value is equal to or greater than the Preset value (CV>=PV), the counter “Count-Up” and the contact status of the counter Cn and FO0 (CUP) changes to 1. If the input status of the clock continues to change, even the cumulative current value is equal and greater than the Preset value; the CV value will still accumulate until it reaches the up limit at 32767 or 2147483647. The contact Cn and FO0 (CUP) stay at 1 as long as CV>=PV unless the “CLR” input is set to 1.


PLC Counter Practical use Example2:

 

 

PLC Timers and Counters

This is a very basic button clicks counting system. Each time the button1 is press it increments the value. When the value is reached the Preset value which is 4 the bulb will turn ON. As you can see in the picture below.

PLC Timers and Counters

To reset the value you can simply click on the clr button.

PLC Timer and Counter together Practical Example 3:

Now we are going to write a program which can count the seconds. We can use a one-second pulse M1922. The Preset value is 20. It means when the 20 seconds are completed the bulb connected with the output Y0 will be turned ON. You can reset the counter by pressing the clr button.

 

 

PLC Timers and Counters

So with this, my article on PLC timers and counters comes to an end. I will be uploading some advanced level projects using timers and counters. Make sure you subscribe to my website and follow my Facebook page.


Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button