PLC Programming Basics – Simplified and Unearthed
PLC is a major component in industrial automation and is an essential aspect of any automated manufacturing process. The functionality of the PLC has evolved over the years to include sequential relay control, motion control, process control, distributed control systems and networking. They were initially invented to replace the electromagnetic relays and the cumbersome wirings in a control circuit. The data handling, storage, processing power and communication capabilities of some modern PLCs are approximately equivalent to desktop computers. A PLC 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. The logic or sequence of operation for a process or the program is fed into a PLC so that it can control several functions in industrial processes.
What Languages Are Used To Program PLCs?
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.
- Statement List (STL): A high level text language that uses structured programming. It follows a structured syntax and supports a wide range of standard functions and operators.
The course PLC Programming From Scratch is a great course to delve further into PLC programming and learn about the basic tools and syntax.
Examples in STL
PLCs use the bit logic instructions of a binary system, which interpret signal states of 1 and 0 and combine them according to Boolean logic. These combinations produce a result of 1 or 0 called the ”result of logic operation” (RLO).
Boolean bit logic applies to the following basic instructions:
In STL, the following instructions are used to perform Boolean bit logic operations:
• A And
• AN And Not
• O Or
• ON Or Not
• X Exclusive Or
• XN Exclusive Or Not
• O And before Or
Inserting a ‘(‘ after each instruction can be used for performing nesting expressions.
You can terminate a Boolean bit logic string by using one of the following instructions:
• = Assign
• R Reset
• S Set
If the circuit for energizing the output (Q 4.0) which is the coil of a contactor, has one NO (Normally Open, I 1.0) ‘ON’ switch in series with a NC (Normally Close, I 1.1) ‘OFF’ switch then the statement for the same in STL can be written as:
A I 1.0
AN I 1.1
= Q 4.0
If the circuit for energizing the output (Q 4.0) which is the coil of a contactor, has one NO (Normally Open, I 1.0) ‘ON’ switch in parallel with a NO (Normally Open, I 1.1) ‘TEST’ switch, then the statement for the same in STL can be written as:
O I 1.0
O I 1.1
= Q 4.0
Timers and counters can be also programmed and instructions can be written to set and reset their values.
Terms Frequently Used with PLC and PLC Programs
Let us take a simple example to understand the different terms used in a circuit.
Consider the switching on and off of a light in a doorway and activation of a plunger to open the door when a switch is operated. In this system with a flick of the switch a light bulb would turn on or off. But if you want the light bulb to switch off 30 seconds after you flip the switch to the ‘off’ position, you have to buy a timer and do some rewiring. But a PLC would save a lot of your time, labor and money to incorporate the above logic. Now consider the same device with a PLC in the middle. The switch is fed as an input into the PLC and the light is controlled by a PLC output. Here are the explanation of the terms frequently used while working with PLCs:
- Control Device: Any input device, for example an on/off switch, which controls the flow of current in a circuit. Control devices determine when loads should be energized or de-energized. They can be switches controlled by humans or can be contacts of relays.
- Control Circuit: A type of circuit that shows the wiring of the control devices and the output loads. It shows how and when the current should be controlled to energize or de-energize the loads. Control circuits usually carry lower voltages than power circuits.
- Relay: A relay is a simple electromechanical switch made up of an electromagnet and a set of contacts. They open and close circuits electromechanically or electronically. A relay can have two states, NO and NC. A relay contact is normally open (NO) when there is an open contact when the relay is not energized while in a Normally Closed (NC) state, there is a closed contact when the relay is not energized. In either case, applying electrical current to the coil of the relay will change the state of the contacts.
Several companies like Allen Bradley, Delta, Siemens, and Schneider have their own set of PLC products and also their own proprietary software programming language. Once you understand the basic concepts about PLC programming, it will be easy for you to learn the programming methods of any of the companies selling PLC products. PLCs are indispensable to industrial automation.
Top courses in PLC
PLC students also learn
Empower your team. Lead the industry.
Get a subscription to a library of online courses and digital learning tools for your organization with Udemy for Business.