Back to PLC Basics: A Guide to the Programmable Logic Controller

Looking for top-of-the-line components that can help you build a future-focused system that delivers?

We offer a wide range of control products from motor controls to terminal blocks, our inventory is diverse and designed to meet any need.

Contact us to learn more about what we provide and how we can deliver robust solutions to power your next project.

Introduction to PLCs

Today’s industrial automation systems are more advanced and tech-savvy than ever before. Yet, they didn’t get this way on their own!

Programmable Logic Controllers (PLCs) form their backbone, allowing internal components to function together as a seamless unit. Versatile and modifiable, these digital computers are essential to many of the systems and devices we rely on today.

Join us as we take an in-depth look at PLC basics, allowing even the non-initiated to understand how the components work and why they’re so important.

What is a PLC?

Before we get too far into technical specifics, let’s review how a PLC system operates.

It’s a specialized, hardened, computer device designed for use within industrial control systems. It controls devices and equipment by connecting different units and enabling them to work in a coordinated manner.

What gives it this power?

At the core of every PLC is a basic computer processor that gathers various inputs and evaluates them to achieve the desired output. The inputs can be digital or analog. As users can program the system in multiple ways to fit a certain scenario, PLCs within many applications across various industries, including conveyor systems, oil refineries, manufacturing lines and more.

While these might be more sophisticated scenarios, consider the interaction between a simple light switch and a light bulb. By flipping the switch, a user can only turn the light on or off. There is little versatility or flexibility in this application.

Now, say a PLC joins the mix. Suddenly, the user can create more complex controls. For instance, he can make the light blink on or off or make the light turn off one minute after it turns on. Now think of thousands or even tens of thousands of circuits all being controlled in coordination with each other. While that is a simple explanation, that is essentially what a PLC does.

How Does It Work?

We’ve covered that a PLC relies on a computer processor to turn myriad inputs into logic to control a myriad of outputs. Yet, how does this occur?

As the PLC scans inputs from multiple sources, it scans them and internalizes them. Then, it executes the user programming to enact the desired outputs. Next, it communicates any necessary information to a control network such as Modbus or Ethernet IP. Because PLC’s are in charge of mission critical systems and there are usually people near machines, a series of diagnostics are run to make sure everything is in order, before it scans the inputs again. This entire process is the “scan cycle.” The larger the number of inputs, the larger the PLC program, the longer the scan cycle. The scan cycle is measured in milliseconds, more commonly known as “fast.” However, there are some applications where fast isn’t fast enough. A Programmable Automation Controller, or PAC, may be needed. A PAC uses multiple CPUs in a single system or chassis to provide parallel processing, or specialized processing of different facets of the application.

Therein lies the importance of user programming, as the program is what causes the PLC to produce the desired results. Without it, the PLC is just an expensive doorstop.

In this way, a PLC is often described as a small, specialized computer. It shares similar terminology with traditional computing systems, including memory, software, CPU, I/O system and more. Yet, a PLC is made to function in an industrial environment, controlling concrete inputs and outputs from devices, machines and workers, while a personal computer is built to exist in your home or office.

Basic PLC Components

PLCs come in many sizes and feature different levels of capabilities. Some main classifications include smart programmable relays, compact PLCs, modular PLCs, and small-medium-large PLCs.

Compact PLCs

Also known as integrated PLCs, or smart programmable relays, these systems feature a complete system all packed into one small case. Due to this design, the manufacturer, rather than the user, will decide the number and types of inputs and outputs.

Modular PLCs

These PLCs comprise multiple pieces all plugged into a single rack. Modular PLCs can come in many sizes, with varying levels of power and capability.

Small, Medium and Large PLCs

These PLCs differ in size, according to the specific applications for which they are suited.

Though these PLCs are all far from one-size-fits-all, regardless of category, each will include some form of these four components:

  • Central Processing Unity
  • Rack or Mounting
  • Power Supply
  • Input/Output (I/O) Section

Let’s review each of these in detail so you understand how the components work together.

1. Power Supply

As its name implies, the power supply is the component that keeps the PLC running, delivering 24VDC or 120VAC line voltage in most cases. Most power supplies contain a battery back-up that prevents data loss during a power outage.

2. CPU is the Central Processing Unit

The CPU executes the PLC program. In addition to running the PLC program, the CPU interfaces with the unit’s other components. The CPU is where you will find the microprocessor, responsible for coding, decoding and computing data.

