Back to the 2023 paper

Module 3: Instruction Set and Programming

20237m

What are the branching instructions in 8051? Explain with suitable examples.

Worked SolutionAI Assisted

Branching Instructions in 8051

  • Unconditional jumps: LJMP addr16 (long), AJMP addr11 (absolute page), SJMP rel (short relative).
  • Conditional jumps: JC rel (if CY=1), JNC, JZ, JNZ, JB bit,rel, JNB, JBC (jump if bit set then clear), DJNZ direct/Reg,rel (decrement & jump not zero), CJNE A,direct,rel / A,#data,rel / Rn,#data,rel / @Ri,#data,rel (compare & jump if not equal).
  • Calls/Returns: LCALL, ACALL, RET, RETI.
  • Indirect: JMP @A+DPTR.

Examples:

CJNE A,#10H,NOT_EQ
DJNZ R2,LOOP
JB P1.0,SET
LJMP FAR

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.