Bird
Raised Fist0
PLC Programmingscripting~10 mins

Internal relay (memory bit) addressing in PLC Programming - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Internal relay (memory bit) addressing
Start PLC Scan Cycle
↓
Read Input Signals
↓
Evaluate Logic Using Internal Relays
↓
Set/Clear Internal Relay Bits
↓
Use Internal Relays in Further Logic
↓
Update Outputs
↓
End PLC Scan Cycle
The PLC scan cycle reads inputs, evaluates logic using internal relay bits (memory bits), updates these bits, and then uses them to control outputs or further logic.
Execution Sample
PLC Programming
LD X0
AND M10
OR M11
OUT M20
This PLC logic loads input X0, ANDs it with internal relay M10, ORs with M11, and stores the result in internal relay M20.
Execution Table
StepInstructionOperandsEvaluationInternal Relay State Change
1LDX0=1Load X0 value 1No change
2ANDM10=01 AND 0 = 0No change
3ORM11=10 OR 1 = 1No change
4OUTM20Set M20 = 1M20 changed from 0 to 1
5EndScan cycle ends, M20=1
💡 Scan cycle ends after output M20 is set based on logic evaluation.
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4Final
X0111111
M10000000
M11111111
M20000011
Key Moments - 2 Insights
Why does M20 change only at the OUT instruction and not during LD, AND, or OR?
Because LD, AND, and OR only evaluate logic and hold intermediate results; the OUT instruction actually writes the result to the internal relay M20, as shown in execution_table step 4.
Can internal relays like M10 and M11 be used as inputs in logic?
Yes, internal relays store memory bits and can be used as inputs in logic operations, as seen in steps 2 and 3 where M10 and M11 are operands.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the value of the logic evaluation after the AND instruction (step 2)?
A1
B0
CUndefined
DSame as M10
💡 Hint
Check the 'Evaluation' column at step 2 in the execution_table.
At which step does the internal relay M20 change its value?
AStep 4
BStep 2
CStep 1
DStep 3
💡 Hint
Look at the 'Internal Relay State Change' column in the execution_table.
If M11 was 0 instead of 1, what would be the final value of M20 after step 4?
A1
BDepends on X0
C0
DUndefined
💡 Hint
Refer to the logic evaluation steps and how OR with M11 affects the result.
Concept Snapshot
Internal relays (memory bits) in PLCs store logic states.
They can be read and written using instructions like LD, AND, OR, and OUT.
Logic is evaluated step-by-step, but bits change only on OUT.
Use internal relays to hold intermediate or memory states in your program.
Full Transcript
This lesson shows how internal relays (memory bits) work in PLC programming. The PLC reads inputs, evaluates logic using these memory bits, and updates them with OUT instructions. For example, the code loads input X0, ANDs it with internal relay M10, ORs with M11, and writes the result to M20. The execution table traces each step, showing how logic is evaluated and when internal relays change. Key points include that internal relays can be used as inputs and outputs in logic, and they only change state when an OUT instruction runs. The quiz tests understanding of these steps and how changing inputs affects outputs.

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

  1. Step 1: Understand internal relay function

    Internal relays store ON/OFF states inside the PLC memory but do not control physical devices.
  2. 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.
  3. Final Answer:

    To store ON/OFF states inside the PLC without controlling physical devices -> Option A
  4. 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

  1. Step 1: Identify internal relay address format

    Internal relays are commonly addressed with the letter 'M' followed by a number, e.g., M10.
  2. 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).
  3. Final Answer:

    M10 -> Option D
  4. 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

  1. Step 1: Analyze input conditions

    The rung has two contacts in series: I1 and I2. I1 is ON, I2 is OFF.
  2. Step 2: Determine relay output state

    Both inputs must be ON for M5 to energize. Since I2 is OFF, M5 remains OFF.
  3. Final Answer:

    OFF -> Option B
  4. 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

  1. 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.
  2. Step 2: Check addressing validity

    Inputs (X) and internal relays (M) are correctly used. M1 and M2 are valid internal relay addresses.
  3. Final Answer:

    No error, code is correct -> Option C
  4. 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

  1. 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.
  2. 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.
  3. Final Answer:

    --[S1]--(M10)\n--[M10]--(M10)\n--[S2]--(M11)\n--[M11]--(M11)\n--[Reset]--(/M10)\n--[Reset]--(/M11) -> Option A
  4. 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 unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard