Up and Down With CTUD
Part of the Counters and Numbers section of Coddy's PLC Programming journey. Lesson 4 of 17.
A car park counts cars in and cars out. One number goes both ways, so it needs the up and down counter, CTUD.
The power on the rung is its count up input, CU. A second input, CD, takes a tag that counts down. It also has R (reset to 0) and LD (load PV).
It has two outputs: QU is TRUE when CV is PV or more, and QD when CV is 0 or less. On the rung, the power on its right is QU, and CD here is PB2. Here Red is the Full sign of a car park with 3 spaces. A CTUD can count below 0: a press of PB2 with no car inside makes CV -1.
Challenge
EasyA car park has 3 spaces. PB1 is a car coming in and PB2 a car leaving. Light Red (Full) while 3 cars are inside.
Use a CTUD with PV 3 and CD = PB2.
Try it yourself
{"v":1,"lang":"ld","tags":[],"rungs":[{"els":[]}]}This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Counters and Numbers
Practice on your own: PLC playground