Skip to content

Programmable Logic Controllers (PLC) Ladder Logic


Today we see thousands of types of stuff all around us. You just look around in your home, office and markets, there are countless things that are at our disposal and we can buy them at cheap prices.

This is all because of revolution in industrial sector and automation. The word automation means to make something happen on automatically. After the invention of robots, the world has boosted the manufacturing industry and automation industry which results in high production quality and very low per unit cost.

All these manufacturing and automation is basically dependent on an intelligent control system that gives instructions to robots, motors, conveyer belts, and other machines to operate. This system is known as “Programmable Logic Controllers (PLC)”

In older days, when large electromechanical relays (EMRs) were used, world was not familiar with solid state logic circuits. Today these EMRs are obsolete and PLCs are introduced based on the solid state logic circuits having the capability of high current and voltage switching. These PLCs are equipped with digital computers that can be programmed to perform predefined set of instructions/functions.

Earlier Computing Device and Advent of PLC:

In very early stages of control and automation, scientists and engineers developed a computing device, called MODICON. “Modular Digital Controller”. The company that introduced that controller was Bedford Associates. Later, many other companies started to work on similar controller types and came up with many other special purpose controllers. They named it as “Programmable Logic Controllers (PLCs)”. Those PLCs were the replacement of large and bulky EMRs while PLCs were comparatively small and performed many logical tasks by having multiple inputs and outputs and solid state computing device and a program stored in the memory to achieve the desired function.

Ladder Logic Programming PLCs

A PLC is basically an industrial computer. It has many inputs and outputs. Commonly a PLC has six inputs and six outputs. The input to the PLC can be a logic state HIGH or LOW from an external push button or switch. The input can be a signal from sensor like water level sensor. Similarly, the PLC then reads the inputs and then according to the programmed instructions perform the output signals.

The output of a PLC can be a solenoid, motor, indicator lamp and contactors. The core strength of a PLC is its “ladder logic” IC programming. This programing scheme is very user friendly and industrial engineers can easily understand and program the PLC in ladder logic program. The program resembles the ladder because the relay coils and contacts structure connected in series and parallel makes the shape of ladder. However these coils and contact shown in the ladder logic program are just “imaginary” and not the real. They are just to show for your understanding. Actually inside PLC they are taken as 1s and 0s.

The input and output levels are 120VAC for the PLCs. However there are some PLCs that have I/Os (Input / Outputs) low level DC voltage to drive logic gates but this is the exception.

An Example PLC: 

A generic type PLC is shown on the right side. This has 6 inputs (X1-X6) and 6 outputs ports (Y1-Y6). The ports L1 and L2 refer to Line and Neutral inputs that is 120VAC. This L1 and L2 will energize the internal circuitry of PLC.

The input side of PLC has Optocoupler LED connected. This LED will turn ON and OFF depending on the input. This LED is internally connected in the PLC through L1 and L2 (common) by means of series resistor.

The output ports Y1 to Y6 are internally connected by L1 (source) and L2 by means of Optocoupler

TRIAC or transistor as switching device.

The common is connected externally to L2 (Neutral) and source is connected externally to L1 (Line).

The below diagram shows the connection of input and output to L1 and L2 and its internal circuitry.

The Optocoupler basically provides isolation between the computer’s circuitry and applied high AC voltage at input.

There are also indictor LEDs for the display output for Input and Output that is activated by DC volts just for the indication purpose to show which input is ON and which is OFF.

How PLC Works:

There is an intelligent computing device that is programmed by ladder logic that takes input from opto LED pcb and then process and then outputs the opto LED signal to opto TRIAC to turn ON or OFF the corresponding output.

This computer’s ladder logic program is based on the coils and contacts. But these are just imaginary symbols for the understanding of programmer / user. Actually the computer works on digital logic of 1’s and 0’s. These inputs are converted into 1s and 0s then processed and output as 1s and 0s to TRIAC to turn ON or OFF high voltage AC loads like motor or solenoid.

A Basic Example of PLC Ladder Logic:

For instance we connect a push button at the X1 input terminal of PLC. This Push Button (PB) is “Normally Open (NO)” and connect the lamp at Y1 output.

