Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Microcontroller 8051 Assembly Language
#1

Microcontroller 8051 Assembly Language

Addressing Modes
Register
Direct
Register Indirect
Immediate
Relative
Absolute
Long
Indexed
Direct Addressing Mode
Although the entire of 128 bytes of RAM can be accessed using direct addressing mode, it is most often used to access RAM loc. 30 7FH.

MOV R0, 40H
MOV 56H, A
MOV A, 4 ; MOV A, R4
MOV 6, 2 ; copy R2 to R6
; MOV R6,R2 is invalid !
Register Indirect Addressing Mode
In this mode, register is used as a pointer to the data.

MOV A,@Ri ; move content of RAM loc. where address is held by Ri into A ( i=0 or 1 )

MOV @R1,B

In other word, the content of register R0 or R1 is sources or target in MOV, ADD and SUBB insructions.

Immediate Addressing Mode
MOV A,#65H

MOV R6,#65H

MOV DPTR,#2343H

MOV P1,#65H
Relative, Absolute, & Long Addressing
Used only with jump and call instructions:

SJMP

ACALL,AJMP

LCALL,LJMP
Indexed Addressing Mode
This mode is widely used in accessing data elements of look-up table entries located in the program (code) space ROM at the 8051

MOVC A,@A+DPTR
(A,@A+PC)
A= content of address A +DPTR from ROM
Note:
Because the data elements are stored in the program (code ) space ROM of the 8051, it uses the instruction MOVC instead of MOV. The C means code.
Some Simple Instructions
MOV dest,source ; dest = source

MOV A,#72H ;A=72H
MOV R4,#62H ;R4=62H
MOV B,0F9H ;B=the content of F9 th byte of RAM

MOV DPTR,#7634H
MOV DPL,#34H
MOV DPH,#76H

MOV P1,A ;mov A to port 1

Note 1:
MOV A,#72H MOV A,72H
After instruction MOV A,72H the content of 72 th byte of RAM will replace in Accumulator.

Note 2:
MOV A,R3 MOV A,3
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.