hpr4718 :: Programmable Logic Controls - Episode 2

A brief overview of industrial control systems.

Hosted by Whiskeyjack on Wednesday, 2026-09-02 is flagged as Clean and is released under a CC-BY-SA license.
technology. (Be the first).

Listen in ogg, opus, or mp3 format. Play now:

Duration: 00:30:54
Download the transcription and subtitles.

general.

--------------------

01 Introduction

This is the second episode in an 8 part series.

02

In the previous episode we discussed the predecessors of PLCs, in particular relay logic.

In this episode we will discuss how relay logic came to be expressed in software rather than in actual hardware components.

03

The topics to be covered include

* Early computers in industry.

* The first PLC.

* PC versus PLC - what's in a name.

* Who the major brands are.

* What does a PLC actually look like.

* Machine architecture.

* PLC programs.

* The scan.

* PLC programming languages.

* Relative popularity of PLC programming languages versus more conventional computer programming languages.

--------------------

04 Early Computers in Industry

Computers came to be used in industry fairly early on.

Minicomputers were used in some large industries to control things like electric power plants.

For example, the DEC PDP8 was used to control the refuelling machines in CANDU nuclear power plants.

These would load and unload fuel from the reactor, which happens continually on a daily basis while the reactor is running.

05

The first microprocessor based computer sold on the commercial market was the MICRAL from France, based on the Intel 8008.

It was sold as a cost effective replacement for minicomputers used in industry.

It preceded what are generally considered to be the first Personal Computers.

So you can see that industry were not reluctant to adopt new technology.

06

However, mini computers were large complex systems that did not fit well into a factory floor.

They had particular niches in very large complex integrated systems, but were not suited to controlling many individual machines in a factory that produced things like automobiles or appliances.

07

What was needed was something that would fit into a standard electrical enclosure,

withstand the temperatures found in a factory,

could stand up to vibration and noise,

was tolerant of voltage fluctuations,

interfaced directly to sensors and actuators,

and could be readily programmed by engineers, technicians, and tradesmen who were familiar with the processes to be controlled, but had little or no experience with computers.

08

This required a complete integrated package covering hardware, software, and product distribution through industrial supply retailers.

Something that could meet these criteria is what was needed to become the PLC.

--------------------

09 History

Many histories point to a US developer that became Modicon.

However, their first hardware was more a proof of concept than a viable commercial product.

In fact multiple companies in the US, Europe, and Japan were working on the problem and released comparable products all at around the same time in the early 1970s.

10

The idea preceded the implementation by a number of years.

For example, General Motors had asked industrial control equipment suppliers in the mid 1960s for some sort of programmable control device to replace relay logic.

This showed potential suppliers that there was a market for this sort of thing, and gave them a clearer idea of what customers were looking for.

11

What made this possible was the development of the first 8 bit microprocessor in that time period, combined with readily available bit slice processors from the minicomputer industry and other components.

12

People knew what to do, the problem was waiting for the development of suitable component hardware.

Minicomputers were already being used in industry, but were normally located in control rooms.

PLCs were an effort to take that technology out of control rooms and put it on the shop floor.

13 PC Versus PLC - What's in a Name

In the early days, these systems were known as either PLC, which means "Programmable Logic Controller", or PC, which means "Programmable Controller".

Different vendors favoured different terminology, but both were common.

I have a book which was at one time one of the standard reference handbooks for this industry which was published in 1989, and refers to them as Programmable Controllers, or PCs.

14

The term PC was also used to mean "Personal Computer", but that wasn't really a problem in the early days.

However, a certain large company decided to call their entry into the personal computer market the "IBM PC", and suddenly "PC" became a generic term for desktop computers.

15

After a long struggle to keep referring to their products as "PCs", even the biggest vendors caved in and gave up the fight and switched to using the "PLC" term.

I will therefore use the term "PLC" in this podcast series even when talking about products which were originally called "PCs" at the time they were introduced.

16 Who the Major Brands Are

The companies that came to dominate the industry fairly early on were generally companies that already made industrial electrical hardware.

These were

Siemens

Allen Bradley, later known as Rockwell

Schneider

Mitsubishi

Omron

17

These are still the dominant companies in the business, although there are many small brands, particularly at the cheaper end of the market.

All of them were suppliers of a wide range of industrial control hardware, such that you could build all or nearly all of the parts of your control system using only their products.

18

Each of these sells an integrated hardware and software package, including development software, that is completely proprietary.

If you thought that the mainframe business had a lot of vendor lock-in, you haven't seen the industrial market.

--------------------

19 What Does One of These Things Actually Look Like?

At this point you are probably still very confused as to what a PLC actually is.

I will attempt to describe one in basic terms by giving an example of one.

The smallest and simplest ones are what are termed "shoebox" PLCs.

These are basically a rectangular box with a plastic case.

