Menu
CoddyTech

Resetting a Counter

Part of the Counters and Numbers section of Coddy's PLC Programming journey. Lesson 2 of 17.

Once CV reaches PV, a CTU keeps counting up and Q stays TRUE. Nothing brings it back on its own. To start again you reset it.

A CTU has a second input, R (reset). While R is TRUE, CV is held at 0, so Q turns off. You give R a tag, like a button:

The box on the rung shows PV, R and CV; tap it to change them. Here R is PB2. Every counter on a real machine needs a way back to zero: a reset button, the start of a new batch, or the machine itself saying the job is done.

challenge icon

Challenge

Easy

Make PB2 reset the counter: set its R input to PB2.

Five presses of PB1 should light Green, PB2 should turn it off, and then it takes five presses again.

Try it yourself

{"v":1,"lang":"ld","tags":[{"name":"C1","type":"CTU"}],"rungs":[{"els":[{"t":"no","tag":"PB1"},{"t":"CTU","inst":"C1","pv":5,"r":""},{"t":"coil","tag":"Green"}]}]}

All lessons in Counters and Numbers

Practice on your own: PLC playground