# Understanding different programming techniques

In our previous articles, we looked at PLC systems and what they are, as well as their interface requirements. Now we’re going to look at the different programming techniques we can use in a PLC system.

## PLC programming

A PLC program is a set of instructions representing the logic that governs the process the PLC is controlling. There are two main classifications of PLC programming languages.  These can be divided into sub-classifications:

1. Textual Language
• Instruction list
• Structured text
2. Graphical Form
• Function Block Diagram (FBD)
• Sequential Function Chart (SFC)

While all of these can be used, graphical languages are generally preferable.  We’re going to look at some of these languages now.

This is the simplest form of PLC programming.  It’s also known as ‘relay logic’.  The relay contacts used in relay controlled systems are represented using ladder logic.  The image below shows a simple example of a ladder diagram:

In this example, two pushbuttons are used to control the same lamp load. When any one of the switches is closed, the lamp will glow.  The two horizontal lines are called rungs and the two vertical lines are called rails.

Every rung forms the electrical connectivity between Positive rail (P) and Negative rail (N). This allows the current to flow between input and output devices

## Functional Block Diagrams

A Functional Block Diagram (FBD) is a simple graphical method to program multiple functions in a PLC.  A function block is a program instruction unit that yields one or more output values when executed.

It’s represented as a rectangular block with inputs entering on the left, and outputs leaving on the right.  It shows a relationship between the state of the input and output.

The advantage of using FBD is that any number of inputs and outputs can be used on the functional block. When using multiple input and outputs, you can connect the output of one function block to the input of another.

The figure below shows a ladder diagram and its function block equivalent in Siemens notation.

## Structured Text Programming

This is a programming language that uses statements to determine what to execute.  It follows more conventional programming protocols but it is not case sensitive.  A series of statements (logic) consists of expressing assignments and relationships using several operators. The structure’s text operators are listed in the image.

Many early PLCs were not capable of graphical representation of the logic, so it was instead represented as a series of logical expressions in a Boolean format

As programming terminals evolved, it became more common for ladder logic to be used because it was a familiar format used for electro-mechanical control panels. More modern formats, such as state logic and Function Block diagrams, exist, but they are still not as popular as ladder logic.  A possible reason for this is that programmers prefer the more visual appeal of ladder logic over structured text programming.

Until approximately the mid-1990s, PLCs were programmed using proprietary programming panels or special-purpose programming terminals, which often had dedicated function keys representing the various logical elements of PLC programs. Some proprietary programming terminals displayed the elements of PLC programs as graphic symbols, but plain ASCII code representations of contacts, coils, and wires were common.

Keep an eye out for our next articles, where we’re going to dive even further into Programmable Logic Controller systems and their uses.

### Interested in our courses?

You can read more about our selection of accredited online electrical and electronic engineering courses here.

Check out individual courses pages below:

Diploma in Electrical and Electronic Engineering

Higher International Certificate in Electrical and Electronic Engineering

Diploma in Electrical Technology

Diploma in Electronics

Diploma in Renewable Energy (Electrical)

Higher International Diploma in Electrical and Electronic Engineering

Alternatively, you can view all our online engineering courses here.

## Recent Posts

### Unleashing the Potential of Online Engineering Courses: Embracing Flexibility and Open Access

Unleashing the Potential of Online Engineering Courses: Embracing Flexibility and Open Access Introduction In recent years, the landscape of education has undergone a significant transformation with the rise of online learning platforms. Among the various fields benefiting from this shift, engineering education stands out as a prime example. Today, more students are turning to online […]

### How do we test and debug our PLC code?

How do we test and debug our PLC code? In our previous articles, we dived into PLC systems, how they work, and how we can program them to carry out tasks.  Now let’s find out how we can test and debug this programming to make sure everything runs correctly. PLC start-up Before we turn on […]

### What are logic functions and how are they applied?

What are logic functions, and how are they applied? In our previous article, we dived into PLC Programming techniques. In this article, we’re going to check out logic functions and how they are applied to PLC systems. What is a PLC timer? A PLC timer is an instruction that controls and operates the device for […]