20

Here are the dimensions for a typical low end model, a Mitsubishi FX3U-32M.

According to specs in the manual, it is 150mm wide, 90mm high, and 86mm deep.

21

It can be mounted to the panel in an electrical enclosure by snapping it onto what is termed a DIN rail.

DIN rails are standard mounting systems which use a strip of metal which is U shaped with a lip at the top of each end of the U.

You screw the DIN rail to the electrical panel in the enclosure, and most industrial components such as PLCs, terminal blocks, circuit breakers, and all sorts of other things will simply snap onto it and be ready to wire together.

22

Along the top and bottom of the PLC are terminals to which you can attach wires from the things you want to sense or control in the rest of the machine, such as push buttons, pilot lights, proximity sensors, and valves.

23

Inputs are along the top, and outputs are along the bottom.

The FX3U-32M has 16 inputs and 16 outputs.

These I/O can be 24 volts DC, or 100 to 120 volts AC, depending on the model.

Alternatively it may have small relays for outputs.

While AC I/O once predominated, 24VDC became the standard in most industries several decades ago as it interfaced with electronic devices more readily and also allowed for cheaper and more compact wiring.

24

More inputs and outputs can be added by connecting additional I/O modules to the main PLC next to it on the same DIN rail, up to a total of 256 I/O

The connection is typically via short ribbon cables which plug into the adjacent module.

These I/O modules look like the main PLC, but just add I/O.

25

Inside the PLC are a CPU, memory, and firmware.

This model has 64K "steps" of memory, which can be thought of as how many instructions you can have.

The program runs in RAM, but you can add a small flash memory device to save the program to.

There is a run/stop switch that allows you to start or stop the user program.

There is a port that you can use to connect the PLC to a laptop computer with a cable so you can download your program to it.

26

The biggest part of the market for PLCs is for these "shoebox" style.

However, there are bigger ones as well which have more I/O, more memory, faster CPUs, etc.

These are meant for tasks such as coordinating large assembly lines and things like that.

These are what are termed rack systems, where the rack is an empty box which is open at the front and has a backplane bus running along the back.

You plug the main CPU into the bus, normally in the leftmost position, and then plug I/O modules into the rack.

The I/O modules are tall, thin, fully enclosed boxes with the I/O terminals along the front.

27

You should have a rough idea of their appearance at this stage, so I'll leave the physical description aside for now and go on to the concepts behind how they actually work and what makes them different from something like say a Raspberry Pi.

--------------------

28 Machine Architecture

It is not really the hardware which defines the PLC.

Rather, it is the software system architecture.

Every PLC that I am aware of has a common set of features.

29 Data Table

A data table is simply a block of memory which may or may not be subdivided into different parts.

All logic, and all, or nearly all, I/O works by writing to and reading from addresses in the data table.

30 I/O

Every input and output point maps to a fixed memory address in the PLC.

To read the state of an input, you read its memory address.

To change the state of an output, you write to its memory address.

31

These digital I/O appear as single bit boolean values.

The PLC programming language has instructions which allow single bits to be read or written to directly without have to mask off other bits as you would have to do if you were using a conventional programming language.

I have so far only mentioned digital I/O, which are single bit on/off values.

32 Other types of I/O

Many PLCs also have other types of I/O such as

Analogue I/O, which represent variable voltages rather than just on/off values.

For example you may wish to read a temperature from a thermocouple where the voltage level varies with the temperature.

Often these are mapped into the data table as byte or word values.

33 Internal Bit or Boolean Memory

There will be a range of single bit or boolean memory which is used for internal logic state.

Your program may need to come up with a series of intermediate logical values, and you store them in these internal bits or flags.

34 Timers and Counters

Control of machinery often involves timing and counting.

Timer and counters are mapped into the data table.

Timer and counter presets and values can be read as words, and there will be bit addresses which indicate the status of the timer or counter, such as whether it has reached its preset and is "done".

35 Integer and Floating Point Values

There will be word addresses where integer and floating point words can be stored.

If you need to do some mathematical calculations and store the results, you would save them in an integer or floating point word.

36 Typed Memory

Unlike when programming something like a PC where you simply have a range of undifferentiated bytes and it is up to your software to impose meaning on it, PLC data table memory has defined types and meanings and the system firmware enforces the correct memory access methods.

37 Size of Data Table

Data tables vary greatly in size.

A bigger data table allows for bigger and more complex program.

Generally, new PLCs will have bigger data tables than older ones,

and more expensive PLCs will have bigger data tables than cheaper ones of the same generation.

38 Example

Having picked a current PLC as an example for physical dimensions, I will pick an old and obsolete one for an example of a data table.

The Siemens S5-100 series was a small PLC that came in several sizes.

The basic S5-100 had the following data table size.

39

