Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to read the input from address %I0.0.
PLC Programming
input_value := [1];Attempts:
3 left
💡 Hint
Common Mistakes
Using output address %Q0.0 instead of input %I0.0.
Using memory address %M0.0 which is not an input.
Using data block address %DB1.DBX0.0 which is for data blocks.
✗ Incorrect
The input address %I0.0 refers to the first input bit in the PLC input byte 0.
2fill in blank
mediumComplete the code to check if input at address %I1.3 is ON (true).
PLC Programming
IF [1] THEN
// input is ON
END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Using output address %Q1.3 instead of input %I1.3.
Using memory address %M1.3 which is not input.
Using data block address %DB1.DBX1.3 which is not input.
✗ Incorrect
The input address %I1.3 refers to input byte 1, bit 3. Checking it in IF condition tests if it is ON.
3fill in blank
hardFix the error in the input address to read bit 5 of input byte 2.
PLC Programming
input_bit := [1];Attempts:
3 left
💡 Hint
Common Mistakes
Using output address %Q2.5 instead of input.
Using memory address %M2.5 instead of input.
Using wrong bit number like %I2.6.
✗ Incorrect
The correct input address for bit 5 of input byte 2 is %I2.5. Other options are output or memory addresses or wrong bit.
4fill in blank
hardFill both blanks to create a mask that reads bits 0 to 3 of input byte 4.
PLC Programming
mask := [1] AND [2];
Attempts:
3 left
💡 Hint
Common Mistakes
Using %IW4 which reads a word (2 bytes) instead of a byte.
Using mask 0xF0 which keeps bits 4 to 7 instead of 0 to 3.
✗ Incorrect
Use %IB4 to read input byte 4 as a byte, and mask with 0x0F to keep bits 0 to 3.
5fill in blank
hardFill all three blanks to read bit 7 of input byte 3 and store it as a boolean.
PLC Programming
bit_value := ([1] AND [2]) [3] 0;
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong mask like 0x08 instead of 0x80.
Using equality == 0 instead of inequality != 0.
Using word input %IW3 instead of byte %IB3.
✗ Incorrect
Read input byte 3 with %IB3, mask bit 7 with 0x80, then check if result is not zero to get boolean.
