Count Down With CTD
Part of the Counters and Numbers section of Coddy's PLC Programming journey. Lesson 3 of 17.
Sometimes you count what is left, not what is done: parts in a tray, labels on a roll. The down counter, CTD, subtracts one on each rising edge of its input.
It starts from PV. Its LD (load) input copies PV into CV, filling the count. Its Q turns TRUE when CV is 0 or less: nothing left.
Here LD is PB2: tap the box to set it. At power-on CV is 0, so Q is TRUE until the first load. Here that means Red is lit until someone fills the tray, which is right: an unloaded tray is empty.
Challenge
EasyA tray holds 3 parts. PB2 loads a full tray, each press of PB1 takes one part, and Red lights when the tray is empty.
Use a CTD with PV 3 and LD = PB2.
Try it yourself
{"v":1,"lang":"ld","tags":[],"rungs":[{"els":[]}]}All lessons in Counters and Numbers
Practice on your own: PLC playground