CH 05 - CH 05.odt Page 1/11 Addressing Modes o HW#3 Pg...

This preview shows page 1 - 4 out of 11 pages.

CH 05.odt: Page 1/11Addressing ModesoHW #3: Pg 136 #8, 11, 13oThere are various methods to access data that resides in the 8051 ROM and RAM. oSometimes, one method may be more convenient or more efficient than another.oOr, certain parts of memory may require a particular method to be used.8051 Addressing Modes: 1.Immediate addressing mode – working with constants2.Register addressing mode – working with named registers3.Direct addressing mode – working with addresses of RAM locations and special function registers (SFR)4.Register indirect addressing mode – working with internal RAM at locations 30h to 7Fh (more conveniently)5.Indexed addressing mode – working with ROM at locations 80h to 0FFFh (and external RAM beyond the 128-byte on-board RAM)
CH 05.odt: Page 2/11Immediate Addressing ModeExamples:oMOV R4, #0F2hoMOV A, #0AhoSUBB A, #02 Register Addressing ModeExamples:oMOV A, R0oMOV R2, AoADD A, R4Direct Addressing ModeExamples:oMOV A, 4Ah; note the missing # symboloADD A, 4BhDirect addressing mode is often used with memory locations which are not named, e.g., scratch pad memory area. In the case of named registers (e.g., P0, Acc, DPL, DPH, R2, SP, TH1, etc.), they can be accessed by either register addressing mode or direct addressing mode, which can be quite confusing. See examples below.
CH 05.odt: Page 3/11Examples(Using direct addressing mode to copy data from R1 register to the

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture