Bird
Raised Fist0
PLC Programmingscripting~30 mins

Input addressing scheme in PLC Programming - Mini Project: Build & Apply

Choose your learning style10 modes available
Input Addressing Scheme in PLC Programming
📖 Scenario: You are programming a simple PLC (Programmable Logic Controller) for a factory machine. The machine has several input sensors connected to the PLC. Each sensor is assigned a specific input address. You need to create a program that reads these inputs and stores their states.
🎯 Goal: Build a PLC program that defines input addresses for sensors, sets a threshold for activation, checks which sensors are active, and outputs the list of active sensors.
📋 What You'll Learn
Create a dictionary called input_addresses with exact sensor names and their input addresses.
Create a variable called activation_threshold with the exact value 1.
Use a for loop with variables sensor and address to iterate over input_addresses.items() and create a dictionary active_sensors with sensors that have input value >= activation_threshold.
Print the active_sensors dictionary.
💡 Why This Matters
🌍 Real World
PLC programs use input addressing schemes to read sensor states in factories, automation lines, and machines.
💼 Career
Understanding input addressing is essential for PLC programmers and automation engineers to build reliable control systems.
Progress0 / 4 steps
1
Define input addresses for sensors
Create a dictionary called input_addresses with these exact entries: 'Sensor1': 0, 'Sensor2': 1, 'Sensor3': 2, 'Sensor4': 3.
PLC Programming
Hint

Use curly braces {} to create a dictionary with keys as sensor names and values as their input addresses.

2
Set activation threshold
Create a variable called activation_threshold and set it to 1.
PLC Programming
Hint

Just assign the number 1 to the variable activation_threshold.

3
Check active sensors
Use a for loop with variables sensor and address to iterate over input_addresses.items(). Create a dictionary called active_sensors that includes sensors with input value greater than or equal to activation_threshold. Assume a dictionary input_values with these exact values: {0: 0, 1: 1, 2: 0, 3: 1}.
PLC Programming
Hint

Use a for loop to check each sensor's input value from input_values. Add sensors to active_sensors if their value is at least the threshold.

4
Print active sensors
Print the active_sensors dictionary.
PLC Programming
Hint

Use print(active_sensors) to show the sensors that are active.

Practice

(1/5)
1. What does the input addressing scheme I1.3 mean in a PLC program?
easy
A. Internal memory at byte 1, bit 3
B. Output at byte 1, bit 3
C. Input at byte 3, bit 1
D. Input at byte 1, bit 3

Solution

  1. Step 1: Understand the input address format

    The format I<byte>.<bit> means input at specified byte and bit.
  2. Step 2: Interpret I1.3

    This means input at byte 1, bit 3.
  3. Final Answer:

    Input at byte 1, bit 3 -> Option D
  4. Quick Check:

    Input address = I1.3 means byte 1, bit 3 [OK]
Hint: I means input, number before dot is byte, after dot is bit [OK]
Common Mistakes:
  • Confusing input with output addresses
  • Mixing up byte and bit positions
  • Assuming bit number comes before byte
2. Which of the following is the correct syntax for addressing input bit 5 in byte 2?
easy
A. I2.5
B. I5.2
C. O2.5
D. I2-5

Solution

  1. Step 1: Recall input address syntax

    The correct format is I<byte>.<bit>.
  2. Step 2: Match byte 2 and bit 5

    So input bit 5 in byte 2 is I2.5.
  3. Final Answer:

    I2.5 -> Option A
  4. Quick Check:

    Correct input syntax = I2.5 [OK]
Hint: Use dot between byte and bit, start with I for input [OK]
Common Mistakes:
  • Swapping byte and bit numbers
  • Using O instead of I for input
  • Using dash instead of dot
3. Given the PLC input address I0.7 is ON and all others OFF, what is the binary value of byte 0?
medium
A. 00000001
B. 10000000
C. 11111111
D. 00000000

Solution

  1. Step 1: Understand bit numbering in a byte

    Bit 0 is the least significant bit (rightmost), bit 7 is the most significant (leftmost).
  2. Step 2: Set bit 7 ON and others OFF

    Bit 7 ON means the leftmost bit is 1, others 0, so binary is 10000000.
  3. Final Answer:

    10000000 -> Option B
  4. Quick Check:

    I0.7 ON means bit 7 = 1, binary = 10000000 [OK]
Hint: Bit 7 is leftmost bit in byte, so 10000000 [OK]
Common Mistakes:
  • Assuming bit 7 is rightmost bit
  • Confusing bit numbering direction
  • Setting wrong bit ON
4. A PLC program uses the input address I3.8. What is wrong with this address?
medium
A. Bit number 8 does not exist in a byte
B. Byte number 3 is invalid
C. Input addresses cannot have dots
D. I should be lowercase

Solution

  1. Step 1: Recall bit numbering limits

    A byte has bits numbered 0 to 7 only, so bit 8 is invalid.
  2. Step 2: Check address I3.8

    Bit 8 is outside valid range, so address is incorrect.
  3. Final Answer:

    Bit number 8 does not exist in a byte -> Option A
  4. Quick Check:

    Bits 0-7 valid, 8 invalid [OK]
Hint: Bits go 0 to 7 only, no bit 8 in a byte [OK]
Common Mistakes:
  • Thinking bits go 1 to 8
  • Ignoring dot separator
  • Assuming case sensitivity matters
5. You want to read inputs from byte 4 bits 0 to 3 and combine them into a 4-bit number in your PLC program. Which input addresses should you use?
hard
A. I4.4, I4.5, I4.6, I4.7
B. I0.4, I1.4, I2.4, I3.4
C. I4.0, I4.1, I4.2, I4.3
D. I3.0, I3.1, I3.2, I3.3

Solution

  1. Step 1: Identify byte and bit range

    You want bits 0 to 3 in byte 4, so bits 0,1,2,3 of byte 4.
  2. Step 2: Write input addresses for these bits

    These are I4.0, I4.1, I4.2, I4.3.
  3. Final Answer:

    I4.0, I4.1, I4.2, I4.3 -> Option C
  4. Quick Check:

    Bits 0-3 in byte 4 = I4.0 to I4.3 [OK]
Hint: Bits 0-3 in byte 4 are I4.0 to I4.3 [OK]
Common Mistakes:
  • Mixing bits from different bytes
  • Using bits 4-7 instead of 0-3
  • Confusing byte numbers
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard