Skip to content
Solved Examples · Example 1

Q.Describe the operation of each of the following immediate-data MOV instructions of the 8051.
MOV A, #25H          ; load 25H into A  
MOV R4, #62          ; load the decimal value 62 into R4  
MOV DPTR, #4562H     ; DPTR = 4562H  
MOV DPTR, #1235H     ; put the immediate 16 bit number 1235H in register DPTR  
MOV R7, #06H         ; put the immediate 8 bit number 06 in register R7  

Karnataka PUCTextbookLongImportance★★★★★est
1% · 1/115 Questions
✓ Free question

[!TLDR]

The # sign marks immediate data, so each MOV simply copies the constant written after # directly into the register named as its destination.

Concept - immediate addressing. In the 8051 the source of the data can be made part of the opcode itself; this is called immediate addressing. The constant is always preceded by the pound (hash) sign #, which tells the assembler that the following number is a literal value, not an address. Immediate data can be loaded into A, into any working register R0-R7 of the current bank, or (as a 16-bit constant) into the data pointer DPTR.

Working through each instruction:

  • MOV A, #25H - the 8-bit constant 25H is copied into the accumulator, so A = 25H.
  • MOV R4, #62 - 62 has no H suffix, so it is a decimal constant; R4 receives 62 decimal, which is 3EH.
  • MOV DPTR, #4562H - DPTR is a 16-bit register, so the full 16-bit constant 4562H is loaded (DPH = 45H, DPL = 62H).
  • MOV DPTR, #1235H - likewise loads 1235H into DPTR (DPH = 12H, DPL = 35H).
  • MOV R7, #06H - the 8-bit constant 06H is copied into R7.

When an immediate move executes, the program counter is automatically advanced past the opcode byte(s) that hold the constant, so the next instruction is fetched correctly.

[!ANSWER]

A = 25H; R4 = 62 decimal (3EH); DPTR = 4562H, then re-loaded to 1235H; R7 = 06H. Each value is the literal that follows the # sign.

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.