What Everybody Ought to Know About PLC Programming Languages

PLC programs are normally written in a special application on a personal computer, then downloaded to the PLC. This downloaded program is similar to compiled code to keep the program efficient. The program is stored in the PLC either in battery-backed-up RAM or some other non-volatile flash memory.

Albert Einstein said “The world as we have created it is a process of our thinking. It cannot be changed without changing our thinking” PLC programming languages have evolved to both adapt and change the way we program these units. We will look at all five programming languages as defined by the IEC 61131-3 Standard.

  • Structured Text (ST)
  • Function Block Diagram (FBD)
  • Sequential Function Chart (SFC)
  • Instruction List (IL)
  • Ladder Diagram (LD)

Not all of these programmable controller languages are available in every PLC. Ladder logic programming is by far the largest percentage of use in PLC’s today. Fundamental concepts of PLC programming are common to all manufacturers. Differences in I/O addressing, memory organization, and instruction sets mean that PLC programs are never interchangeable between different makers. Even within the same product line of a single manufacturer, different models may not be directly compatible. This is true when looking at manufactures that private label other controllers.

Estimates are as high as 95% of installations use ladder logic programming in the programmable logic controller.

The PLC programming language that is used can be decided when you look at the following:

  • Maintenance and troubleshooting
  • Knowledge of language
  • Acceptance of the country, location, or individual plant
  • Application of the PLC
  • Ease of changing PLC program

The actual programming of the PLC is the second last step in the development of programs. The five steps to PLC program development is a good method to follow before picking what programming language to use. As mentioned before the languages supported by each PLC may differ. Please refer to the types of programming that are available for your model and version of PLC.

Let’s quickly review some of the different programming languages for the PLC.

Structured Text (ST) is a high level programming language that closely resembles Pascale programming. Statements are used to define what to execute.

Function Block Diagram (FBD) is a graphical representation of AND, NAND, OR, NOR gates, etc. that are drawn. It will describe the function between input and output variables.

Sequential Function Chart (SFC) is like a flowchart of your program. It defines the steps through which your program moves.

Instruction List (IL) can also be referred to as mnemonic code and statement list. It contains simple instructions for looking at your variables.

Ladder Diagram (LD) is the most popular programming language for the PLC. It was written to mimic the mechanical relays in the panel that the programmable logic controller replaced. It has two vertical rails and a series of horizontal rungs between them. Controllers will usually scan from left to right top to bottom. The output of one rung is available for the next rung.

Note: All pictures from PLCopen IEC 61131 Basics

PLC programming methods are evolving. PLC Open is an organization that is defining new methods to take advantage of the latest computer innovations. They have defined the IL method of programming to XML (Extended Markup Language) which is used for web development. This in my opinion keeps moving the ideal method, to a standard way to program PLCs.

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

PLC Programming Example – Paint Spraying

We will look at a PLC basic tutorial of a paint spraying station. Following the 5 steps to program development this PLC programming example should fully explain the procedure for developing the PLC program logic. Ladder will be our PLC programming language.

We will be using the Do-more Designer software which comes with a simulator. This fully functional program is offered free of charge at automation direct.

Define the task:

What has to happen?

Paint spraying system where boxes are fed by gravity through a feeder magazine one at a time onto a moving conveyor belt. Upon the start signal, boxes are pushed towards the conveyor by valve 1. This is a cylinder which extends and retracts which operates switches S1 and S2 respectfully. A spraying nozzle paints each box as it passes under the paint spray controlled by valve 2. A sensor (S3) counts each box being sprayed. When 6 boxes have been painted the valve 2 shuts off (paint spray) and valve 1 (cylinder) stops moving boxes onto the conveyor. Three seconds later the conveyor stops moving and the hopper with its load moves forward (valve 3) where it is emptied. Ten seconds later the hopper returns to the original position. The cycle is then complete and waits for a start signal again.

Define the Inputs and Outputs:

Inputs:
Start Switch – On/Off (Normally Open) – NO
Stop Switch – On/Off (Normally Closed) – NC
S1 – Valve 1 (cylinder retract) On/Off – NO
S2 – Valve 1 (cylinder extend) On/Off – NO
S3 – Box Detected- On/Off – NO
Outputs:
Motor – On/Off (Conveyor Run)
Valve 1- Cylinder to feed boxes – On/Off
Valve 2- Paint Spray – On/Off
Valve 3- Cylinder to move hopper – On/Off

Develop a logical sequence of operation:

Fully understanding the logic before starting to program can save you time and frustration.

Sequence Table: The following is a sequence table for our paint spraying application.


1 – Input / Ouput ON
0 – Input / Output OFF
x – Input / Output Does not Matter
When power goes off and comes on the sequence will continue. This means that we must use memory retentive areas of the PLC. The stop pushbutton will stop the sequence. The start will resume until the end.

Develop the PLC program:

The best way to see the development of the programmable logic controller program is to follow the sequence table along with the following program. You will see the direct correlation between the two and get a good understanding of the process.

This is the main process start and stop bit. V0:0 is used because it is memory retentive.

Control of the Motor (Conveyor) and the paint spray is done with the V0:0 contact in front of the actual PLC output. The conveyor and paint spray will stop when the timer 0 is done. This is the delay after the last box is detected to allow the box to be painted and loaded onto the hopper.

Control of the box movement onto the conveyor. As long as we have the process start and the hopper count is not complete this will allow the cylinder to put boxes on the conveyor.

Count number of boxes in the hopper via S3. The counter is memory retentive.

Timer to stop the conveyor and spray after the last box is detected for the hopper. This will allow time for the box to be sprayed and loaded into the hopper.

Hopper movement to load and unload the boxes.

The hopper unload timer is to unload the boxes and will then trigger the reset conveyor timer, box counter and the process start bit (V0:0).

Test the program:


Test the program with a simulator or actual machine. Make modifications as necessary. Remember to follow up after a time frame to see if any problems arise that need to be addressed with the program.

Watch on YouTube : PLC Programming Example – Paint Spraying
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.