Site Loader

On our previous post we went into the basics of PLCs and touched on some of their background. In this section we aim to dig deeper into I/O modules, memory management, and ladder logic. This will be where we cant start to get into actually programming a PLC.


The purpose of a programmable logic controller is to control some device. That could be a pump, a motor, a valve, or something else. The way that it is controlled is through an output from the PLC. The signal coming in to the PLC is called the input. This is where the PLC gets information about what is going on outside of itself. Without inputs and outputs, a PLC wouldn’t serve any purpose and would be worthless. Therefore, anytime we are using a PLC, there will be inputs coming in to the controller and outputs coming from the controller. These inputs and outputs are commonly known as I/O.

Because I/O so paramount to the PLC, it is essential that the programmer has a solid understanding of them and how they work. We can start by breaking them up into two categories. This first category will be digital and the other analog.

What is a Digital I/O Point?

A digital signal, also referred to as a discrete signal, is the easiest to understand. A discrete value is one that can only be in one of two states, it is either on or off. There is no value in-between. Digital signals account for the majority of signals that we will be dealing with in the programming field. When they are seen in logic they are usually described by either a 1 or 0. They will also be called true or false, open and closed, energized and deenergized, and on rare occasions they’ve been known as black or white. You can find discrete signals everywhere. These are your push-buttons, switches, relays, pump starts/stops, valve actuators and the like.

 What is an Analog I/O Point?

Analog devices, unlike digital ones, can come with a range of values. The most prevalent analog signal is probably 4 to 20 milliamps, but others’ include: 0 to 5 Volts, -10 to 10 Volts, and 0 to 10 Volts. There are many more possibilities with analog values and that can make programming with them a little trickier. If this seems a little hazy right now, don’t worry, we will get in to more details soon.

Getting the I/O to the PLC

So know that we have a basic knowledge of I/O, we need to understand how the signals make their way to the PLC. In fixed PLCs, the I/O is directly attached to the controller. You would wire the I/O to these terminals, load a program into it and you’re good to go. In the case of slightly higher end models, the I/O is connected by I/O modules. These I/O are sold separately and come in the form of I/O modules. Some of these modules are very general and handle simple digital inputs and outputs. Then there are more specialized modules that handle signals from RTD thermocouples and others handle high speed readings, when I/O needs to be read/write to faster than atypical module can handle. Other modules allow for the PLC to interface with network devices. There are modules that allow the PLC to communicate by ethernet, modbus, fieldbus, and more. Modules allow the PLC I/O to be scalable. If you need addition I/O points, you can buy an additional module. If you don’t need 500 I/O points and instead only need 20, you don’t get stuck paying for the additional channels.

Input Modules

One of the main advantages of using programmable logic controllers is the ease of connecting I/O devices. The first step in design is specifying the number of I/O devices the PLC will have to control. With the many different types of I/O modules available it is very important that the user know how to select the right I/O module for the job. I/O modules themselves do not provide any power. What they do is provide a connection between the I/O device and one side of the power supply rail. We will start by looking at these input modules in more detail.

AC Input Modules

AC Input module wiring schematic showing the current pass through each individual channel before returning through a common ground
Wiring schematic of an AC Input module. The current passes through each channel’s input before reaching a common ground.

The image above is a wiring schematic for a typical 120V AC input module. Inputs 1-4 show a pushbutton switch and inputs 5-8 show a normally open limit switch. If you are not familiar with switch symbols, checkout our introduction to switches article to learn more. The common wire is connected to all of the input devices. Each input is connected to a hot wire that runs to the input module. When an input is closed, electricity can flow from the hot wire, through the input module, and back out through the common wire.

DC Input Modules

There are two types of DC input modules, sinking and sourcing. The distinction comes from whether the current flows into or out of the DC module.

DC Sinking Input Module

DC sinking input module showing the current pass through each channel before reaching a common ground
DC sinking input module

