As there are many PLC manufacturers, there are as many software programming packages. Each manufacturer developed their own software with no set standards other than it must follow relay ladder logic so that technicians could easily be trained without having to be software engineers.
Two terms describe PLC software; open architecture and closed architecture. Open architecture software is usually free and can be modified, copied and used without being licensed by the manufacturer. Closed architecture is proprietary software that must be purchased from the PLC manufacturer and cannot be copied or modified. This makes it harder to connect to devices from different manufacturers. This deficit was a problem for the industry. Today, the primary standard for programmable logic controller (PLC) programming is defined by the International Electrotechnical Committee (IEC) standard 61131. This is the most recognized standard which covers the following:
IEC 61131, this standard is broken down into:
• IE 61131-1 Programmable controllers – Part 1: General information.
• IEC 61131-2:2003 Programmable controllers – Part 2: Equipment requirements and tests.
• IEC 61131-3:2003 Programmable controllers – Part 3: Programming languages.
• IEC 61131-4:2004 Programmable controllers – Part 4: User guidelines.
• IEC 61131-5:2000 Programmable controllers – Part 5: Communications.
• IEC 61131-7: Programmable controllers – Part 7: Fuzzy control programming.
• IEC 61131-8:2003 Programmable controllers – Part 8: Guidelines for the application and implementation of programming languages.
The basis for this standard was to develop software that would allow engineers and technicians with different skill sets to access programming at different levels. There are other standard organizations, but most refer back to this standard as a starting point. As programming evolves, the standards will change as well.
The last requirement of the GM engineers was that the method of programming should be in the form of relay ladder logic, a method that plant electricians, engineers, and technicians were already familiar with. Ladder and Relay Logic had been the industry standard for decades and is still in use today. It is the foundation that PLC software architecture is built. This made it much easier to train technicians on the new technology and possibly to make it more comfortable and acceptable when transitioning to PLC programming and troubleshooting.
PLC Scan Cycle
PLC manufacturers developed their software using standard relay logic. Now that we have some background on the development of the software, let’s see exactly how a program works.
The PLC’s CPU will store the user program in memory. When the program is executed, it first starts what we call a PLC scan cycle. The scan cycle will read all inputs and update the input status file. It applies this to the PLC ladder logic. Last, it updates the output status file and sends signals to the appropriate outputs to turn on or off. This scan cycle is repeated over and over throughout the execution of the of the PLC program. This gives the PLC the ability to read and write to inputs and outputs in real time
Click on the following link to watch a video demonstration of the scan cycle process:
The scan cycle is a sequential process, meaning it reads and executes one line of code at a time. It reads the program from left to right, just like a ladder logic diagram. The CPU is continuously updating and executing the program file status. If other data or math/logic is needed, it stops the scan and calls up a subroutine from memory. These subroutines have data files attached that store values for certain functions like timers and counters. After the subroutine is completed, it returns the main user program and continues with the scan cycle.
This is the basic structure of a PLC program based on ladder logic. Programming has evolved into the much more complicated structure. The industrial environment today requires more detailed and complex programming.
Function block programming was developed to expand on the current ladder logic programming and is used more and more today. It basically allows a programmer to define a subroutine into a block of data that can be called up and used over and over again without having to rewrite code.
Statement List programming is a way of writing to a PLC using programming statements instead of ladder logic.
Both are gaining ground and have their niche in the market, but are deviating away from the ladder logic programming of a PLC.
Next, we will look at a sample PLC program that shows how a PLC can automate a process by reading inputs and controlling outputs to fill a water tank. Notice that the PLC is scanning, monitoring and updating the outputs. Click on the link below: