Internal Relay (Memory Bit) Addressing in PLC Programming
📖 Scenario: You are programming a simple PLC (Programmable Logic Controller) to control a small machine. The machine uses internal relays (memory bits) to store the state of different parts of the process. You need to create and use these internal relays correctly to control the machine's logic.
🎯 Goal: Learn how to create and address internal relays (memory bits) in a PLC program. You will define memory bits, assign values, and use them in logic conditions.
📋 What You'll Learn
Create internal relay variables with exact names and addresses
Assign values to internal relays
Use internal relays in conditional logic
Output the state of internal relays
💡 Why This Matters
🌍 Real World
Internal relays (memory bits) are used in PLCs to store temporary states and control logic without physical inputs or outputs. This is essential for machine automation and process control.
💼 Career
Understanding internal relay addressing is fundamental for PLC programmers and automation engineers to design reliable control systems.
Progress0 / 4 steps
1
Define Internal Relay Variables
Create three internal relay variables named M0, M1, and M2 with initial values 0, 1, and 0 respectively.
PLC Programming
Hint
Use simple variable assignments to represent internal relays and set their initial values.
2
Create a Control Flag
Create a variable called control_flag and set it to 1 to represent a control condition.
PLC Programming
Hint
Just assign the value 1 to the variable named control_flag.
3
Update Internal Relay Based on Control Flag
Write a line that sets M0 to 1 if control_flag is 1, otherwise set M0 to 0. Use an if-else statement.
PLC Programming
Hint
Use a simple if-else block to assign M0 based on control_flag.
4
Display Internal Relay States
Print the values of M0, M1, and M2 in the format: M0=1, M1=1, M2=0.
PLC Programming
Hint
Use an f-string to format the output exactly as shown.
Practice
(1/5)
1. What is the main purpose of an internal relay (memory bit) in PLC programming?
easy
A. To store ON/OFF states inside the PLC without controlling physical devices
B. To directly control motors and actuators
C. To provide power to sensors
D. To display output on the PLC screen
Solution
Step 1: Understand internal relay function
Internal relays store ON/OFF states inside the PLC memory but do not control physical devices.
Step 2: Compare options
Only To store ON/OFF states inside the PLC without controlling physical devices correctly describes this purpose; others mention controlling devices or power, which is incorrect.
Final Answer:
To store ON/OFF states inside the PLC without controlling physical devices -> Option A
Quick Check:
Internal relay = memory bit for logic [OK]
Hint: Internal relays remember states, not control devices [OK]
Common Mistakes:
Confusing internal relays with output devices
Thinking internal relays supply power
Assuming internal relays display information
2. Which of the following is the correct syntax to address an internal relay (memory bit) named M10 in a PLC program?
easy
A. D10
B. X10
C. Y10
D. M10
Solution
Step 1: Identify internal relay address format
Internal relays are commonly addressed with the letter 'M' followed by a number, e.g., M10.
Step 2: Match options to address format
M10 uses 'M10', which is correct. Other options use letters for inputs (X), outputs (Y), or data registers (D).
Final Answer:
M10 -> Option D
Quick Check:
Internal relay = M + number [OK]
Hint: Internal relays start with 'M' in address [OK]
Common Mistakes:
Using input (X) or output (Y) addresses for internal relays
Confusing data registers (D) with memory bits
Omitting the letter prefix
3. Given the following ladder logic snippet, what is the state of internal relay M5 after the rung executes?
--[ ]--[ ]--(M5)\n I1 I2
Inputs: I1 = ON, I2 = OFF
medium
A. ON
B. OFF
C. Toggle
D. Undefined
Solution
Step 1: Analyze input conditions
The rung has two contacts in series: I1 and I2. I1 is ON, I2 is OFF.
Step 2: Determine relay output state
Both inputs must be ON for M5 to energize. Since I2 is OFF, M5 remains OFF.
Final Answer:
OFF -> Option B
Quick Check:
Series contacts require all ON for output ON [OK]
Hint: Series contacts need all ON to energize relay [OK]
Common Mistakes:
Assuming relay toggles automatically
Ignoring OFF input in series
Confusing parallel and series logic
4. In the following PLC code snippet, there is an error in addressing the internal relay. Identify the error:
LD X0\nAND M1\nOUT M2
What is the error?
medium
A. Using M1 as input in AND instruction is invalid
B. Incorrect internal relay address M2 in OUT instruction
C. No error, code is correct
D. Using input address X0 instead of internal relay
Solution
Step 1: Review each instruction
LD X0 loads input X0 state, AND M1 uses internal relay M1 as condition, OUT M2 sets internal relay M2.
Step 2: Check addressing validity
Inputs (X) and internal relays (M) are correctly used. M1 and M2 are valid internal relay addresses.
Final Answer:
No error, code is correct -> Option C
Quick Check:
Input and internal relay addresses used properly [OK]
Hint: Inputs use X, internal relays use M; both valid here [OK]
Common Mistakes:
Thinking internal relays can't be inputs
Assuming OUT can't target internal relays
Confusing input and output addresses
5. You want to use internal relays M10 and M11 to remember if two sensors S1 and S2 were ON at any time during a process. Which ladder logic sequence correctly sets M10 and M11 to ON when their respective sensors turn ON, and keeps them ON until reset?
hard
A. --[S1]--(M10)\n--[M10]--(M10)\n--[S2]--(M11)\n--[M11]--(M11)\n--[Reset]--(/M10)\n--[Reset]--(/M11)
B. --[S1]--(M10)\n--[S2]--(M11)\n--[Reset]--(/M10)\n--[Reset]--(/M11)
C. --[S1]--(M10)\n--[S2]--(M11)\n--[Reset]--(M10)\n--[Reset]--(M11)
D. --[S1]--(M10)\n--[S2]--(M11)\n--[Reset]--(M10)\n--[Reset]--(/M11)
Solution
Step 1: Understand latch logic for memory bits
To keep M10 and M11 ON after sensors turn ON, latch logic uses the internal relay itself in parallel with the sensor input.
Step 2: Analyze options for latch and reset
--[S1]--(M10)\n--[M10]--(M10)\n--[S2]--(M11)\n--[M11]--(M11)\n--[Reset]--(/M10)\n--[Reset]--(/M11) shows M10 and M11 set by sensors and latched by themselves, with reset contacts to turn them OFF. Others lack latching or proper reset.
Final Answer:
--[S1]--(M10)\n--[M10]--(M10)\n--[S2]--(M11)\n--[M11]--(M11)\n--[Reset]--(/M10)\n--[Reset]--(/M11) -> Option A
Quick Check:
Latching uses self-holding contact + reset to clear [OK]
Hint: Latch with self-contact to hold ON until reset [OK]
Common Mistakes:
Not using latch (self-holding) contacts
Resetting only one relay
Using reset coil instead of reset contact
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.