📖 Scenario: You are working in an industrial automation setting. You need to understand the basic types of programming languages used for PLCs (Programmable Logic Controllers) following the IEC 61131-3 standard. This knowledge helps you communicate with engineers and write simple automation scripts.
🎯 Goal: Learn to create a simple data structure listing the five main PLC programming languages defined by IEC 61131-3, add a configuration variable to select one language, write logic to check if the selected language is supported, and finally display the result.
📋 What You'll Learn
Create a dictionary named plc_languages with exact keys and descriptions
Add a variable named selected_language with a specific language name
Write an if statement to check if selected_language is in plc_languages
Print a message showing if the language is supported or not
💡 Why This Matters
🌍 Real World
Understanding IEC 61131-3 PLC programming languages helps in configuring and programming industrial automation systems correctly.
💼 Career
PLC programmers, automation engineers, and technicians use this knowledge daily to write, read, and maintain control programs in factories and plants.
Progress0 / 4 steps
1
Create the PLC languages dictionary
Create a dictionary called plc_languages with these exact entries: 'LD' for Ladder Diagram, 'FBD' for Function Block Diagram, 'ST' for Structured Text, 'IL' for Instruction List, and 'SFC' for Sequential Function Chart.
PLC Programming
Hint
Use curly braces {} to create a dictionary. Each key-value pair should be separated by a colon and commas.
2
Add the selected language variable
Add a variable called selected_language and set it to the string 'ST'.
PLC Programming
Hint
Assign the string 'ST' to the variable selected_language using the equals sign.
3
Check if the selected language is supported
Write an if statement that checks if selected_language is a key in plc_languages. If it is, create a variable message with the text "Supported: " plus the language description from plc_languages. Otherwise, set message to "Language not supported".
PLC Programming
Hint
Use if selected_language in plc_languages: to check membership. Use an f-string to combine text and dictionary value.
4
Display the result message
Write a print statement to display the message variable.
PLC Programming
Hint
Use print(message) to show the result on the screen.
Practice
(1/5)
1. Which of the following is NOT one of the five main PLC programming languages defined by IEC 61131-3?
easy
A. Function Block Diagram
B. Python
C. Structured Text
D. Ladder Diagram
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 B
Quick Check:
IEC 61131-3 excludes Python [OK]
Hint: Remember IEC 61131-3 languages exclude general programming languages [OK]
Common Mistakes:
Confusing general programming languages with PLC languages
Assuming all text-based languages are included
Mixing up graphical and text-based languages
2. Which syntax correctly represents a simple assignment in Structured Text (ST)?
easy
A. Output := Input + 5;
B. Output = Input + 5
C. Output == Input + 5;
D. Output <- Input + 5;
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 A
Quick Check:
ST assignment uses ':=' and ';' [OK]
Hint: Look for ':=' operator and semicolon in Structured Text [OK]
Common Mistakes:
Using '=' instead of ':=' for assignment
Omitting semicolon at statement end
Confusing equality '==' with assignment
3. Given the following Ladder Diagram logic: --[ ]--( )-- where the input contact is normally open and connected to output coil, what is the output when the input is OFF?
medium
A. Output is undefined
B. Output is ON
C. Output toggles ON and OFF
D. Output 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 D
Quick Check:
Open contact means no output current [OK]
Hint: Open contact means output coil is OFF [OK]
Common Mistakes:
Assuming output is ON when input is OFF
Confusing normally open with normally closed contacts
Thinking output toggles without input change
4. Identify the error in this Structured Text snippet:
IF Input = TRUE THEN
Output := TRUE
END_IF
medium
A. Missing semicolon after Output assignment
B. Incorrect IF syntax, should be IF (Input = TRUE) THEN
C. Assignment operator should be '=' not ':='
D. END_IF should be lowercase
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 A
Quick Check:
Statements end with ';' in ST [OK]
Hint: Always end ST statements with semicolon [OK]
Common Mistakes:
Forgetting semicolons after assignments
Misusing '=' for assignment
Assuming IF needs parentheses
5. You need to implement a control logic that turns ON an output only if two inputs are ON simultaneously, using Function Block Diagram (FBD). Which block combination correctly represents this?
hard
A. Two OR blocks connected in parallel
B. Two AND blocks connected in series
C. One AND block with both inputs connected to it
D. One NOT block with inputs connected
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 C
Quick Check:
AND block with multiple inputs = simultaneous ON check [OK]
Hint: Use single AND block with all inputs for simultaneous ON [OK]
Common Mistakes:
Using OR blocks instead of AND
Connecting AND blocks in series unnecessarily
Using NOT block incorrectly for AND logic
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.