What is a PLC?

If you’re considering a career in Industrial Automation, you are probably starting to hear a lot about PLC’s. If you haven’t worked with PLC’s before, they might seem a bit mysterious; you might be wondering what a PLC is, exactly. Let’s shed some light on the topic for you below.

What exactly is a PLC? A PLC, or Programmable Logic Controller, is a computer that is used for processing inputs and setting outputs. When I say “computer” in this context, I don’t mean what we typically think of when someone says “computer” – although a PC can function as a PLC with the right software.

A PLC is (typically) a computer in the more general sense – it is a microprocessor that is connected either directly or via an industrial network to some inputs and outputs, and it is programmed to evaluate the inputs and set the outputs in such a way that it facilitates the execution of some process. In other words, it is a processor, similar to the one in your computer, that adheres on a very basic level to the “IPO Model“: it accepts inputs, performs processing, and sets outputs.

Huh?

Try to think of it this way – a factory is, in a sense, a giant machine that takes in a lot of parts and turns those parts into some product or family of products. Within the factory, there are some number of automated production lines, with each line performing some process on the parts.

On some lines, robots may move parts around so that other robots can weld them together. Some lines may have stations where operators use special equipment to install fasteners in each part before it moves to the next station. Some lines may simply convey parts to another area of the facility. In any of these cases, think of individual automation lines as large machines themselves; they perform some custom function within the factory to contribute to the assembly of the final product. Generally, they turn some combination of parts into a larger sub-assembly.

Are you ready to take the next step in your industrial automation career?

The Industrial Automation Connection’s goal is to help you connect with opportunities to advance yourself.


Let us put you in touch with organizations that are looking for people like you.

This service is always free, and it takes only a few moments to register. Click one of the buttons below to get started!

PLC’s run the show

PLC’s are the brains of these machines, much like your car’s ECM is its brain. In fact, in many regards, an ECM is to a car as a PLC is to an automation line in a factory – an ECM is, effectively, a PLC for your car.

  • An ECM accepts inputs from the vehicle, such as:
    • Crankshaft position
    • Oxygen sensor feedback
    • Intake airflow
  • The ECM then performs calculations using the input data, to provide appropriate outputs:
    • Injector duty cycle
    • Throttle control
    • Valve control
An Engine Control Module, or ECM, from a Volvo.
Vroom, vroom. Image credit.

I guess the list above is most relatable if you have a bit of automotive knowledge. Here’s another comparison that might be more broadly intuitive:

  • A home automation hub accepts inputs from sensors in your home, such as:
    • Motion sensors
    • Smart buttons
    • Voice input
  • The home automation hub processes those inputs in accordance with how you have it set up, and then provides appropriate outputs:
    • Turning lights on and off
    • Playing music
    • Closing the garage door

While both comparisons are reasonable, there is one manner in which both examples are significantly different from PLC’s:

ECM’s and home automation hubs come pre-programmed from the manufacturer. Their programming is pre-determined and, while there may be features that you can set up or configure at the user level, the code that the processors are executing is generally not editable.

PLC’s, on the other hand, are blank slates – they are putty in your hands, so to speak, for you to program however you need, in order to control your automated processes.

What do you need to have to be able to program a PLC?

In order for a PLC to do the incredible job of controlling equipment, you must provide it with the programming instructions, or “logic”, that brings your process to life. As a broad statement, you will need the following to connect to and program a PLC:

  • The PLC, with its power supply and any necessary accessories
  • A PC or programming terminal with the PLC vendor’s software
  • A means of communication between the terminal and PLC

Varieties of PLC’s

PLC’s come in all shapes and flavors, from this relatively affordable Electrodepot PLC to this Siemens PLC that can cost a few thousand dollars – which is the refurbished price, by the way. This Siemens NCU is just one example of a high-end PLC – as far as pricing for the cream of the crop, a few thousand isn’t even the upper bound.

There are many, many categories in which PLC’s can differ, but here are some noteworthy parameters:

  • Physical type (stand-alone, modular, or rack-mounted)
    • What are the PLC’s capabilities for expansion?
    • What types of accessories are available in this PLC’s product family?
  • Number of inputs and outputs accepted
  • Protocols supported
    • Does the PLC only accept “discrete” (wired) I/O?
    • Does the PLC support advanced fieldbus protocols like DeviceNet, Profibus, or Ethernet/IP?

