Counters are used in a lot of PLC programs that I have seen. A timing chart is the secret behind understanding of 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. The secret to using counters is a good review of using these timing charts.
PLC Fiddle has three different counter instructions for us to use in our programs. Count UP, Count Down and Reset. We will discuss the counter parameters and the three different instructions. Our counter challenges will help you gain a good understanding of how counters work in the PLC. Let’s get started.
Previously we discussed the free virtual PLC simulator called PLC Fiddle and created some challenges. These challenges are ladder logic that you can solve in your browser.
PLC Fiddle Online Editor and Simulator in your Browser – Video
Basic Gate Ladder Logic Challenges
– AND Gate Ladder Logic Challenge Solution
– OR Gate Ladder Logic Challenge Solution
– NAND Gate Ladder Logic Challenge Solution
– NOR Gate Ladder Logic Challenge Solution
– EXOR Gate Ladder Logic Challenge Solution
– EXNOR Gate Ladder Logic Challenge Solution
– On-Delay Timer Challenge Solution
– Off-Delay Timer Challenge Solution
– Pulse Output Timer Challenge Solution
PLC Fiddle Counter Parameters
PLC Fiddle will have the variables on the left side of our browser. Select Counter from the drop down menu.
We can now name our counter variable. Let’s call this “Counter”.
Click Add to add the timer variable to our list.
Click the down arrow to see the parameters in the Counter variable.
EN – Enable – This will be on when the counter is energized.
Q – Counter Output – This is On when the count Accumulated value is equal or greater than the Preset value.
ACC – Accumulated Value – This is the actual value of the counter. (Current Count)
PRE – Preset Value – This is the count that you want the counter to count up until.
Note: Both of the ACC and PRE settings are any positive or negative number.
PLC Fiddle Counter Instructions
Count Up Counter – When the instruction is energized (logic is true) the accumulator will increment by 1. When the Accumulator is equal or greater than the Preset value the output will turn on.
Count Down Counter – When the instruction is energized (logic is true) the accumulator will decrement by 1. When the Accumulator equals or more than the Preset value the output (Q) turns on.
Reset Counter – The reset instruction will move 0 into the accumulator (ACC) of the counter. Note: You can use the move instruction to move numbers other than 0 into the accumulator of the counter.
Motor Starter Service Counter Challenge
Take the standard PLC Fiddle latching motor circuit and add a service starter output that will turn on once the motor has been started 1000 times.
When you are finished the Motor Starter Service Counter Challenge, click the Check button to test the circuit.
Watch on YouTube : PLC Fiddle Motor Starter Service Counter Challenge Solution
Count Down Challenge
Create a circuit that will count down 10 seconds. The count ACC will start at 10 and go to 0. It will automatically reset and do it over again. See the above timing chart.
When you are finished the Count Down Challenge, click the Check button to test the circuit.
Watch on YouTube : PLC Fiddle Count Down Challenge Solution
Hour Minute Second Counter Challenge
Create an hour minute and second counter to display time that a button is activated. The button can turn off but the amount of time will remain. (Memory Retentive) When the reset button is pressed the time will be set back to zero. (Reset)
When you are finished the Hour Minute Second Counter Challenge, click the Check button to test the circuit.
Watch on YouTube : PLC Fiddle Hour Minute Second Counter Challenge Solution
Counters are an important part of PLC programming. I hope you found the above counter challenges fun to solve using PLC Fiddle. It demonstrates the basic principles of programming without the investment of equipment. Next time we will look at math challenge applications.
If you have any questions or need further information please contact me.
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.