In this condition the lamp is dark and button is not depressed. Now as soon as we press the push button it becomes “Normally Closed (NC)” and the lamp will glow. Now when we release the push button lamp will go dark again and PB returns to initial NO state.

In the program, X1 is the “Contact” and Y1 is “Coil”. Not real coil and contact. As the PB is pressed, X1 becomes NC and Y1 coil is energized. As the PB is released, X1 becomes NO and Y1 coil is de-energized. X1 and Y1 are in series so the power or AC voltage will move from “left wall” to the “right wall”. As can be seen that the color of coil and contact changes when they changed their states from NO to NC. The RED color shows the power is conducted in the circuit.

This scenario is called momentary push button. The ladder logic program in blue screen of personal computer (PC) is shown. The programmer has made the program in PC and connected the PC to PLC via programming port.

It is important to know that as soon as the program is uploaded in PLC, the programmer can remove the PC from PLC and PLC can save the program in its memory and can execute it continuously as and when required.

Inverted X1 Switch Behavior:

The main advantage of PLC is that we can change the behavior of control system by changing the command we give it. In the previous example we saw that the lamp was OFF when the PB was NO. Now we can alter the behavior of PB by make a small change in the ladder program. We will replace the contact X1 from NO to NC. In this way the Y1 will be energized when the PB externally is not pressed. And when the external PB is pressed then the X1 state will change from NC to NO and de-energizing Y1 and turning the lamp OFF.

However the hardware solution was that if we wanted the lamp to remain ON until the push button (PB) is pressed then we have to find a new push button that has NC configuration and we had to change the external push button itself and that we had to make hardware changes which is obviously not suitable

Hence the ladder logic solution is much easier than hardware changes.

Reusability of Input Signals:

The major advantage of using the ladder logic program control instead of hardware control, is that the inputs can be reused. Means that if a push button is pressed external then its equivalent logic X1 contact can be used several times in ladder logic program. For example X1 is used 2 times in the program. Then if the PB is closed then both X1 will become NC simultaneously and when PB is released both X1 will become NO simultaneously.

For example in the illustration shown on right, we used 3 PBs in NO state initially. According to the ladder logic program shown we can see that Y1 coil can be energized in 3 ways. If X1 AND X2 are NC OR X2 AND X3 are NC OR X1 AND X3 are NC

This AND, OR logic shows that contacts are connected in series and parallel respectively. It means that at least two contact should be closed in order to energize the coil.

Latching Circuit Using Push Button:

Another interesting example is implementation of latching circuit using push button. Consider the following arrangement in ladder logic.

As we can see that we have used two push buttons PBs at X1 (Start Motor) and X2 (Stop motor) inputs and one motor output at Y1. These two PBs are normally open externally in real but in ladder program logic for X1 is normally open while for X2 is normally close. Here we can see that the coil Y1 is used as feedback path “contact” parallel to X1.

How it works:

As soon as the X1 is pressed (Start Motor) the X1 becomes ON “Normally Close” as shown by RED color. X2 is already in NC state “Conducting state” hence the output coil Y1 is energized as shown by RED color.

Now immediately, as Y1 coil is energized, its corresponding feedback contact Y1 changes its state to NC and conducts current through it.

Now X1 is released, but since Y1 contact is energized the motor will remain ON and Y1 coil will remain energized. This is said to be “latched state”. The motor is now “latched”. Now it does not matter how many times you press and release X1, the motor will remain ON

Now you press X2, as soon as you do so, the X2 contact will change its state and RED color will disappear as shown in diagram. The X2 will become “open” hence breaking the path of current to Y1. This will de-energize Y1 and stops the motor and Y1 contact become “open”. Now you release X2 and X2 become “close” again but motor is still OFF.

Now when you again press X1, the same process is repeated again.

Some Advance Features of PLC:

There are some advance PLCs like Siemens SIMATIC S7-300 and above. These are used in high end industrial environments. High performance and good reliable.  7 standard and 7 compact CPUs and 5 fail safe CPUs. SIPLUS digital modules, analog modules, function modules, communication and power supply.