PLC Software

Vendor-specific software is an important consideration when choosing a PLC platform, if for no other reason than differences in price:

  • Some vendors include their PLC software at no additional cost
  • Allen Bradley/Rockwell Automation PLC’s, on the other hand, require licensing to use their software – to the tune of $1,000’s for an annual license
An example of ladder logic depicted within RSLogix 5000, PLC programming software for Rockwell Automation equipment.
Rockwell Automation’s RSLogix 5000

Communicating with the PLC

Just as there are many different types of PLC’s, communicating with the PLC can mean many different things depending on what PLC you’re using:

  • Some PLC’s have programming ports that you can hook up to via a USB cable
  • Some require proprietary (read: expensive) programming cords that are vendor-specific
  • Many modern PLC’s can be programmed via an industrial network; like your router at home, you can connect to the PLC over Ethernet cabling.

What language is used for PLC programming?

Trick question? There are multiple languages that are used for PLC programming, but the most common is “ladder logic”, the technical nomenclature for which is actually “Ladder Diagram”. Two other common PLC programming methods are Function Block (or Function Block Diagram) and Structured Text.

Ladder Logic

Shown in the image above), ladder logic is the most common PLC programming method. Ladder logic is highly visual, and shows the truth of each instruction via visual indicators on the programming interface. Once you learn the meaning of a small group of instructions, you’ll be able to start reading and understanding simple bits of ladder logic.

The “ladder” in ladder logic comes from the appearance of the visual interface. Reminiscent of relay systems, ladder logic shows “energized” vertical bars on the left and right side of the screen, with each line of logic represented as a literal horizontal line – or “rung” – extending between the two vertical bars. Multiple “rungs” on the screen are visually similar to a ladder, hence the name.

Despite the high-level, visually simple nature of ladder logic, modern interfaces are extremely powerful and permit essentially any function of the PLC to be leveraged.

An example of ladder logic shown in RSLogix 5000, PLC programming software for Rockwell Automation PLC's.
Ladder logic. Instructions that are true are highlighted green. If enough true instructions on a rung form a path from the left of the screen to the right, the output on the right side of the rung will be turned on by the PLC.

Function Block Diagram

Function Block Diagram, or Function Block, is another visually representative programming interface. With function block, instructions are laid out like landmarks on a map, with inputs and outputs from each instruction branching out like roads to connect to other instructions. Function block can help to visualize a process and its inputs and outputs.

Many of the basic building blocks of ladder logic are available when using function block. These basic functions include comparative operators (equal to, greater than, etc.), counters (increment or decrement a count whenever X occurs), timers, and many more.

Like many ladder logic interfaces, you can develop your own instructions in function block. Creating custom functions allows you to reuse logic when applicable to multiple devices or programming contexts.

An example of Function Block logic.
A small example of Function Block. Image Credit.

Structured Text

A third method of PLC programming is Structured Text. For those familiar with computer programming, structured text will seem very familiar. Similar to high-level programming languages such as BASIC, structured text allows the user to write code to control the PLC.

In the PLC world, it’s important to consider how much trouble it will be for other people to deal with your logic when something isn’t working. Because structured text is less visual than either ladder logic or function block, it may not be as readily accessible to technicians who don’t have experience with the type of computer programming of which structured text is reminiscent.

No logic is immune from future debug when the equipment fails. As such, you want your PLC programming to be easy for others to read and understand. For this reason, I prefer a more visual interface than that offered by structured text, if only to make my logic accessible to a larger portion of the people who might have to debug it.

How can I learn more about PLC’s?

