PLC Programming in a Nutshell

plc programmingJohn, an undergraduate in Electronics Engineering is getting prepared for an interview with XYZ Automation Inc. He expects questions on industrial automation, PLC, and PLC programming and is wondering how quickly he can grasp some knowledge on PLCs. Industrial automation plays a very important role in manufacturing and processing industries and Programmable Logic Controller (PLC) is extensively used for automation and process control systems. So knowing on PLCs will get him going. Why don’t we help him with his preparation?

To start with, the course PLC Automation Training will give John a step-by-step introduction to controllers. When he gets acquainted with controllers and wants to delve deeper PLC Programming From Scratch  will help him learn the basic tools necessary to create a PLC program from scratch.

What is PLC – Is it a Computer?

A PLC is similar to a computer as it has a central processing unit and generates outputs on the basis of some inputs. The logic or sequence of operation for a process is executed as per a control logic program or software. A PLC is a microprocessor based device in which a program is loaded that helps in performing several functions in industrial processes. But a PLC is different from a computer in some ways. Unlike desktop computers, PLCs have multiple inputs and outputs, and are designed for the rugged operation under extreme industrial conditions. They operate under extended temperature ranges, have immunity to electrical noise, and have resistance to vibration and impact.

A PLC may be seen as a digital industrial computer control system mainly used for automation of industrial processes, like controlling machinery or factory assembly lines. It continuously monitors the state of input devices, such as sensors, pressure switch, level switch, on/off switch, and makes decisions based upon a custom program or logic to control the state of the output devices like actuators, motors, relays or solenoids, and analog devices. It can also measure analog process variables, such as temperature and pressure and values from positioning and vision systems. The programs that are required to control the operation are usually stored in battery-backed or non-volatile memory.

Why Do We Need PLCs?

PLCs are indispensable to industrial automation. PLCs were invented as replacements for automated systems that would use hundreds or thousands of relays, cam timers, and drum sequencers. Often, a single PLC can be programmed to replace thousands of relays. The biggest advantage of programmable controllers is that they can replace the complications of rewiring the hard-wired control panels with simple software revisions when there is change in process, product model or sequence of operation. Expanding and contracting a process becomes much easier with a PLC based automation system.

Complicated wiring and need of hardware like timers, and relays can be reduced by using a PLC and writing software program to execute the control logic. This results in smaller and simpler control panels which occupy lesser space. Another advantage of a PLC system is that it is modular, which means you can mix and match the types of Input and Output devices to suit your application.

What Are the Main Units of a PLC?

A PLC consists of the following main parts:

  • CPU (Central processing unit)
  • Input modules
  • Output modules
  • Power supply unit or module
  • Programming device

CPU: CPU or the Central Processing Unit is the heart of the PLC system. It executes the control instructions of the control logic program. It also communicates with other devices, which can include I/O Devices, Programming Devices, computers, Networks, and even other PLCs and also performs diagnostics tasks. The CPU reads input data from various sensing devices, executes the user program from memory and sends appropriate output commands to control devices.

Input modules: They are used for interfacing between input devices (such as start and stop push buttons, sensors, limited switch, selector switch) and microprocessor. The input devices which are in the field or remote locations are hard-wired to terminals on the input modules. Input modules accept signals from the machine or process devices and convert them to lower signals, such as  5 V DC which are sent to the controller for processing. The input module also protects the processor from fluctuations in input signal voltages or currents.

Output module: Output devices which are located in the field or remote locations such as small motor, motor starters, solenoid valve, and indicator lights are hard wired to the output modules. The output interface modules convert the controller or processor signals into external signals which are used to control the output devices.

Power Supply Module: This module provides the direct current (DC) power source required to produce low-level voltage used by processor and I/O modules. Depending on the PLC manufacturer, the power supply can either be housed in the CPU unit or may be mounted a separately mounted unit.

Programming device: This is a device, which is usually a personal computer, used to enter instructions or software program into the PLC. Sometimes it can be a desktop computer or a small hand held device which can be used to load the program into PLC’s memory or CPU.

How Does a PLC Operate?

Here are the four basic steps involved in the operation of PLCs and the steps continuously repeat in a loop.

  1. Input Scan: The states of all input devices that are connected to the PLC are continuously scanned or monitored.
  2. Program Scan: The program logic entered by the user into the CPU of the PLC is executed.
  3. Output Scan: All output devices that are connected to the PLC are energized or de-energized as per the output instructions generated from the program scan.
  4. Communicating: The PLC communicates with programming terminals, interfaces, other PLCs for processing and diagnostics.

What Programming Languages are Used in PLC Programming?

The earlier PLCs used simple ladder logic, similar to electrical schematic diagrams, for setting up the logic and sequence. The electricians were able to trace out circuit problems with schematic diagrams using ladder logic. This program notation was chosen to reduce training demands for the existing technicians. While Ladder Logic is the most commonly used PLC programming language, it is not the only one. The following are some of the commonly used languages used to program a PLC:

  • Ladder Diagram (LD): The traditional ladder logic is a graphical programming language. Though initially it used simple contacts that simulated the opening and closing of relays, later it expanded to include counters, timers, shift registers, and math operations.
  • Function Block Diagram (FBD): A graphical language for depicting signal and data flows through re-usable function blocks. The function blocks are called repeatedly to execute similar type of functions. FBD is very useful for expressing the interconnection of control system algorithms and logic.
  • Structured Text (ST): A high level text language that uses structured programming. It follows a structured syntax and supports a wide range of standard functions and operators.
  • Instruction List (IL): It is a low-level “assembler like” language and is a type of instruction based language.
  • Sequential Function Chart (SFC): This is used to program complex control systems at a more structured level. The SFC approach breaks up complicated programming tasks into smaller, more manageable tasks.

Integration with HMI Enhances the Capabilities of a PLC

What is HMI?

HMI or Human Machine Interface is the means by which a human operator can interact with a process controller. If a process is entirely automated and running smoothly without errors then we can use a standalone PLC system. Otherwise incorporating an HMI with a PLC provides the necessary feedbacks to the user or programmer about the current states of an industrial process, whether the system is running properly, and if the specific parameters are within required limits. The HMI provides interaction controls such as dials, push buttons in the forms of touch screen or clickable icons. These controls allow processes to be started, stopped, adjusted or programmed as necessary.

An HMI also provides visual displays flowcharts, images, graphics, and textual information about the states of the input and output devices. This makes monitoring of the entire process, its inputs and outputs, measuring instruments easier for the user from a remote location. An HMI can be an integral part of the processor or it can also be a standalone unit.

The above discussion is good enough to get John prepared for his interview. Hope he embarks on his career in industrial automation. As he gets into installing and programming PLC units of different companies like Allen Bradley, Delta, Siemens, and Schneider, he can check out courses like Learn PLC in a Day – Wiring, Installation & Programming  and PLC Automation Training  to augment his knowledge on PLC wiring and programming. Investing in the above courses is very fruitful for people without prior knowledge of PLCs and for those who are into the installation, programming, and commissioning of a PLC based automation system.