Digital I/O had a maximum of 128 inputs and outputs taken together.

Analogue inputs and outputs had a maximum of 8 taken together.

Flag, or bit, memory was 1024

Timers - 16

Counters - 16

40

The S5-103 offered more of everything in the same basic package, but of course at a higher cost.

Digital I/O had a maximum of 256 inputs and outputs taken together.

Analogue inputs and outputs had a maximum of 32 taken together.

Flag, or bit, memory was 2048

Timers - 128

Counters - 128

--------------------

41 The PLC Program

A PLC will come with what amounts to an operating system and virtual machine built into it.

You as the programmer use the vendor's proprietary development software, what is generally called the "PLC programming software" to write an application for it.

42

You then connect your PC to the PLC using a cable of some sort, and download your program into it.

The program gets stored in the PLC's RAM.

There may be flash memory which serves to back up the RAM when the power is off so you don't lose the program.

Before flash was available, a battery was typically required to hold the static RAM memory.

43

There is just one program in the PLC.

There is no file system, just the program memory and the data table.

When the PLC starts up, it runs the program that you wrote.

It continues running the program until you turn off the power or you set the run/stop switch to the stop position.

44

I will come back to programming later, but we needed to cover these basic points before I could describe some further concepts we need to cover.

--------------------

45 The Scan

A key thing to understand about PLCs is the "scan" concept.

This works as follows.

There is a repeated cycle called the scan.

46

First, the PLC reads all the physical inputs and updates the corresponding input addresses in the data table.

Next it runs the user program once.

Finally it reads the output addresses in the data table and writes them to the corresponding physical outputs.

Then it repeats the scan from step 1.

47

A scan can take anywhere from a few milliseconds to hundreds of milliseconds, depending on the model of PLC.

Older PLCs and cheaper PLCs tended to be slower.

However, as integrated circuit technology advanced, programs got faster.

48

The PLC has a watchdog timer.

This is a timer which runs in the background and resets at the start of a scan.

49

If a scan takes too long, the watchdog will trip and stop the program and set the outputs to some defined state, either turning them all off or holding them at the last value.

This is known as "faulting" the processor.

50

A watchdog fault may be caused by a program that is too long, or uses a lot of very slow instructions, or in some cases it may be due to a bug in your program.

However, this last cause is not as common or as easy to cause as you may think when it comes to faults.

--------------------

51 PLC Programming Languages

The key to all of this is the unique way in which the programming languages used in PLCs work.

I will first briefly describe the two main programming languages and then explain how they work in a PLC as part of a complete system.

52 Ladder Logic

There are several programming languages, but the main one is called ladder logic.

If you listened to the previous episode, the word "ladder" will ring a bell.

When machines were controlled by electromechanical relays, the electrical drawings which specified and documented the types of relays and the connections between them were called "ladder diagrams".

53

PLCs simply take these ladder diagrams and reproduce them on your computer screen in the programming software using the same standard schematic symbols.

54

You do not need to draw the symbols like it was CAD.

Instead you simply use your keyboard or mouse to say that you want this symbol to be entered in the current cursor location or you want this wire to be connected from here to there.

When your rung is complete the software will check at some point if it is syntactically correct.

You then go on to entering the next rungs one after another until you have your complete program.

55 Instruction List

An alternative representation is something called "instruction list", although various vendors may use other terms.

This is a text representation that looks like a sort of assembly language.

However, it's actually really ladder, just shown in a different way as text and some types of programming software will allow you to toggle between ladder and instruction list mode, translating between them automatically.

56

This should give you a clue as to how a PLC can execute a schematic diagram.

Behind the scenes the programming software will translate the diagram into instruction list, and then the PLC will either execute those instructions in an interpreter, or compile them to machine code and execute those.

57 Other Programming Languages

There are other programming languages, but they are rarely seen.

I won't go into detail in terms of describing them, just briefly mention them.

58

One is called Sequential Function Chart.

This is a type of flow chart which is designed to show complex sequences, including ones with alternate or parallel paths.

The original name for this is Grafcet, spelled G R A F C E T.

This stands for "Graphe Fonctionnel de Commande Étape Transition".

As well as being a programming language, it is also a very good design and analysis tool even if the PLC being used doesn't support it.

59

Another is Function Block Diagram.

This is another graphical language which resembles flow diagrams used in process industries.

This is supposedly used mainly in industries such as chemical manufacturing.

However it appears to be very niche and most people who use PLCs will never have seen it, and many will not have even heard of it.

60

Yet another language is Structured Text.

This is very obviously derived from Modula-2 and strongly resembles it.

If you are not familiar with Modula-2, it was created by Nikolas Wirth and intended as the successor to Pascal, which it was derived from.

Structured Text seems to be much loved by a small number of academics, but seems to have little actual use in the field.