Three ideas come to mind for how you can start learning more about PLC programming:

  1. Attend formal training for PLC programming
    • Colleges offer degree programs such as Industrial Automation and Mechatronics that provide formal training in PLC programming
    • Certain skilled trades apprenticeships (including many electrician apprenticeships) will also require formal study of PLC programming
  2. Find PLC programmers in your network, on LinkedIn, or in other forums who may be willing to tell you a bit about the industry and what to expect
  3. Buy your own PLC and start experimenting to build your skills
    1. Get yourself an inexpensive Arduino starter kit and start building projects that will help you understand the Input, Process, Output Model
      • Arduino is not technically considered a PLC, but, basically, it’s an entry-level PLC
      • One drawback with Arduino is that you won’t be using ladder logic; it’s programmed with C
      • Many of the other experiences with Arduino will be identical or directly analogous to PLC programming
        • You will set up inputs such as sensors and switches
        • You will write logic that will handle or take action based on the inputs
        • Your logic will set outputs to turn on lights, activate motors, etc.
      • Another nice thing about this kit is that it comes with a slew of sensors, lights, resistors, etc., and a project guide
    2. If you have the money, fork over the dough for something like the Electro Depot or EZRack PLC starter kits
      • These kits will provide a very realistic experience, using their vendor-specific software to program in ladder logic
      • Both of these kits have simulation functions, allowing you to experiment with your logic without needing a ton of extra equipment
An Arduino Uno, a programmable controller used for prototyping and learning more about programming controls.
(aftermarket) Arduino Uno

Tell Us About It

We hope the information above will help you in understanding some of the basics regarding PLC’s. Where are you at in your own journey? Are you considering a career in industrial automation or specifically as a PLC programmer? Let us know in the comments.

User-Defined Data Types in RSLogix 5000

If you’re starting to dive into the world of User-Defined Data Types (UDT’s) within RSLogix 5000, have no fear. UDT’s are an extremely useful way to package your data and keep your tag list manageable.  Here are some of the things that UDT’s can do for you:

  • Consolidate many related data points into one tag
  • Allow you to share related data over the network with a single explicit Message instruction or Produced/Consumed relationship
  • Simplify and standardize your logic if you are adding more than one of the same device
  • Keep your tag list neat and organized
  • Slightly improve memory storage efficiency

There are a lot of big pluses to using User-Defined Data Types in RSLogix 5000. For the most part, UDT’s are easy to use, as well.  Let’s take a closer look.

Are you ready to take the next step in your industrial automation career?

The Industrial Automation Connection’s goal is to help you connect with opportunities to advance yourself.


Let us put you in touch with organizations that are looking for people like you.

This service is always free, and it takes only a few moments to register. Click one of the buttons below to get started!



Contents:

What is a User-Defined Data Type?

In RSLogix 5000, User-Defined Data Types are data structures that are defined by the programmer.  For anyone familiar with computer programming, establishing a UDT is a bit like building the fields of a class. When you create a UDT, you are establishing the data points that relate to some object or operation. UDT’s can integrate atomic data types, native structures such as CONTROL and TIMER tags, and even other UDT’s.

Let’s imagine that the ceiling fan in your living room is a device on your industrial network. You want to establish a User-Defined Data Type on your PLC to help organize the logic and data that you’ll use to control the fan.

This ceiling fan has a light kit attached; the fan has a 3-speed motor, and the lights can be dimmed.  The fan has the following inputs, which accept the following data types and values:

Fan InputData TypeMin ValueMax Value
Fan On CommandBOOL01
Light On CommandBOOL01
Set Fan SpeedDINT03
Set BrightnessDINT0255

Additionally, the fan has the following outputs:

Fan OutputData TypeMin ValueMax Value
Comm OKBOOL01
Motor ReadyBOOL01
Fan On StatusBOOL01
Light On StatusBOOL01
Fan Speed SettingDINT03
Brightness SettingDINT0255

True To Life?

While this is a fictional example, it’s somewhat true to what you might see with a typical field device. The outputs let you know the settings at which the device is operating, as controlled by the inputs.

Additionally, the fan outputs a couple of status bits, which can tell the PLC if there is a problem.  In your logic, it may be useful to check for Communications Ok and Motor Ready bits. Before attempting to operate the fan, you would check that these bits are high. Bits like these indicate that the device is communicating with the processor and is ready to operate.

Status bits of this type are common and are typically programmed at the firmware level by the device’s manufacturer. As a result, you’re often at the mercy of the device manufacturer in regards to how much help a particular status will be in regards to finding the root cause of a problem.

Creating User-Defined Data Types In RSLogix 5000

Making new User-Defined Data Types (UDT) in RSLogix 5000 is easy.  While there are a few limitations you’ll run in to here and there, I think that once you start working with them, you’ll find it simple to use this powerful feature.

