Move (output instruction)
CLR: Clear
Sets a register to zero.
Also called: clear to zero, zero a register.
CLR(number)What it does
CLR writes zero into its destination for as long as its rung is true. There is nothing more to it, and the whole of the difficulty is in when the rung is true.
It is the natural partner to a totaliser. A register that counts up all shift needs something to put it back to zero at the start of the next one, and that something is a CLR on a rung driven by the shift change or an operator button.
It clears a register. It does not reset a timer or a counter. Those hold state of their own, including their status bits, and RES is the instruction that clears that properly. Writing zero into a counter's accumulator with CLR leaves its done bit in whatever state it was already in.
A rung you can run
A jam tally, and the button that clears it
ONS(Jam_Detect)ADD(Jam_Count,Jam_Count,1)
GEQ(Jam_Count,3)OTE(Call_Maintenance)
ONS(Ack_PB)CLR(Jam_Count)Toggle Jam_Detect three times and the maintenance call comes on; press Ack_PB and the tally goes back to zero. The one-shot on the acknowledge is a habit worth keeping even though holding the button would only hold the register at zero here: on the rung above, the same mistake would stop the tally counting at all.
Run this rung in the simulatorWhat it is called on other controllers
| Platform | Equivalent |
|---|---|
| Rockwell (Studio 5000) | CLR |
| Siemens (TIA Portal) | MOVE with a source of 0 |
| Mitsubishi (GX Works) | RST on a word device, or MOV K0 |
| CODESYS and IEC 61131-3 | An assignment of 0 |
Common mistakes
- Clearing on a level rather than an edge. A CLR whose rung is true every scan zeroes the register every scan, so nothing can ever accumulate in it. The rung looks right and the total is always zero, which is one of the most confusing faults a beginner can hit.
- Using CLR where you meant RES. A timer or a counter is more than its accumulator, and CLR does not touch its done bit or its timing state. Reach for RES on anything with a .DN.
Practise it
Interactive exercises that use CLR. Each one checks your ladder against a real scan.
