PLC programming and counters
Counters in plc programming can be very useful when you want to do sorting projects. For example a common application which makes use of counters is box sorting processes. You could potentially use a counter and send all counts divisible by two to the right and all odd number counts to the right. Basically sorting boxes into two piles using a counter system. In allen bradley plcs we have three main components of counters. Some of which is the CTU or count up. Another is a CTD which is count down.
Counters have a few variables or memory registers you need to be concerned about. One of which is the accumulator and another is the preset. The accumulator stores the counter value and the preset is the count that we are looking to achieve in the end. Each time we allow the counter to be energize we add one to the accumulator vale. Count down does the opposite where the accumulator counts down each time it gets energized. Counters don’t auto reset themselves so we need to introduce an additional instruction which will reset the accumulator value. This function is know as the reset function.
Here below is an example of this instruction set and how you would use it with rslogix 500.
Using counters in your plc programming projects is extremely useful. Even for just counting normal objects in your processes counters could be really useful. However you must always remember with counters in your plc programs is that you must remember to reset your accumulator if you have done some operations. This often can cause bugs in your program if you don’t consider these potential issues, which can go wrong in your automation process.