Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a function block named 'Counter'.
PLC Programming
FUNCTION_BLOCK [1]
VAR
count : INT;
END_VAR
END_FUNCTION_BLOCKAttempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or all uppercase letters for the function block name.
Misspelling the function block name.
✗ Incorrect
The function block name must start with a capital letter and match the definition. 'Counter' is the correct name.
2fill in blank
mediumComplete the code to declare an integer variable named 'count' inside the function block.
PLC Programming
FUNCTION_BLOCK Counter
VAR
[1] : INT;
END_VAR
END_FUNCTION_BLOCKAttempts:
3 left
💡 Hint
Common Mistakes
Using uppercase or capitalized variable names incorrectly.
Misspelling the variable name.
✗ Incorrect
Variable names are case sensitive. 'count' matches the variable name exactly.
3fill in blank
hardFix the error in the function block header to correctly define the function block.
PLC Programming
FUNCTION_BLOCK [1]
VAR
count : INT;
END_VAR
END_FUNCTION_BLOCKAttempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or all uppercase names.
Using a different name than intended.
✗ Incorrect
Function block names are case sensitive and should match the declaration. 'Counter' is correct.
4fill in blank
hardFill both blanks to declare a boolean input named 'Enable' and an integer output named 'Result' inside the function block.
PLC Programming
FUNCTION_BLOCK Counter VAR_INPUT [1] : BOOL; END_VAR VAR_OUTPUT [2] : INT; END_VAR END_FUNCTION_BLOCK
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase names for inputs or outputs.
Mixing input and output variable names.
✗ Incorrect
Input and output variable names are case sensitive. 'Enable' and 'Result' are correct.
5fill in blank
hardFill all three blanks to define a function block 'Timer' with an input 'Start' (BOOL), an output 'Done' (BOOL), and a variable 'Elapsed' (TIME).
PLC Programming
FUNCTION_BLOCK [1] VAR_INPUT [2] : BOOL; END_VAR VAR_OUTPUT [3] : BOOL; END_VAR VAR Elapsed : TIME; END_VAR END_FUNCTION_BLOCK
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect names or wrong case for inputs and outputs.
Misspelling the function block name.
✗ Incorrect
The function block name is 'Timer'. Input is 'Start' and output is 'Done', all case sensitive.
