Loading local progress…
Get started
Practise in
Level 1, 0 XP · your progress
All chapters
Chapter 9 of 12: show all chapters

Chapter 9 of 12Part 3: Writing the rules · 4 min

Your first line of PLC code

Code is just a rule written in a short, strict way that a PLC can read. Here is your first line, one piece at a time.

From words to code

In words: “Run the pump while Start is held.” Put another way: “The pump should copy whatever the Start button is doing.”

As code, that is one line:

PumpOn := Start;

Siemens and Rockwell write it slightly differently

Siemens puts a # in front of each name. Rockwell leaves it out. It is the same rule with the same result. You will meet both companies properly in the last part.

SiemensRockwell
#PumpOn := #Start;PumpOn := Start;

Adding a “but not if”

“Run the pump while Start is held, but not if the tank is full” becomes:

PumpOn := Start AND NOT TankFull;

Try it

Click each piece of the code to see what it means.

Your first line

Read it aloud: “PumpOn becomes Start.”

With a “but not if”

Read it aloud: “PumpOn becomes Start, and not TankFull.”

PumpOn

The tag for the pump. When it is TRUE the pump runs; when it is FALSE the pump stops.

Try the second line

Pump stopped

Start FALSE AND NOT TankFull FALSE → PumpOn FALSE

New words

Code
Rules written in a short, strict way that a PLC can read.
:=
“Becomes”. The tag on the left gets the value worked out on the right.
AND NOT
“But not if”. Both parts must agree before the result is TRUE.

Quick check

In PumpOn := Start; what happens when Start is FALSE?