PLC programming languages help control machines and processes in factories. They make it easy to tell machines what to do step-by-step.
PLC programming languages overview (IEC 61131-3)
IEC 61131-3 defines five main languages: 1. Ladder Diagram (LD) 2. Function Block Diagram (FBD) 3. Structured Text (ST) 4. Instruction List (IL) - deprecated 5. Sequential Function Chart (SFC) Each language has its own way to write control logic.
Ladder Diagram looks like electrical relay logic, easy for electricians.
Structured Text is like simple programming with variables and conditions.
Ladder Diagram example: --| |----( )-- | Start | Motor --| |--------
Structured Text example: IF StartButton THEN Motor := TRUE; ELSE Motor := FALSE; END_IF;
Function Block Diagram example: [StartButton] --> [AND] --> [Motor]
This program uses Structured Text to turn a motor on when the start button is pressed. It shows how simple conditions control outputs.
(* Simple Structured Text program to control a motor *) VAR StartButton : BOOL := FALSE; Motor : BOOL := FALSE; END_VAR IF StartButton THEN Motor := TRUE; ELSE Motor := FALSE; END_IF; (* Simulate pressing the button *) StartButton := TRUE; IF StartButton THEN Motor := TRUE; ELSE Motor := FALSE; END_IF; (* Output motor state *) Motor;
Instruction List (IL) is deprecated and not recommended for new projects.
Sequential Function Chart (SFC) helps organize complex sequences step-by-step.
Choosing the right language depends on your background and the task complexity.
IEC 61131-3 defines five standard PLC programming languages.
Ladder Diagram and Function Block Diagram are graphical and easy to visualize.
Structured Text is a text-based language similar to simple programming.
Practice
Solution
Step 1: Recall IEC 61131-3 languages
IEC 61131-3 defines Ladder Diagram, Function Block Diagram, Structured Text, Instruction List, and Sequential Function Chart.Step 2: Identify the language not listed
Python is a general-purpose programming language, not part of IEC 61131-3.Final Answer:
Python -> Option BQuick Check:
IEC 61131-3 excludes Python [OK]
- Confusing general programming languages with PLC languages
- Assuming all text-based languages are included
- Mixing up graphical and text-based languages
Solution
Step 1: Understand Structured Text assignment
In ST, the assignment operator is ':=' and statements end with a semicolon.Step 2: Check each option
Output := Input + 5;uses ':=' and ends with ';' correctly. Others use wrong operators or miss semicolons.Final Answer:
Output := Input + 5; -> Option AQuick Check:
ST assignment uses ':=' and ';' [OK]
- Using '=' instead of ':=' for assignment
- Omitting semicolon at statement end
- Confusing equality '==' with assignment
--[ ]--( )--where the input contact is normally open and connected to output coil, what is the output when the input is OFF?
Solution
Step 1: Understand Ladder Diagram symbols
The normally open contact [ ] closes when input is ON, allowing current to flow to the coil ( ).Step 2: Analyze input OFF condition
When input is OFF, the contact remains open, so no current flows to the coil, output stays OFF.Final Answer:
Output is OFF -> Option DQuick Check:
Open contact means no output current [OK]
- Assuming output is ON when input is OFF
- Confusing normally open with normally closed contacts
- Thinking output toggles without input change
IF Input = TRUE THEN Output := TRUE END_IF
Solution
Step 1: Check Structured Text syntax rules
Each statement must end with a semicolon ';' in ST.Step 2: Inspect the code snippet
The line 'Output := TRUE' lacks a semicolon at the end, causing a syntax error.Final Answer:
Missing semicolon after Output assignment -> Option AQuick Check:
Statements end with ';' in ST [OK]
- Forgetting semicolons after assignments
- Misusing '=' for assignment
- Assuming IF needs parentheses
Solution
Step 1: Understand AND logic in FBD
AND block outputs TRUE only if all inputs are TRUE simultaneously.Step 2: Choose correct block setup
One AND block with both inputs connected directly checks if both inputs are ON together.Final Answer:
One AND block with both inputs connected to it -> Option CQuick Check:
AND block with multiple inputs = simultaneous ON check [OK]
- Using OR blocks instead of AND
- Connecting AND blocks in series unnecessarily
- Using NOT block incorrectly for AND logic
Ready to prove it?
Pass the test and this pattern moves unknown
