Count Up With CTU
Part of the Counters and Numbers section of Coddy's PLC Programming journey. Lesson 1 of 17.
Machines count all the time: boxes on a belt, bottles in a crate, presses of a button. A counter is a box on the rung that does it for you.
The up counter is called CTU. The power coming into it is its count input. Each time that power goes from FALSE to TRUE, a rising edge, the counter adds one. Holding the button down counts once, not once per scan.
A counter keeps two numbers. PV (preset value) is the target you set, here 5. CV (current value) is the count so far. Its output Q turns TRUE when CV reaches PV, and that is the power on its right. C1 is this counter's name; you can read C1.CV and C1.Q anywhere.
Challenge
EasyLight Green on the fifth press of PB1:
- a normally open contact on
PB1 - a CTU counter
C1with PV 5 - a coil on
Greenafter it
Press Run, press PB1 five times and watch CV climb, then Check.
Try it yourself
{"v":1,"lang":"ld","tags":[],"rungs":[{"els":[]}]}All lessons in Counters and Numbers
Practice on your own: PLC playground