User: alciro    User
 Original    Translate to:  Deutsch  English  Français  中文  

Microcontroladores 8051

3. 8051 addressing modes

3.1. Direct (Dir)

Dir. In direct addressing, you specify the address to operate in absolute terms.

For the family of 8051 microcontrollers are available direct address 256, corresponding to (internal + Ram Records SFR).

The OpCode is followed by a byte representing the address.

MOV A,30H ; A<-(30H), El contenido de la dirección 30H se mueve al acumulador
ADD A,31H ; A<-(A)+(31H), Se suma el contenido de acumulador con el de la dirección 31H
; el resultado se deposita en el acumulador

3.2. For registration (Rn)

Rn. For the record address for the instruction code (OpCode) contains the registration information to operate the selected register bank.

MOV R1,A ; R1<-(A), El contenido del acumulador se mueve al registro R1

OpCode of (MOV Rn, A) is F8H, in binary:

1 1 1 1 1 0 0 1

The last three bits identify the register on which it operates.

R0 0 0 0
R1 0 0 1
R2 0 1 0
R3 0 1 1
R4 1 0 0
R5 1 0 1
R6 1 1 0
R7 1 1 1

3.3. Indirect (@)

@. It specifies a register containing the address of the data to operate.

R0, R1 when accessing the internal memory of 256 Bytes indirection.
DPTR to access external memory 64K bytes.

MOV R0,#30H ; RO<-30H, mover al registro 0 el dato inmediato 30H (constante)
MOV A,@R0 ; A<-((R0)), mueve el contenido de la posición de memoria indicada en R0 al Acc

Indirect addressing

3.4. Implicit

The statement implicitly indicates the record on which to be operated.

INC A ; A<-(A)+1, incrementar el acumulador
CPL A ; A<-(Ã), complementa el acumulador

3.5. Immediate (#)

#. The opcode is followed by a constant that represents the value that will be operated.

MOV A,#0 ; A<-0, poner cero en el Acc
MOV R1,#123 ; R1<-123, poner el valor 123 (decimal) en el registro uno

3.6. Indexed

Two registers are used to point to the address containing the data. The sum of the contents of DPTR more the battery determines the direction of trade.

This routing is limited to only two instructions that move data from ROM to the accumulator.

MOVC A,@A+DPTR ; A<-((DPTR+A)), el contenido de la posición que apunta el DPTR+A se deposita en el Acc

Indexed addressing
copyright © 2007-2021  All rights reserved.         
Share |