To create a new UDT in RSLogix 5000:

  • Open the Controller Organizer Window, or “COW”
The Controller Organizer Window in RSLogix 5000.
The Controller Organizer Window (COW).
  • If it’s collapsed, expand Data Types by clicking the +.  Right-click on User-Defined
The context menu that pops up when you right-click on User-Defined within Data Types in RSLogix 5000.
The User-Defined context menu.
  • Click New Data Type…

Setting Up Your New UDT

And you’re off!  The first thing to do is name your UDT.  When you do so, make sure to follow any standards that your organization has set in regards to naming conventions, or consider creating your own conventions if you’re working independently.  Here is the general format that my organization uses:

Udt_Project_Application_Date

For this application, let’s establish one UDT for the outputs and one UDT for the inputs. A quick note here:  Earlier, I described the “fan inputs” and “fan outputs.” Now, we’re looking at things from the opposite perspective. In other words, the fan’s inputs will be connected to PLC outputs, and the fan’s outputs will be connected to PLC inputs. So, as you’ll see below, the “FanIn” UDT we’ll create will correlate with the “Fan Outputs” table you see above.

Given my organization’s naming standards, I’m inclined to use something to the tune of:

Udt_Environment_FanIn_20170817 and Udt_Environment_FanOut_20170817

The UDT name Udt_Environment_FanIn_20170817 shown in the Name line on the New Type... window in RSLogix 5000. This image is being used to describe the process of creating User-Defined Data Types in RSLogix 5000.

Of course, this is just one idea for how to format the name for your UDT. What format does your organization use?  Let me know in the comments section below!

Adding Elements To a UDT

Now that you’ve given a name to the UDT, it’s time to add some elements.  For now, let’s look at the FanIn UDT and add elements to correspond with our Fan Outputs above:

The FanIn UDT shown with its elements filled in.
The FanIn UDT – note that PLC inputs correspond with the device outputs.

A brief interjection:  Although I did it for purposes of consistency, note that all of my elements of type BOOL are listed sequentially, followed by elements of type DINT. Because the Boolean elements in this UDT are grouped together, it will actually require less processor memory to store these elements than it would if each were defined outside of a UDT as separate tags.

This is because the smallest memory allocation for a tag is 32 bits, even if the data type does not require the full allocation. UDT elements that are less than 32 bits can be consolidated into the same address in memory, depending on how they are ordered in the UDT’s definition.

Using Pass-Through Tag Descriptions

One nice UDT feature that you can enable or disable is the ability to pass through the overall UDT description to each element.  Note our UDT description above, “From Fan Controller.”  If you choose to leave descriptions off of your UDT elements, you can set RSLogix to use the description from the UDT itself.  Alternatively, you can set your tags to append the UDT description as a precursor to each element’s description; “Comm OK” becomes “From Fan Controller Comm OK.” This can be a useful feature to provide common text for your tag descriptions.  Here’s how to set up Pass-Through Descriptions:

  • Select Options… from the Tools menu.
Options... on the Tools menu within RSLogix 5000.
  • If necessary, click the next to the Application category to show the Display category.
  • Click the Display category.
In RSLogix 5000, in the Options... menu, the Display category is shown as a subcategory to the Application category.
  • Here, you’ll find the options to Show Pass-Through Descriptions and Append to Base Tag Descriptions.
  • Check or uncheck these settings as desired.

If you want to know more about Pass-Through Descriptions, check out this literature from Rockwell Automation.

To see what the Append to Base Tag Descriptions option looks like, let’s make a tag with our new UDT.

Creating Tags In RSLogix 5000 Using Your New User-Defined Data Type

Creating a tag using your new UDT is as easy as creating a tag using atomic data types.  We’ll follow the typical procedure using the Edit Tags window, and then take a look at the descriptions for your new tag’s elements.

  • Head to your Controller Tags (or Program Tags) from the COW.
In RSLogix 5000, Controller Tags shown within the Controller Organizer Window.
  • In the bottom-most row, type in the name for your new tag, and then type in the name of the UDT that you created under the Data Type column.  RSLogix will auto-fill the data type as you type in your UDT.
