Productivity 1000 PLC Counter Instructions

A majority of programmable logic controller (PLC) programs will include a counter instruction. The Productivity 1000 Series PLC has a couple of different counter instructions for your program. Under the data handling instructions, we have the increment/decrement instruction (INC). We could use this with the compare contact (CMP) instruction that we discussed in our Contact and Coil Instructions (Video) to create a counter application.
Productivity 1000 Series PLC Counter Instructions
The productivity suite software has a Simple Counter (SCNT) and the Counter (CNT) instructions. We will be reviewing these instructions and looking at how to implement them in our ladder logic program. Let’s get started.

Previously in this Productivity 1000 series PLC, we have discussed:
System HardwareVideo
Installing the SoftwareVideo
Establishing CommunicationVideo
First ProgramVideo
Documenting the ProgramVideo
Monitoring and Testing the ProgramVideo
Online Editing and Debug ModeVideo
Numbering Systems and Tag DatabaseVideo
Contact and Coil InstructionsVideo
Timer InstructionsVideo

Timing Diagrams – Productivity Counter

When dealing with counters, we need to look at the timing charts. The Secret of Using Counters is a good refresher on using timing charts. As a system integrator, this ability can prove very useful to you in the field when commissioning your automation system.
Here is the URL of the video for the same post: https://youtu.be/pyNNKRA_xK8

Simple Counter (SCNT)

Productivity 1000 Series PLC Counter Instructions
We will first use simple counter instruction. The addresses can be entered individually or through the Structure. Using the structure, the preset value, current value, and done bit are automatically assigned to the structure name.
Productivity 1000 Series PLC Counter Instructions
We have the One-Shot selected. This means that the counter will count 1 for every transition from off to on of the input. The following post will explain the one-shot circuit in the PLC.
How to Make a One-Shot in the PLCVideo
Select Use Structure. The name will be Simple_Counter. When we do this the following parameters are set:
Simple_Counter.Current – 32bit integer
Simple_ Counter.Done – Boolean
Simple_ Counter.Preset – 32bit integer
Productivity 1000 Series PLC Counter Instructions
The following tags are then displayed. We will choose the preset value and current value to be retentive. This means that if power is lost or the PLC mode changes from run to program mode the values specified as retentive will remember their values. The initial preset value will be 10.
P1000 P2000 P3000 Ladder Logic Sample Code
When switch 1 transitions from off to on (one-shot) the counter current value will increment by 1. Once the current value is equal to the preset value (10) the done bit will be set. The second rung of your ladder will turn on Out1 when the Done bit is on.
Reset of the counter (Current value set to zero.) is done by the second input of the simple counter. In our case, it is switch 2.
Note: The reset always overrides the count value input.

Counter (CNT)

Productivity 1000 Series PLC Counter Instructions
We will use the structure name of Counter. The One Shot will be selected for the inputs to the counter. (Transition from off to on.)
Productivity 1000 Series PLC Counter Instructions
This will set up the following parameters:
Counter.Current – 32bit integer
Counter.Equal – Boolean
Counter.Greater – Boolean
Counter.Less – Boolean
Counter.Preset – 32bit integer
Counter.Reset – 32bit integer
Productivity 1000 Series PLC Counter Instructions
The following tags will now be defined. We will make the preset and current ones’ memory retentive. The preset value will be set for 10. This represents 10 counts for our counter.
P1000 P2000 P3000 Ladder Logic Sample Code
Our first input (Switch3) will be the count up. When this transitions from off to on the counter current value will increment by 1.
The second input (Switch4) will be the count down. When this transitions from off to on the counter current value will decrement by 1. When both counter up and counter down inputs are triggered at the same time the counter current value will not change.
The reset input will be done with Switch5. When this is activated the reset value will be placed in the current value. This reset will override the up and down count inputs.

Watch the video below to see the counter instructions used in our Productivity 1000 Series PLC.

Download the PLC program here.

Productivity 1000 Series PLC from Automation Direct

Overview Link (Additional Information on the Unit)
Configuration (Configure and purchase a system – BOM)
User Manual and Inserts (Installation and Setup Guides)
Productivity Suite Programming Software (Free Download Link)
This software contains all of the instruction sets and help files for the Productivity Series.

Next time we will look at math instructions in the Productivity 1000 Series PLC.

Watch on YouTube: Productivity 1000 Series PLC Counter Instructions


If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s 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.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.


Leave a Comment