The most basic Ladder Logic Programming Pattern is the Sealed in Coil. This pattern is the basis for remembering state in a PLC. The pattern consists of a trigger condition and a coil, where a contact from the coil branches around the trigger condition to “seal itself in” once the coil is energized:
The “Trigger” contact can be replaced with any logic you want. It’s simply the condition that will cause the coil to energize. The sealed in part is always a normally open (N.O.) contact of the sealed in coil itself. Here’s an example timing diagram:
You may be questioning the utility of this pattern because after the coil is energized, it never turns off! What use is this? Well, it’s not actually true that this coil will never turn off. The coil will revert to a de-energized (off) state if the PLC loses power, or you do a hard reset on the PLC. That means the Sealed in Coil pattern is useful for remembering that something has happened at least once since the program has been running.
You will commonly see this pattern used in the logic for “referencing” or “homing” a machine. Let’s say you have a motor connected to a ball screw. The carriage on the ball screw moves along the shaft when the motor spins. Typically we mount an incremental encoder on the motor shaft so the PLC (or servo drive) can track the position. However, since we only get a stream of pulses as we move forward or backward, the control system doesn’t know the absolute position until we reference (a.k.a. home) the axis to a known position. We do this by adding a “cam sensor” along the axis. If we’re to the left of the home cam then the sensor will be off, and if we’re to the right of it, then the sensor will be on. When the machine starts up it has to know that it’s in the “unreferenced state”. When we’re in this state, it usually waits for an operator to press a home button to initiate a homing sequence. Once the homing sequence starts, if the home cam is off, then the motor will start turning to move the carriage to the right until the home cam sensor turns on, and if the home cam is on, then it starts turning the other way, until it turns off. In this way the machine can find its home, or reference, position.
Once the machine is referenced, it needs to remember this state. Since it only needs to reference once every time the machine is turned on, then a Sealed in Coil is the typical way to do this.
More Patterns of Ladder Logic Programming.