Creating a new tag in RSLogix 5000 by typing in the tag name and data type.
  • Once you’ve entered the name and UDT, click anywhere else in the Edit Tags window to add the new tag.  After doing so, you’ll see the UDT description pop up in the Description column.
Te new tag created in RSLogix using the new UDT. The UDT description comes through as the tag description.
  • Click the button next to the new tag to view its elements.  Note that the UDT description (“From Fan Controller”) is appended to the front of each element’s description.
    In RSLogix, the UDT description distributed through each of the element's descriptions in the new User-Defined Data Type.

This can be an easy way to implement common wording in the tag elements that are built from your User-Defined Data Types, while still providing specific notes for each element that identify its purpose.

One Downside to Implementing User-Defined Data Types

While there’s a lot of power in using UDT’s, there’s one hiccup you can run in to when developing and maintaining your logic.

The only problem I’ve run in to when using UDT’s is when it’s necessary to modify a User-Defined Data Type by changing or adding elements.

The problem is that to modify a UDT, you have to go offline, make your changes, and then download to the processor.

Depending on the production demands in your facility, downloading to the processor may not be an easy option for you.  In the factory where I work, for instance, I only have a window of around an hour each day in which I could do a download, and I would have to answer for any issues that delayed the next shift’s startup.

Another Method For Modifying a UDT

Another option, then, is to modify the UDT offline and then import it as a new UDT – our practice is to update the UDT name with the current date: 

Udt_Environment_FanIn_20170817 becomes Udt_Environment_FanIn_XXXXXXXX. This approach, however, has its own concerns:

Any tags that you’ve added to your logic with the old data type will have to be updated to the new data type. You could change the tag’s data type in the Edit Tags window, but again – you would then need to download.

You can simply create a new tag with the new data type, but then you would need to rename every reference to every element of the old tag to refer instead to the new tag. This could be a small or massive undertaking, depending on how many elements are used and how many tags have been created with that data type.

A third option is to update your tags offline and then import duplicate routines or programs and switch your JSR’s to reference the new routines. This has worked for me in the past, and may be the best method, depending on how many references you would need to change.

In Summary

User-Defined Data Types are an awesome feature that can help you to organize and simplify your tags and even improve your memory usage in some cases. UDT’s can also come in handy big time when sharing data with other processors on the network.

How are you using UDT’s? Is there specific information you’re looking for? Let us know in the comments below, and thanks for reading! If you’d like to continue reading in this field of knowledge, check out Atomic Data Types in RSLogix 5000.

If this post was helpful for you, go ahead and take just a few seconds below to sign up for our newsletter. We’ll keep you posted whenever new industrial automation content is available. Thanks again for reading!

Fix for RSLogix 5000 EXCEPTION_ACCESS_VIOLATION on Windows 10

When I first installed and tried to run RSLogix 5000 on my new Windows 10 laptop, I was met with the following ugly Fatal Error for an EXCEPTION_ACCESS_VIOLATION:

A pop-up dialog from RSLogix 5000 showing a Fatal Error for an EXCEPTION_ACCESS_VIOLATION.
The dreaded Fatal Error.

I searched through several forum posts and tried several solutions, but what solved the problem for me was running the program as administrator.  

To change this setting, first right-click the RSLogix 5000 shortcut and click Properties:

The RSLogix 5000 icon on a desktop with its right-click Context Menu shown and Properties highlighted.

In the Shortcut tab, click Advanced…

The RSLogix 5000 Properties dialog. The Shortcut tab is shown with the Advanced... button highlighted.

Check Run as administrator, then hit OK on both dialogs to commit the changes.

The Advanced... dialog. Make sure Run as Administrator is checked.

For me, this was all it took to fix the RSLogix 5000 EXCEPTION_ACCESS_VIOLATION on Windows 10!  Still having issues? Leave a comment with your situation, or check out this forum post on PLCS.net for some other things to try.

Are you ready to take the next step in your industrial automation career?

If so, the Industrial Automation Connection is here to help connect you with opportunities to advance yourself.


Let us put you in touch with organizations that are looking for people like you.

With IAC, this service is always free, and it takes only a few moments to register. Click one of the buttons below to get started!


Was this post helpful for you? Take just a few seconds below to sign up for our newsletter, and we’ll keep you posted whenever new content is available. Thanks for reading!