ROM is Read Only Memory. ROM can be read by not written to. It is used to store programs and parameters that should not be altered. It is where the PLC operating program is stored.

RAM is Random Access Memory. RAM can be written and read. Information in RAM can be altered. RAM is where the user program is stored. Information in RAM can be lost during a power outage. A battery back is used to save the RAM information should a power outage occur.

EAPROM is Electronically Alterable Programmable Read Only Memory. Information in an EAPROM is not subject to loss due to a power outage. EAPROM is used to store user data without the need for external power. Think of your Roku device or something similar. You can unplug it, store it away, come back months later, plug it back in and hook it up. All your favorites and applications are still there and ready to go.

3. Input/Output Systems

The PLC’s I/O system is the system that accepts new information from outside sources and creates a new function in the form of an output.

Operating System vs. User Program

In the world of PLC programming, you’ll often hear of the CPU executing two different types of programs: the operating system and the user program. Let’s take a look at key differentiators between the two.

Operating System

The operating system (OS) of a PLC includes tasks and programs designed to run automatically, meaning they don’t require direct user commands to function.

It organizes all the functions, sequences, and operations of the CPU not associated with a specific control task. Key OS tasks include:

  • Initiating a warm restart and hot restart
  • Updating and outputting I/O process image tables
  • Executing the user program
  • Managing memory areas
  • Detecting and calling interrupts
  • Creating a connection with programmable devices

User Program

The user program is the combination of the various functions a PLC requires to process a given automated task. In other words, it’s the part of the PLC that allows operators to dictate the outputs they desire, stored in the PLC’s internal memory.

Though it’s in charge of the more visible functions, the user program works with the PLC operating system.

Programming a PLC

One common way to program, modify or troubleshoot a PLC is through a PC-based device in conjunction with the manufacturer’s software. Also used are proprietary handheld devices hooked up to the PLC via a cable.

While a handheld device is often preferred for its portability and convenience, it may lack a traditional keyboard and have limited capability. On the other hand, though a PC device is a little bulkier, it will typically possess more robust processing power. For instance, it allows users to run a program in either online or offline mode in addition to editing, monitoring, diagnosing and troubleshooting the program.

Regardless of the system, you can use your laptop or handheld device to enter the PLC program. From there, you can edit the code and transfer it to the CPU.

Then, disconnect your programming device, as the code is now stored inside the CPU, where it can instruct and govern the operations of the rest of the unit.

An Intro to Ladder Programming

When discussing PLC programming basics, you may hear the term “ladder programming.” What does this mean?

There are two main categories of PLC programming languages. Specific languages used will vary depending on the manufacturer. While some have their own, specialized languages, standard ones fit into one of two categories: textual language or graphical language.

Textual language includes:

  • Instructions Lists (IL)
  • Structured Text (ST)

Graphical language includes:

In most cases, users prefer graphical languages over text-based ones, as they are simpler and more convenient. Within this category, ladder diagrams tend to prevail for their ease of use.

The Structure of Ladder Logic

This graphical language has been around since the dawn of modern PLCs in the early 1970s, first used because it borrowed from the relay diagrams with which plant electricians were already familiar.

Now, the number of available symbols has grown over time, leading to more advanced and diverse functionalities. The PLC relies on these symbols to simulate real-world relay logic controls, connecting them through lines of circuitry and power to direct the flow of the electrical current.

Often called ladder logic, ladder programming gets its name because the code that results assembles a ladder, comprised of the following symbols:

  • A power rail to the left
  • A power rail to the right
  • Individual circuits (“rungs”) connecting the left and right power rails

Common Logic Systems

While ladder logic is a full language of symbols, there are some that you will see more than others, especially in diagrams. Let’s review a few.

  • Contact Symbols

These come in two types: “Normally Open” (NO) and “Normally Closed” (NC). A light switch is an example of a NO circuit, as it stays off unless someone turns it on. Other uses for the NO symbol include power buttons and other internal programmers.

On the other hand, an NC contact represents a circuit that remains active until an input triggers a shutdown. Uses for the NC symbol include fail-safe features, heat monitoring, and “Stop” buttons.

  • Output Symbol

The output symbol is a common representation for warning signs, indicator lights, and motor contactors. The output for each turns on when the corresponding input becomes energized.

  • One-Shot Positive Edge Connections

