8051 Instruction set-1
R. Theagarajan. ME., MSc., PhD Rtd. Professor in Engineering email: rtheagarajan@yahoo.com rtrajan59@gmail.com
Instruction Set 5 groups
Data Transfer group Arithmetic operation group Logical operation group Boolean variable manipulation Program & Machine control
Data Transfer Group Move specified register content to Accumulator 1 Mov A, Rn 11101rrr Mov A, R5 Move internal memory content to Accumulator 2 Mov A, direct Mov A, 14h 1 Mov A, @Ri Mov A, @R0
Move immediate data to Accumulator 2 Mov A, #data Mov A, #50h
Data Transfer Group Move Accumulator content to specified register 1 Mov Rn, A 11111rrr Mov R0, A Move internal memory content to specified register 2 Mov Rn, direct Mov R1, 23h
Move immediate data to specified register 2 Mov Rn, #data Mov R3, #32h
Data Transfer Group Move Accumulator to internal memory Mov direct, A 11110101 2 Mov 41h, A direct address Move register content to internal memory Mov direct, Rn 10001 rrr 2 Mov 14h, R2 direct address
Move internal memory to internal memory 3 Mov direct, direct - Mov 32h, 41h
Data Transfer Group Move content of internal memory pointed by Ri to another internal memory location Mov direct, @Ri 2 Mov 41h, @R0 Move immediate data to internal memory Mov direct, #data 3 Mov 32h, #50h
Data Transfer Group Move Accumulator to internal memory pointed by Ri Mov @Ri, A 1 Mov @R1, A Move memory content to int. memory pointed by Ri Mov @Ri, direct 2 Mov @R0, 50h
Move immediate data to int. memory pointed by Ri 2 Mov @Ri, #65h Mov @R1, #65h
Data Transfer Group Destination
Source
Accumulator
Register
Rn
Register
Direct
address
Direct
Indirect
R0, R1
Indirect
# data
Immediate
Data Transfer Group Move Data-pointer with 16 bit number Mov DPTR, #data16 DPH 3 Mov DPTR, #1234h DPL
12 34
Move data from external memory to Accumulator 1 Movx A, @DPTR 1 Movx A, @Ri 5020 Accumulator
35
15 25 35
Data Transfer Group Move code byte relative to DPTR to Accumulator 1 Movc A, @A+DPTR 1 Movc A, @A+PC Accumulator = 01 CALL TOP 5000 Top: INC A 5001 MOVC A, @A+PC 5002 RET 5003 DB 66 5004 DB 77 5005 DB 88 5006 DB 99 Accumulator = 77
Data Transfer Group Move data to external memory from Accumulator 1 Movx @DPTR, A 1 Movx @Ri, A 5020 Accumulator
30
10 20 30
Data Transfer Group Copy the specified register or memory content into stack memory Push direct 2 Push 40h
DPTR = 1234h Push DPL Push DPH
SP = 07 08 = 34 09 = 12 SP = 09
Data Transfer Group Copy the content from stack memory to the specified register or memory Pop direct 2 Pop 50h
DPTR = 0000h Pop DPH Pop DPL DPTR = 1234h
SP = 09 09 = 12 08 = 34 SP = 07
Data Transfer Group Exchange the content of Accumulator and specified register or memory 1 XCH A, Rn Accumulator = 33
R5 = 44
XCH A, R5 Accumulator = 44
R5 = 33
1 XCH A, direct Accumulator = 22
50h = 66
XCH A, 50h Accumulator = 66
50h = 22
Data Transfer Group Exchange the content of Accumulator and specified internal memory pointed by Ri 1 XCH A, @Ri Accumulator = 11
R0 = 55
memory = 75
R0 = 55
memory = 11
R1 = 66
memory = 72
R1 = 66
memory = 77
XCH A, @R0 Accumulator = 75
1 XCHD A, @Ri Accumulator = 27
XCHD A, @R1 Accumulator = 22
Avoid Plastics Plant a Tree Let us take care of our earth for future generation