You lose pretty much all of the monitoring and debugging facilities built into a PLC if you use it, so it's kind of pointless except perhaps for a few niche applications.

There are a few other languages as well, mainly proprietary ones, often using flow charts or the like.

61 PLC Languages are Non-Blocking

The important thing about a PLC program is that it executes from top to bottom, left to right, without stopping or blocking.

There is no waiting on input or output or for a system call to return.

Each rung immediately yields a result which is written to a memory address or which enables a timer or counter.

Every rung is executed every scan.

62

You can reproduce this in a traditional computer programming language.

In ladder logic it is inherent to the syntax and it is either very difficult or impossible to do it any other way.

I'll give an example in Python of what I mean.

63

a = (b or c) and not d

64

If b or c are true and d is false, then a is set to true.

If b and c are false or d is true, then a is false.

65

Now imagine that we are not executing this statement once, but rather are executing it repeatedly.

This statement will never block execution.

It will always immediately yield a result.

Now let's modify that a bit.

66

a = (b or a) and not d

67

Note that we have replaced c with a.

Now the value of a depends the previous value of a as well as b and d.

However, once a becomes true, the value of b no longer matters because b is in an or condition with a.

Now if we execute it over and over again, only d becoming true will make a go false.

68

This is a standard push button circuit, also known as a "seal in circuit", because it "seals" around the start condition.

69

b is the start push button with a normally open contact.

d is the stop push button with a normally closed contact.

a is a relay with one of its contacts being used to hold it on.

70

If you wired this up with actual push buttons and relays or if you programmed it into a PLC with ladder logic it would work the same way.

A PLC program will consists of rung after rung of logic like this and executes it repeatedly scan after scan, only pausing to update its I/O.

71 Async Programming

Some of you may be thinking that this cyclical scan sounds like the async programming that is all the rage with web server applications these days.

Essentially it is exactly the same principle.

72

With async programming, your program must never use blocking instructions and execution proceeds on a repeated cycle.

PLCs solve this by not having any instructions which block, and many PLCs do not allow backwards jumps.

Tradesmen in coveralls in factories were doing async programming decades before the cool kids heard about it.

73 Most PLC Programming Languages are Visual or Graphical Languages

If ladder, Sequential Function Chart, or Grafcet and Function Block Diagram sound like visual programming languages, they are.

In fact ladder is probably one of the earliest visual languages in commercial use.

Wikipedia defines a visual programming language as:

74

In computing, a visual programming language (visual programming system, VPL, or, VPS), also known as diagrammatic programming, graphical programming or block coding, is a programming language that lets users create programs by manipulating program elements graphically rather than by specifying them textually. A VPL allows programming with visual expressions, spatial arrangements of text and graphic symbols, used either as elements of syntax or secondary notation. For example, many VPLs are based on the idea of "boxes and arrows", where boxes or other screen objects are treated as entities, connected by arrows, lines or arcs which represent relations. VPLs are generally the basis of low-code development platforms. Scratch is an example of a VPL

75

End of quote.

As you can see, what is cool today was on the factory floor more than 40 years ago.

--------------------

76 Popularity of PLC Programming Languages

PLCs are about as proprietary as you can get.

Pretty much every vendor has his own proprietary take on each language.

How you can program any particular PLC is determined by that vendor's programming software.

If the vendor doesn't support it, you can't use it.

An individual vendor may even have multiple incompatible product lines which have to be programmed in different ways with different software, although that is not as common these days as it once was.

77

Nearly all PLCs support programming in Ladder.

Some support programming in instruction list as well as ladder.

Anything else is much less common.

78

Ladder logic happens to be on the Tiobe Index by the way.

For those who have not heard of it, the Tiobe Index, that is T I O B E, is a web site that lists the popularity of numerous programming languages based on various criteria.

79

Number one on their list happens to be Python, currently at 19.98%.

Number two is C, at 11.55%.

80

At the time of writing this script, Ladder Logic was at number 46 with a 0.28% rating, which put it just below Erlang and just above Haskell.

I'm not sure whether that means that Ladder Logic is not as obscure as you thought it was, or whether it means that Erlang and Haskell are in fact more obscure than you thought they were.

--------------------

81 Episode Summary

In this episode we covered we covered

The early history of computers in industrial control

The early history of PLCs, including how they got their name

Who the major brands are

What they look like physically

82

A basic description of the abstract machine architecture

A very brief look at what a PLC program is like

The scan concept

The main PLC programming languages

The minor PLC programming languages

The relative popularity of each of the programming languages

83

In the next episode we will take a look at one of the early PLCs from the era when they began seeing widespread use.

This PLC was hugely successful and was for many companies the first PLC they used.

This is the Allen Bradley PLC2.

84

This has been the second episode in an 8 part series.

--------------------


Comments

Subscribe to the comments RSS feed.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the letter P in HPR stand for?