# The Binary Concept Applied to Ladder Logic (I)

Difunde el amor

## Binary code in Ladder Logic Programming

The Binary Code in Ladder Logic refers to the principle that things can be thought of in one of two states. The states can be defined as:

• 1  o  0
• On  o  Off
• High  o  Low
• Yes No

In a PLC, binary events are expressed symbolically using ladder logic in the form of a normally open contact (NO) and normally closed contact (NC). The normally open contact (NO) is TRUE when the event is active and FALSE when the event is NOT active. While the normally closed contact (NC) is FALSE when the event is active and TRUE when the event is NOT active.

### Normally Open Contact (NO) in Binary Code applied to Ladder Logic

The event associated with a normally open contact (NO) can be TRUE or FALSE. When the event is TRUE then it is highlighted green and the logic flow can move past it to the next logic expression. Just like the current flow in an electric circuit when a switch is turned on.

### Normally Closed Contact (NC) in Binary Code applied to Ladder Logic

The event associated with a normally closed contact (NC) can be TRUE or FALSE. The result of the normally closed contact (NC) is basically the opposite state of an event that occurs. So, if PLC input A is FALSE the result will be TRUE. And vise versa when PLC input A is TRUE the result will be FALSE.The normally closed contact (NC) is considered to be a ladder logic NOT function. It is sometimes referred to as reverse logic

If we translate a NOT function into a ladder logic diagram we express it symbolically in the form of a normally closed contact (NC) as seen in ladder logic truth table shown below….

### OR Functionin Ladder Logic in Binary Code applied to Ladder Logic

The OR function examines multiple PLC inputs and has one resulting output. If we translate an OR function into a ladder diagram we can express it symbolically in the form of two PLC inputs A and B using normally open contacts (NO) and a PLC output Y using relay coil.

The inputs are placed in the rung in what is known as a branch. This is the equivalent of a parallel connection in an electric circuit. The output is then connected in line with the rung. This time we have also highlighted the hidden OR function when we create a branch (parallel connection) with PLC input B across PLC input A.

We can write out the logic expression above as IF A OR B THEN Y.

The OR function examines if any of the PLC inputs are TRUE, then the corresponding result is also TRUE. However, all the PLC inputs must be FALSE in order for the corresponding result is also be FALSE.

Because PLC input A and B follows the binary concept and are part of the OR function there are four possible logic iterations.

For basic Ladder Logic programming we express binary events using Normally Open contacts (NC) and normally closed contacts (NC).

The five basic, yet essential, logic functions in ladder logic are:

1. AND
2. OR
3. XOR
4. NAND
5. NOR

The symbols may look a little different than those found on electrical diagrams, but they have almost the same functions. As we can see the example of IECuino