chap5 - Chapter 5 8051 Addressing Modes 1 Sections 5.1...

This preview shows page 1 - 16 out of 52 pages.

The preview shows page 14 - 16 out of 52 pages.
1Chapter 58051 Addressing Modes
2Sections5.1Immediate and register addressing modes5.2Accessing memory using various address modes
3ObjectiveThe CPU can access data in various way.The datacould be in a register, or in memory either RAMor ROM or be provided as immediate value.These various ways of accessing data of 8051 ICare called Addressing Modes.
4Section 5.1Immediate and Register AddressingModes
5What is Addressing ModeThe CPU can access data in various ways.The data could be in a register, or inmemory (RAM or ROM (, or be provided asan immediate value.These various ways of accessing data are calledaddressing mode.
6Addressing Mode in the 8051Five addressing mode in the 8051 (1. immediate2. register3. direct4. register indirect5. indexed
7Addressing Mode 11. immediate (the operand is a constantMOV A,#01FH2. register (the operand is in a registerMOV A,R03. direct (access the data in the RAM withaddressMOV A,01FH4. register indirect (the register holds the RAMaddress of the dataMOVA,@R05. indexed (for on-chip ROM access
8Immediate Addressing ModeThe source operand is a constant.When the instruction is assembled, the operandcomes immediately after the opcode.The immediate vale can be loaded into any of theregisters.The immediate data must be preceded by the poundsign, ‘ (’.The immediate value is bounded by the size of register.Please use the simulation tools to find the the machinecode and the content of registers after execution.See Tables 10 (11 (page 418).
9Example of Immediate Mode (1/2 (Immediate Mode (1 0000 7425MOVA,#25H;A=25H2 0002 7C3EMOVR4,#62;A=62=3EH3 0004 9045 21MOVDPTR,#4521HInstruction Opcodes in Table 11Hex codeMnemonicOperandsByte74MOVA, #data27CMOVR4, #data290MOVDPTR, #data3
10Example of Immediate Mode (2/2 (Immediate Mode (1 0000 7425MOVA,#25H;A=25H2 0002 7C3EMOVR4,#62;A=62=3EH3 0004 9045 21MOVDPTR,#4521HInstruction Opcodes in Table 10MnemonicOscillator PeriodMOVA, #data12MOVRn, #data12MOVDPTR, #data24
11EQUThe EQU directive is used in the immediateaddressing mode.1 0000ORG 0H2 0000COUNTEQU303 0000 7C1EMOV R4,#COUNT4 0002 9002 00MOV DPTR,#MYDATA5 0200ORG 200H6020041 6D 65 72 69 MYDATA DB "America"7 0207END
12Addressing Mode 21. immediate (the operand is a constantMOV A,#01FH2. register (the operand is in a registerMOV A,R03. direct (access the data in the RAM withaddressMOV A,01FH4. register indirect (the register holds the RAMaddress of the dataMOVA,@R05. indexed (for on-chip ROM access
13Register Addressing ModeRegister addressing mode involves the use ofregisters to hold the data.The source and destination registers must match in size.The movement of data between Rn registers is notallowed. “MOV R4,R7” is illegal.You can find that the opcode in register addressingmode is short (
14Example of Register Mode (1/2 (Register Mode (1 0000E8MOV A,R02 0001FAMOV R2,A3 00022DADD A,R5Instruction Opcodes in Table 11Hex codeMnemonicOperandsByteE8MOVA,R01FAMOVR2,A12DADDA,R51
15Example of Register Mode (

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 52 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
cheung
Tags
Machine code, Addressing mode, mov

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture