8051 PPT
8051 PPT
8051 PPT
8051
UNIT-V
A single chip
Applications
Appliances
(microwave oven, refrigerators, television and VCRs, stereos)
Automobiles
(engine control, diagnostics, climate control),
Environmental control
(factory, home)
Instrumentation
Aerospace
Robotics, etc...
Popular Microcontrollers
8048 (Intel)
Z8 (Zilog)
MC14500 (Motorola)
Part
memory
Addressing Modes
Direct
Register
Register Indirect
Immediate
Indexed
MOV A, 4
MOV 6, 2
; MOV A, R4
; copy R2 to R6
; MOV R6,R2 is invalid !
MOV A,@A+DPTR
MOV A,@A+PC
MOV dest,source
; dest = source
MOV A,#72H
;A=72H
MOV R4,#62H;R4=62H
MOV B,0F9H
;B=the content of F9th 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 72th byte of RAM will
replace in Accumulator.
Note 2:
MOV A,R3
MOV A,3
ADD A, Source
;A=A+SOURCE
ADDA,#6
;A=A+6
ADDA,R6
;A=A+R6
ADD
A,6
;A=A+[6] or A=A+R6
ADD
A,0F3H
;A=A+[0F3H]
SUBB A, Source
;A=A-SOURCE-C
SUBB
A,#6
;A=A-6
SUBB
A,R6
;A=A+R6
MUL
AB ;B|A = A*B
MOV
A,#25H
MOV
B,#65H
MUL
AB ;25H*65H=0E99
;B=0EH, A=99H
DIV
MOV
MOV
DIV
AB ;A = A/B, B = A mod B
A,#25H
B,#10H
AB ;A=2H, B=5H
SETB bit
CLR bit
; bit=1
; bit=0
SETB
SETB
SETB
SETB
SETB
; CY=1
;bit 0 from port 0 =1
;bit 7 from port 3 =1
;bit 2 from ACCUMULATOR =1
;set high D5 of RAM loc. 20h
C
P0.0
P3.7
ACC.2
05
Note:
DEC
INC
byte
byte
;byte=byte-1
;byte=byte+1
INC
DEC
DEC
R7
A
40H
; [40]=[40]-1
RR RL RRC RLC A
EXAMPLE:
RR
A
RR:
RRC:
RL:
RLC:
CPL
Example:
MOV
CPL
;1s complement
A,#55H ;A=01010101 B
A
Jumps :
JZ
Jump if A=0
JNZ
Jump if A/=0
DJNZ
CJNE A,byte
Jump if A/=byte
CJNE reg,#data
Jump if byte/=#data
JC
Jump if CY=1
JNC
Jump if CY=0
JB
Jump if bit=1
JNB
Jump if bit=0
JBC
LJMP(long jump)
LJMP is an unconditional jump. It is a 3-byte instruction. It
allows a jump to any memory location from 0000 to FFFFH.
AJMP(absolute jump)
In this 2-byte instruction, It allows a jump to any memory
location within the 2k block of program memory.
SJMP(short jump)
In this 2-byte instruction. The relative address range of 00FFH is divided into forward and backward jumps, that is ,
within -128 to +127 bytes of memory relative to the address of
the current PC.
CALL Instructions
Another control transfer instruction is the CALL
instruction, which is used to call a subroutine.
LCALL(long call)
This 3-byte instruction can be used to call
subroutines located anywhere within the 64K byte
address space of the 8051.
ACALL (absolute call)
ACALL is 2-byte instruction. the target
address of the subroutine must be within 2K
byte range.
THANK YOU