Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to assign the value 1 to the output if the input is true.
PLC Programming
IF input THEN output := [1]; END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Assigning 0 instead of 1 to turn the output ON.
Using TRUE or FALSE instead of numeric values.
✗ Incorrect
In structured text, to turn an output ON, assign it the value 1 when the input condition is true.
2fill in blank
mediumComplete the ladder logic rung to turn ON the output coil when the input contact is closed.
PLC Programming
----[ [1] ]----( )----Attempts:
3 left
💡 Hint
Common Mistakes
Using NC (Normally Closed) which is closed when input is false.
Confusing timer or counter instructions with contacts.
✗ Incorrect
In ladder logic, NO (Normally Open) contact closes when input is true, allowing current to flow and energize the coil.
3fill in blank
hardFix the error in the structured text code to correctly toggle the output when the input rises.
PLC Programming
IF [1] THEN output := NOT output; END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Using input = TRUE causes continuous toggling while input is true.
Using F_TRIG detects falling edge, not rising.
✗ Incorrect
R_TRIG detects the rising edge of input, so the output toggles only when input changes from false to true.
4fill in blank
hardFill both blanks to create a structured text condition that checks if temperature is between 20 and 30 degrees.
PLC Programming
IF temperature [1] 20 AND temperature [2] 30 THEN heater := TRUE; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using > for the lower limit excludes 20.
Using <= for the upper limit includes 30, which may not be desired.
✗ Incorrect
To check if temperature is between 20 and 30, it must be greater or equal to 20 and less than 30.
5fill in blank
hardFill all three blanks to create a dictionary comprehension in structured text that maps sensor names to their values if the value is above 50.
PLC Programming
sensor_map := { [1] : [2] FOR [3] IN sensors IF sensors[[3]] > 50 };Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names for keys and loop variable.
Using 'value' which is undefined in this context.
✗ Incorrect
The comprehension maps each sensor name (sensor) to its value (sensors[sensor]) for sensors in the collection where the value is above 50.
