How Ladder Logic instructions work with the PLC scan cycle
The first part of the post about the PLC scan cycle with Ladder Logic will consist of how the contacts affect to the PLC scan cycle.
In Ladder Logic, each symbol represents an instruction and do you know how they work with the PLC scan cycle? It can become troubling, but to make it easier, we will start with an example that will incorporate the two most basic Ladder Logic symbols.
Below, you can see a basic example of two symbols, which means that they are two instructions.
These symbols are essentially logic instructions that allow you to construct a piece of logic. Your Ladder Logic or PLC application is that piece of logic. Above the symbols there are two names; I0.0 and Q0.0. Read on to find out what they mean.
Normally Open in PLC scan cycle
Previously we explained in a previous post that this is the Normally Open or Examine if Closed symbol and is represented as shown on the left.
The NO symbol is basically used to verify whether or not anything is true, that is why it is a conditional symbol. If, for example, you want to prove if a bit is on, this instruction is a perfect option to do it.
The name above the NO symbol that we have seen in the previous image is I0.0. The instruction will examine this specific address, which represents the name of the particular bit that will be examined. In this case, a digital input might either be output or even an internal memory bit.
The Normally Open symbol works exactly the same as in an electrical circuit. Naturally, there is no memory bit as a condition on the NO contact. Even so, the NO instruction does not have a memory bit as a condition. If the contact is active or not is the condition.
As an example of a condition, we have thought of a finger pressing a button.
However, the most important thing to remember is that EACH INSTRUCTION in the PLC has to have an address.
In the PLC, inputs and outputs are also bits of memory. The Normally Open symbol has been assigned memory address I0.0 as a condition in the example above. This address corresponds to the PLC’s first input. This is how it works:
1.The PLC starts to verify the statuses of all its inputs when the PLC scan cycle begins.
2. For this states, in the memory will be the boolean value (0 or 1).
a. LOW input: bit is set to 0.
b. HIGH input: bit is set to 1.
Control Coil in PLC scan cycle
Therefore, the instruction will store itself in the PLC memory. The result of the instruction will be put into the PLC’s memory. The representation of this symbol is shown on the left side.
Using an output coil we cant turn on and off a bit. The Control Coil symbol is on the right side of the rung, because all the instructions before it, as long as they are on the same rung, operate as a condition for that instruction.
In our case, the result will be the closed instruction. Anyway, in order to show how it operates, let’s see what the effects of that instruction may be.
1. The PLC scans the inputs byte I0
2.The program starts to run
In the following example, you will learn and understand how to read a digital input’s status and set a digital output to the same status:
First of all, the PLC scans all of its inputs, as seen in the first video. Later, it records in a memory byte these inputs’ statuses, which is made up of only 8 bits that are next to each other.
Secondly, the program will begin to run after the PLC has stored all the inputs’ statuses. First, it carries out the Normally Open. This instruction’s result will be the same as the memory bit’s current state.
The reason for its name is that the contact is open in a normal state where the memory bit is 0, so the result will be 0 too. However, if the memory bit is 1, the contact will shut and the result will be 1.
The RLO (Result of Logic Operation) happens when the Control Coil uses the result of the preceding instruction as a condition, so it means that the Control Coil sets the bit to the exact value as its condition. Moreover, it saves the result in a specific location in the PLC memory.
Also, it is important to mention that in PLC terminology, a word is defined as 16 bits next to each other or 2 bytes.
All digital outputs in the PLC are also allocated to bits in memory. We will refer to this as the output byte (Q0), and so the bits Q0.0 to Q0.7. In memory bit Q0.0 will be the output coil’s result.
Thirdly, the outputs will be set once the PLC has completed the entire program. Each output’s state is set to the same as the output bits’ states. When the PLC has executed the whole program, it will set the outputs. Finally, The state of each output is set to the same state as the output bits.