Categories

## Productivity 2000 PLC Ladder Logic Counter

Most programmable logic controller (PLC) programs will include a counter instruction. The Productivity 2000 Series PLC has two different counter instructions for your program. These can be used in several different ways to adapt to your application. Basically, counters are used to count up or down to a specific limit. When the limit is reached, the output is turned on.
Counters can be made from a few different instructions from the PLC. The math instruction uses the one-shot (leading edge) input to add 1 to an internal register to keep track of the counter’s value. A comparison is used to compare this counter value to a set value (SV). The output is turned on if it is greater than or equal. Another input is used for the reset of the counter value. Copy is used to move the reset value into the counter value. This reset will usually override the counting application. Breaking down the counter’s essential operation will help us understand our application and how we can utilize counters in our automation programs.
The productivity suite software has Simple Counters (SCNT) and the Counters (CNT) instructions.
We will be reviewing these instructions and looking at how to implement them in our ladder logic program. Let’s get started.

Categories

## PLC Counter Programming – 3 Things to Know

PLC ladder logic counters are used in just about every PLC program. They will indicate how many times something has happened within the controller logic. Counters then can be used to trigger other outputs or items in the PLC. You can find counter applications in a variety of things every day.

We will discuss three things you need to know when programming counters in the PLC. A sample program with a counter will be shown. This will have a 3D simulation with the PLC. Let’s get started.

Categories

## The Secret of Using Counters – PLC Programming

We will now look at the secret of using counters in the PLC. Counters are used in the majority of PLC programs. This is especially true if part of your SCADA system. Counters like the animated picture above count things. In this situation, we are counting the number of turns the little guy makes. The counter is displaying the total number. This is considered a totalizing counter. If an output turned on to do something then it would be a preset (target number entered for the count) counter. There are also a wide variety of off-the-shelf industrial counters that you can use. The implementation of counters can be vast, however, it all starts with a TIMING CHART. This is the same as the timing charts we discussed in ‘The Secret of Timers’ post.

##### Timing Chart – Secret of Using Counters

A timing chart is a secret behind understanding the counter that you need in your application. Making a timing chart before writing the program will ensure that all of the information will be accounted for.

The timing chart is mapped out on an x and y plain. The ‘y’ plain has the state of the input on/off (1 or 0). The ‘x’ plain will show time.

The following shows a timing chart for a counter:
As you can see in this timing chart, you have an input, output, and display.

##### Inputs – Secret of Using Counters

Inputs are used usually sensors that are wired to the counter (PLC) to indicate the items that we need to count. They can be switches, photoelectric sensors, proximity sensors, encoders, etc. (Wiring of NPN / PNP devices) A counter will generally have only one input. In the case of an encoder input, it is still only one input, however, this is wired usually as A, B and Z phase. Z is always the reset. A and B indicate the pulses and are leading or trailing each other by 90 degrees depending on direction. Allot of counters will also allow you to add a direction input signal. However, this is all still only one input.

##### Outputs – Secret of Using Counters

Outputs from counters are generally discrete. This means that they are on or off, similar to the inputs. Outputs will trigger when the count value matches the set value. The duration that the output is on depends on the reset signal, to start the count again. (DC Solenoids protection) A lot of the counters today will allow you to have multiple outputs. These multifunction counters can have several preset outputs that trigger when the counter set value has been reached. Batch outputs are also available on some of the industrial counters. A batch output counts the number of times that the preset has been reached. This output will be turned on when the number entered for the batch has been reached.

##### Set Value – SV – Secret of Using Counters

This is usually on the display and shows the preset value. It is the target number of counts.

##### Present Value – PV – Secret of Using Counters

This is usually on the display and shows the current or accumulated value.

The PLC programming is usually not that much different than the industrial counter. A lot of the manufactures will have an up counter, down counter, and/or an up/down counter. Just as the name implies the display is either counting up or down. You have to refer to the instruction manual of the manufacturer you are programming for the way in which the counter will be programmed.

In the above example Do-More PLC program we have an up and a down counter. X0 is the input and X1 is the reset on both of these counters. (CT0, CT1)
The preset value is stored in memory location D0. This value is set to the number 3.
When the present value (accumulated) reaches the set value (preset) then the CT0. A done bit goes on and the output Y0 is active. Y0 will remain on until the reset input goes on.
The only difference for the down counter is the display. You will see that the present value will count down to zero (0) before the CT1. A done bit is turned on.
These counters are memory retentive. So in order to make the counter non-memory retentive, use the first scan bit of the PLC to trigger the reset of the counter. (ST0 – \$FirstScan)

Every PLC has counters. They all have different types depending on what you are trying to achieve. It will all start with your Timing Chart.

Watch on YouTube: Learn PLC Programming – Free 9 – The Secret of Counters

Learn PLC Programming - Free 9 - Th...
Learn PLC Programming - Free 9 - The Secret of Counters in the PLC

Thank you,
Garry

If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII, and Floating Point.

To get this free article, subscribe to my free email newsletter.

Use the information to inform other people how numbering systems work. Sign up now.