MOVE a Value
Part of the Counters and Numbers section of Coddy's PLC Programming journey. Lesson 7 of 17.
To put a number into a tag you use MOVE. While the box has power, it copies its input (a number or a tag) into its output tag.
When the power goes away, MOVE stops copying, but the tag keeps the last value. Nothing puts the old number back. So if a value must change both ways, write both moves, one for each case.
Here SW1 picks the batch size, and the counter reads it from Target.
Challenge
EasyThe counter's PV is the tag Target. Add two rungs: with SW1 on, MOVE 3 into Target; with SW1 off, MOVE 5 into Target.
Try it yourself
{"v":1,"lang":"ld","tags":[{"name":"Target","type":"INT","init":5},{"name":"C1","type":"CTU"}],"rungs":[{"els":[{"t":"no","tag":"PB1"},{"t":"CTU","inst":"C1","pv":"Target","r":"PB2"},{"t":"coil","tag":"Green"}]}]}All lessons in Counters and Numbers
Practice on your own: PLC playground