Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare an up-down counter variable.
PLC Programming
COUNTER [1] : INT;Attempts:
3 left
💡 Hint
Common Mistakes
Using names that are not standard or recognized as counters.
Confusing counter with timer variable names.
✗ Incorrect
The standard name for a counter variable in PLC programming is often CNT1.
2fill in blank
mediumComplete the code to increment the counter when the input is true.
PLC Programming
IF input = TRUE THEN [1] := [1] + 1; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined variable names.
Trying to increment input instead of the counter.
✗ Incorrect
CNT1 is the counter variable that should be incremented.
3fill in blank
hardFix the error in the code to decrement the counter when the down input is true.
PLC Programming
IF down_input = TRUE THEN [1] := [1] - 1; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names that were not declared.
Trying to decrement the input variable.
✗ Incorrect
CNT1 is the correct counter variable to decrement.
4fill in blank
hardFill both blanks to check if the counter is within limits.
PLC Programming
IF [1] >= 0 AND [2] <= 10 THEN // valid count END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names in the same condition.
Using undefined variables.
✗ Incorrect
Use CNT1 for both blanks to check the counter value.
5fill in blank
hardFill all three blanks to reset the counter when reset input is true and limit is reached.
PLC Programming
IF reset_input = TRUE OR [1] >= [2] THEN [3] := 0; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not resetting the correct variable.
✗ Incorrect
CNT1 is the counter variable, 10 is the limit, and CNT1 is reset to 0.