In a sinking module, current will flow from the positive supply rail, through the input device, through an LED, and then sink to the ground. This LED will only allow flow through in one direction. This means if the module is connected backwards, the LED will block current flow, and no input current will be detected. Light from the LED, stimulates an optocoupler, which is device sensitive to light, that will enable a bit inside of the PLC’s memory. This method of isolation provides some ruggedness to the PLC. Even if a large spike in voltage were to occur and destroy the input module, the main PLC as well as any additional modules would be ok. Each one of the input channels will have it’s own optocoupler.

DC Sourcing Input Module

DC sourcing input module showing the current pass through the common voltage source before reaching each individual channel.
DC sourcing input module

A sourcing input module works in nearly the same way. The only difference is the high voltage (+) flows through the diode before reaching the channel.  The above picture looks nearly identical to the first but note some small but important differences. The power supply is now delivering current through the bottom. This current travels through the channel, then the diode, and only then does it reach the switch.

Analog Output Modules

AC Output module wiring schematic showing the current pass through the common supply before reaching each individual channel
Wiring schematic of an AC Output module. The current passes through the common supply before reaching each individual channel

Just as with input modules, outputs are optically isolated from  the PLC’s internal circuits. Shown above is an analog output using a triac. For more information about triacs and how they work, checkout out article here. Due to the nature of triacs, there will be a small leakage current. With high current loads this shouldn’t be a problem. If however you are using low current devices this leakage may cause an issue. If you find an issue due to a current leak, placing a small resistor across the effected device should help.

DC Output Modules

DC Outputs are very similar to their DC input counterparts. It is important to note however, that when designing these systems, current drop must be accounted for when using long runs. If one were to use 24V DC and suffer a 10V loss due to wire loss, you are left with only 60% of your original voltage. It is therefore recommended to use 24V DC on digital inputs and 120V AC to power digital outputs. With the 120V AC, that same 10V loss would mean you are still receiving 92% of your original voltage.

PLC Addressing & Internal Data Handling

Now that we know how the inputs and outputs make their way to the PLC, we need to begin to understand how the PLC manages this information. One of the first things an aspiring PLC programmer needs to learn is how the memory of their specific PLC is organized. All PLCs should come with a published memory map detailing how much memory is available for certain functions, how the programmer can reference different locations, and which addresses correspond to which I/O points. The discrete signals we referenced above correspond to individual bits in the processor. The analog values correspond to words. If you are unfamiliar with this terminology please visit our introduction to memory article to get up to speed. There is no standard for how these associations must work. This leads to a problem in teaching this information. Instead of covering every possible variation of memory organization, we will focus on the most popular PLC found in the United States, Allen-Bradley (Rockwell).  The conventions to follow are all based on the methods of data handling used in the Allen-Bradley SLC-500 PLC. If you are using a different PLC, you can continue to follow along, but their may be some differences and you may find it helpful to consult with that specific manufacturer’s reference material.

Allen Bradley (Rockwell) PLC Software

If you are interested in following along in this section, we have a free download of Allen Bradley Software that is used in our PLC programming instructional course. You can find the files and installation instructions at this link. After downloading the software, you will be able to dig through the memory as we cover each section.

Memory Organization for Allen-Bradley SLC-500 PLC

Memory organization of SLC500 PLC. Courtesy of Rockwell Automation

Memory in the Allen-Bradley SLC-500 is broken into files. These are not the type of files you may be familiar with. The term file here does not correspond to a file like a spreadsheet, or word document. Instead file in this context means a block of memory used to store a particular type of data.

You will notice in the above image, that under the data files section, files 0 and 1 correspond to the output file and input file respectively. This is where you will find your discrete outputs and discrete inputs.

Were sorry… You’ve reached the end of this article… so far. We are actively writing the rest of this and it will be available soon. Please check back for an update in the next few days. Thank you for your patience!

Post Author: CSA Admin

2 Replies to “PLC Programming Basics Part II”

Leave a Reply

Your email address will not be published. Required fields are marked *