Some fun with PLC

https://www.polycase.com/techtalk/electronics-tips/what-is-a-programmable-logic-controller.html

PLC stands for Programmable Logic Controller. It is a family of industrial computers specialized for the control of manufacturing processes. PLC originated in the late 1960s in the automotive industry in the US and were designed to replace relay logic systems.

There are two types of PLC:

  • Fixed: Input/Output sections are integrated into the micro controller
  • Modular: allows to give to the PLC additional capabilities through the use of modules for example increased number of Input/Output

Modular PLC are usually easier to use because each component is independent so it is easier to replace them in case of fault and it is easy to scale up and down by adding or removing modules.

Among several programming languages ladder logic is the most basic and simplest form of programming for PLC. Ladder logic was originally a written method to document the design of relay racks but then it has evolved into a programming language that represents a program by a graphical diagram. The name comes from the resemblance of the diagram to a ladder because it is composed by rung.

This is an example of a ladder logic program:

https://www.plcacademy.com/ladder-logic-tutorial/

For more information about PLC and ladder logic I highly suggest you to check out the LinkedIn Learning path Become a PLC Developer from Zahraa Khalil.

To simulate the programming of PLC I will be using LogixPro 500 PLC Simulator from TheLearningPit.com by professor Bill Simpson. LogixPro 500 PLC Simulator mimics Allen-Bradley’s (Rockwell) RSLogix 500 PLC editing software.

Let’s start with an “Hello World!” program:

We have a push button that we want to use to turn on a light. So we will connect the push button to the Input module and the light to the Output module of the PLC.

PLC input output schema

There are three main instructions used to translate relay control logic to contact symbolic logic:

Two input instructions:

  • Examine If Closed (XIC) also known as Normally Open (NO)
XIC instruction
  • Examine If Open (XIO) also known as Normally Closed (NC)
XIO instruction

One output instruction:

  • Output Energize (OTE)
OTE instruction

There is a memory bit associated with each instruction that is linked to the status of an input device, output device or internal condition.

The push button provides the Input module with the status of the device. The Input module stores a bit value that represent the device status to a specific address memory location. We will use this bit address in our program to read the value with an input instruction.

In the same way the output instruction set the bit value in a specific address memory location. Depending on this bit value the Output module will energize or not the light.

Let’s use XIC instruction to read the status of the push button and the OTE instruction to write the status of the light.

So our program will be:

Ladder logic program

When the push button is not pressed, the bit value in the memory is 0. Using XIC when the bit value in the memory is 0 its logic state is False. When the logic state of the instructions of the left of the OTE is False also its logic state is False. When the logic state of the OTE is False the bit value in the memory is 0. When the bit value in the memory is 0 the light is off.

Otherwise when the push button is pressed, the bit value in the memory is 1. Using XIC when the bit value in the memory is 1 its logic state is True. When the logic state of the instructions of the left of the OTE is True also its logic state is True. When the logic state of the OTE is True the bit value in the memory is 1. When the bit value in the memory is 1 the light is on.

PLC program schema

Now let’s simulate our program with LogixPro 500 PLC Simulator:

LogixPro 500 PLC Simulation

Let’s select the I/O Simulator in the Simulations menu. Then let’s drag and drop on the rung 000 the XIC and OTE instructions.

The push button is connected to I:1/0 (Input module 1 address 0) and the light is connected to O:2/0 (Output module 2 address 0) so the XIC and OTE instructions are linked to the same addresses.

It is a good practice to label the instructions to easily read the program.

Now let’s Select the Go Online mode in the drop box, Download the program and select the Run radio button.

In the I/O Simulator window if we press the I:1/0 push button the O:2/0 light will be turned on.

If you are interested in more posts about PLC and ladder logic examples let me know in the comments!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store