# PLC Scan Cycle with LL (II)

## How Ladder Logic instructions work with the PLC scan cycle

In this second part of the post “PLC scan cycle with LL”, we are going to talk about the Output Latch and the Normally Closed Contact. We recommend that you have read the first part of this post.

### Output Latch

As we have explained previously, we showed you how to read a digital input’s status and set a digital output to the same status. The digital input is an impermanent pushbutton because it contains a spring. Therefore, this pushbutton will be active only when you press it. This implies that the output will be active too only when the input is active. Hence, to retain the output turned on, you must maintain your finger on the button, but this is not practical. There are two ways to keep the output turned on automatically in Ladder Logic:

This is a self-hold or a latch. As the name indicates, the coil holds itself.

#### Output self-hold in Lader Logic

The first time that the PLC runs the Ladder Logic program, the output will be on as long as the button is pushed (you can see the representation above). Nevertheless, when the PLC executes the Ladder Logic on the second or third, the pushbutton will deactivate in a short time. This means that the button may not activate again the second, third or fourth time because of how much time the PLC takes to run the program.

Scan cycle without the button pressed:

#### Why does it work like this?

With the pushbutton pressed during the previous scan cycle, the output has remained active. Next time, the PLC will read the inputs once more and save them in the memory byte. This time, unlike the previous times the PLC will save a “0” in memory bit I0.0. The determination of the first Normally Open instruction with the condition I0.0 will be false or “0”.

However, there are parallel Normally Open instructions. Nevertheless, the output memory bit has the function of a condition. The reason is that the output is still active, so its value will be true or “1”. It will always be active providing that it is “1”.

The self-holding instruction is placed in parallel with the other instruction to create and OR situation. It is relevant to know that to active the output, I0.0 or Q0.0 has to be TRUE.

### Normally Closed

As you probably thought, this instruction is the contrary of the Normally Open and it also executes in a different way. It means that, if the instruction is “0” the answer will be “1” and vice versa.

It must be placed next to the self-holding instruction, so serial connected. Even so, when we press the stop button, the output coil will receive a “1” condition from the latch.

The following Ladder Logic is what we get. It just inverts the condition to the Output Coil. Consequently, the latch will shatter, so if you want to reactivate it you must push it again.

We can see that in the example we use a Normally Closed for a stop button, but this is not the perfect option. If you think about it, the purpose is that the stop button works while it is being pressed, so we must use a Normally Open Contact on the button itself. Why? Because it ensures that the system shuts down when a wire connected to the button breaks.

Consequently, our Ladder Logic logic will be like this:

We have modified the operation of the physical stop button, so it will work exactly the same.