Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a reusable function block.
PLC Programming
FUNCTION_BLOCK [1]
VAR
counter : INT;
END_VAR
END_FUNCTION_BLOCKAttempts:
3 left
💡 Hint
Common Mistakes
Using generic names like 'MainLoop' which are not descriptive.
Using names that do not reflect the block's purpose.
✗ Incorrect
The function block name should be descriptive and reusable. 'CounterBlock' clearly indicates its purpose.
2fill in blank
mediumComplete the code to call the function block instance.
PLC Programming
VAR
myCounter : [1];
END_VARAttempts:
3 left
💡 Hint
Common Mistakes
Using a different or incorrect block name.
Confusing instance names with block types.
✗ Incorrect
To create an instance of the function block, use its exact name 'CounterBlock'.
3fill in blank
hardFix the error in the function block call to execute the logic.
PLC Programming
myCounter.[1]();Attempts:
3 left
💡 Hint
Common Mistakes
Using method names that do not exist in the block.
Forgetting to call the method to run the block.
✗ Incorrect
The standard method to run the logic inside a function block instance is 'Execute()'.
4fill in blank
hardFill both blanks to create a modular program with two function blocks.
PLC Programming
VAR counter1 : [1]; counter2 : [2]; END_VAR
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same block type for both variables.
Using unrelated or undefined block names.
✗ Incorrect
Using two different function blocks like 'CounterBlock' and 'TimerBlock' shows modular design.
5fill in blank
hardFill all three blanks to complete the modular program calling each block's method.
PLC Programming
counter1.[1](); counter2.[2](); ProcessUnit.[3]();
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same method name for all blocks.
Using method names that do not exist.
✗ Incorrect
Each block uses a different method to show modular calls: Execute, Start, and Run.
