Cascading Counters

Introduction to Cascading Counters

By cascading counters, you can virtually have a limitless number of counts using CTU instructions. With the older 16 bit processors, the maximum count was 32767 before the counter overflowed. Using 32 bit processors, however, this maximum count for a signed DINT is 2147483647 before it will overflow. In reality, this is more counts than most people will ever need. At one count per second, the counter would be good for over 68 years!

So why would we want to cascade counters to get more counts? In spite of the ControlLogix ability to count so high, many factories are working with older SCADA systems which only support 16 bit integers. In this case, we might have one counter that counts thousands of counts. The SCADA system can then display the thousands of counts in one register, and individual counts (below 1000) in another register.

Another reason to cascade counters is to limit the number of digits on an HMI display. For example: For maintenance purposes, the HMI will simply display thousands of counts instead of individual counts.

Create the tags

First we’ll create a couple of tags for the counters. I’ll also create a BOOL bit to trigger the number of counts, and a tag for a ONS instruction that we will need later on.

Cascading Counters Logic

The logic is very simple:

Each time the OnesCounter is triggered, it will increase by the value of 1. Once the OnesCounter reaches the preset of 1000, it will trigger the ThousandsCounter. It then resets the OnesCounter.

It’s important to realize why we use the ONS instruction. When the Trigger goes high, and the OnesCounter reaches 1000, it resets in the next rung. If the Trigger is still true on the next scan, the OnesCounter would immediately count back to 1 if it wasn’t for the ONS instruction. In effect, without the ONS, every thousand counts, our value would be 1 count too high.

Be sure to test and verify any logic in your project to assure correct operation before implementing it in any way!

For more information on counters, visit the ControlLogix Counters post!

— Ricky Bryce

Leave a comment

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

two + = 9