Remembering a Number in SoapBox Snap


Traditional PLCs let you peek and poke at memory addresses directly with commands like MOVE, etc. In SoapBox Snap, the ladder language is designed around a more strict Functional Programming model, but that doesn’t mean you can’t conditionally latch a number into a memory location.

Let’s examine the case where you have an analog input (A0) and you want to capture the value of A0 on the rising edge of one of the discrete inputs (pin2). The Choose Number instruction acts like a memory register if you set the second numeric input to itself:

Choose Number instruction as Memory

Take a look at how the Choose Number instruction selects value A0 when the input turns on, but otherwise chooses its own value. This creates a form of internal state, similar to a sealed in coil.

Comments are closed.