Sunday, February 28, 2016

8051 Relative Addressing Mode

Relative Addressing Mode

  • In this mode, the operand is an relative address
  • A relative address (or offset) is an 8-bit signed value, which is added to the program counter (PC) to form the address of the next instruction to be executed.
  • This mode is used with short jump (SJMP) and conditional jump (JNZ) instructions
  • Jump instructions are used to transfer control from one part of program to another
  • Jump ahead and Jump back
  • Destination address must be within -128 to +127bytes from current instruction address
  • Advantage: position independent code
  • Example:
  • GoBack: DEC A
    JNZ GoBack
    The above instruction transfer the control back to previous instruction using relative address of previous instruction
8051 Relative Addressing Mode Example



Related topics:
8051 Addressing Modes   |   8051 Register Addressing Mode   |   8051 Direct Addressing Mode   |   8051 Indirect Addressing Mode   |   8051 Immediate Addressing Mode   |   8051 Absolute Addressing Mode   |   8051 Long Addressing Mode   |   8051 Indexed Addressing Mode   |   8051 External Addressing Mode

List of topics: 8051

No comments:

Post a Comment