These outputs are turned on if a given condition changes from “false” to “true” over the time it takes for the PLC to complete one scan. It’s often used for counters and math commands.

  • Timer Delays (On/Off)

Timer instructions allow for on-delayed or off-delayed events. A Timer Delay-On system begins a timer to turn the system on when the PLC input energizes, giving it time to warm up before operation. This works well for delaying siren sounds and facilitating sequence start delays.

A Timer Delay-Off system puts this delay at the end of operation, allowing for time to pass between the shut-off operation and the actual system shutdown. It’s ideal for automatic displays and any machinery that’s susceptible to accidental shutoff.

  • Comparisons

This system will determine if a given value is greater than, less than, or equal to another value. One application is in batching systems, which will use comparisons to ensure that all package components are the same weight.

  • Calculators

Math instructions or calculators enable simple addition and subtraction functions, allowing PLCs to calculate data such as motor speed. In addition to these typical numerical functions, they can also power more complex transcendental functions such as square roots, as well as trigonometric sine, cosine, and tangents along with their inverse forms (arc sine, arc cosine, and arc tangent).

  • Special Instructions

Advanced instructions may include communication directions, PID loops, drum sequences, shift registers, ramp generators, and more.

  • Function Blocks

When building a PLC ladder, users can incorporate function blocks that feature more complex instructions. In addition to improving scan time, these blocks can replace entire physical components of your system, such as hard-wired mechanical timers. One example includes:

And/Or Logic

Using function blocks, you can condense the rungs of your ladder by incorporating “AND” logic that requires the ignition of two or more inputs to trigger an output. For example, a technician will have to press two buttons for a given machine to turn on.

You can also apply the same concept to “OR” logic. If “AND” logic is akin to a series circuit, “OR” logic is its counterpart or a parallel circuit. It’s used within function blocks to require one input or another.

This makes it ideal for machines that have more than one control panel with an ON/OFF switch at either end. With “OR” logic, users can press either switch to achieve the same effect.

Creating a PLC Program

If you want to use ladder logic to create a PLC program, let’s review the steps to take.

1. Determine Program Functions

First, determine what you want your program to do.

Do you want to power on a light switch? What about turn off a conveyor belt or enable a machine to pause every three minutes? There is no right or wrong answer, but you’ll need a clear view of the output function before you begin.

2. List Program Conditions

Next, list all the conditions that will play into your program. Using the light switch example, one condition would be that when you flip the switch upward, the light comes on. Then, when you flip it downward, the light turns off.

Create a flowchart referencing these conditions for visual representation.

3. Configure Your Software

Now, you’re ready to open your handheld or PC-based device and load your programming software. Configure it with the required settings and set your language to “ladder logic language.” Finally, select the appropriate hardware processor and give your new program a name.

4. Add Your Rungs

With your power rails in place, you can begin programming your ladder “rungs.” Add your necessary number of rungs into the program, paying close attention to each input and output.

5. Scan for Errors

It’s essential to scan your program for errors at this juncture, catching them now rather than going back later.

6. Download the Program

Your last step is to download the program to your PLC. Download it to the system’s memory. When the transfer is done, you can disconnect your programming device.

A Comprehensive Look at PLC Basics

As industrial control systems continue to advance in terms of sophistication and function, PLCs will become even more multi-faceted and diverse. While this guide to PLC basics is a helpful start, it’s important to stay on top of these trends to maintain your competitive advantage.

Want more information on industrial controls? Looking for top-of-the-line components that can help you build a future-focused system that delivers?

That’s where we come in.

We offer a wide range of control products in our online shop. From motor controls to terminal blocks, our inventory is diverse and designed to meet any need.

Contact us to learn more about what we provide and how we can deliver robust solutions to power your next project.

The content provided is intended solely for general information purposes and is provided with the understanding that the authors and publishers are not herein engaged in rendering engineering or other professional advice or services. The practice of engineering is driven by site-specific circumstances unique to each project. Consequently, any use of this information should be done only in consultation with a qualified and licensed professional who can take into account all relevant factors and desired outcomes. The information was posted with reasonable care and attention. However, it is possible that some information is incomplete, incorrect, or inapplicable to particular circumstances or conditions. We do not accept liability for direct or indirect losses resulting from using, relying or acting upon information in this blog post.