Instruction set-3 of 8051

Page 1


8051 Instruction set-3

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


Logical Operation Group And specified register content to Accumulator ANL A, Rn 1 ANL A, R5 Acc Acc .and. R5 And internal memory content to Accumulator ANL A, direct Acc 0010 0010 2 ANL A, 14h 14h 0101 0101 Acc

00

22 .and. 55


Arithmetic Operation Group And specified memory content to Accumulator ANL A, @Ri 1 ANL A, @R0 Acc Acc .and. @R0 And immediate data to Accumulator ANL A, #data Acc 0011 0011 2 ANL A, #55h data 0101 0101 Acc

11

33 .and. 55


Arithmetic Operation Group And internal memory content with Accumulator ANL direct, A Acc = 0010 0010 2 ANL 14h, A (14h) = 0110 0110 (14h)

22

22 .and. 66

And immediate data with internal memory content ANL direct, #data (23h) = 0011 0011 3 ANL 23h, #55h data = 0101 0101 (23h)

11

33 .and. 55


Logical Operation Group OR the specified register with Accumulator ORL A, Rn 1 ORL A, R5 Acc Acc .or. R5 OR the internal memory with Accumulator ORL A, direct Acc 0010 0011 2 ORL A, 14h 14h 0101 0101 Acc

77

23 .or. 55


Logical Operation Group OR the specified memory content with Acc. ORL A, @Ri 1 ORL A, @R0 Acc Acc .or. @R0 OR the immediate data with Accumulator ORL A, #data Acc 0011 0011 2 ORL A, #22h data 0010 0010 Acc

33

33 .or. 22


Logical Operation Group OR the Accumulator with internal memory content ORL direct, A Acc = 0010 0010 2 ORL 14h, A (14h) = 0100 0100 (14h)

66

22 .or. 44

OR the immediate data with internal memory content ORL direct, #data (23h) = 0011 0011 3 ORL 23h, #45h data = 0100 0101 (23h)

77

33 .or. 45


Logical Operation Group XRL the specified register with Accumulator XRL A, Rn 1 XRL A, R5 Acc Acc .xr. R5 XRL the internal memory with Accumulator XRL A, direct Acc 0010 0011 2 XRL A, 14h 14h 0101 0101 Acc

76

23 .xr. 55


Logical Operation Group XRL the specified memory with Accumulator XRL A, @Ri 1 XRL A, @R0 Acc Acc .xr. @R0 XRL the immediate data with Accumulator XRL A, #data Acc 0011 0011 2 XRL A, #22h data 0010 0010 Acc

11

33 .xr. 22


Logical Operation Group XRL the Accumulator with internal memory content XRL direct, A Acc = 0010 0010 2 XRL 14h, A (14h) = 0100 0101 (14h)

67

22 .xr. 45

XRL the immediate data with internal memory content XRL direct, #data (23h) = 0011 0011 3 XRL 23h, #45h data = 0100 0101 (23h)

76

33 .xr. 45


Logical Operation Group Rotate Accumulator content to the Left Bit 7 is rotated into the bit 0 position. No flags are affected

RL A

1

Acc = 44

01000100

Acc = 88

Rotate Accumulator content to Left through Carry flag Bit 7 moves into the Carry flag, original Cy flag moves into the bit 0 position. No other flags are affected

RLC A Acc = 44

Cy = 1 Acc = 89

Cy Cy = 0

01000100


Logical Operation Group Rotate Accumulator content to the Right Bit 0 is rotated into the bit 7 position. No flags are affected

RR A

1

Acc = 44

01000100

Acc = 22

Rotate Accumulator content to Right through Carry flag Bit 0 moves into the Carry flag, original Cy flag moves into the bit 7 position. No other flags are affected

RRC A Acc = 44

Cy = 1 Acc = A2

Cy Cy = 0

01000100


Logical Operation Group Swap nibbles within the Accumulator 1 SWAP A Interchanges the Low and High order nibbles of the accumulator. This operation is equivalent to four bit rotate instruction. No flags are affected.

Acc = 15h

SWAP A Acc = 51h


Instruction Set 5 groups     

Data Transfer group Arithmetic operation group Logical operation group Boolean variable manipulation Program & Machine control


Boolean Operation Group Clear the Carry flag CLR C 1 CLR C Cy

0

Clear the specified bit CLR bit 2 CLR P1.5 The indicated bit is reset to zero. No flags are affected

P1

01010001

01110001


Boolean Operation Group Set the Carry flag SETB C 1 SETB C Cy

1

Set the specified bit SETB bit 2 SETB P1.5 The indicated bit is set to one. No flags are affected

P1

00100001

00000001


Boolean Operation Group Clear the Accumulator. No flags are affected CLR A 1 CLR A Acc 0000 0000

Complement the Accumulator content. CPL A 1 CPL A No flags are affected

Acc

1111 1110

0000 0001


Boolean Operation Group Complement the carry flag 1 CPL C Cy 0 Cy 1

1 0

Complement the specified bit. 2 CPL bit CPL P1.0 P1 P1

0000 0000 0000 1111

0000 0001 0000 1110


Boolean Operation Group Logical-AND the specified bit with Cy flag. No other flags are affected ANL Cy, bit 2 ANL Cy, Acc.7 2 ANL Cy, P1.5 AND the complement of specified bit with Cy flag. No other flags are affected ANL Cy, /bit 2 ANL Cy, /Acc.7 2 ANL Cy, /P1.5


Boolean Operation Group Logical-OR the specified bit with Cy flag. No other flags are affected ORL Cy, bit 2 ORL Cy, Acc.7 2 ORL Cy, P1.5 OR the complement of specified bit with Cy flag. No other flags are affected ORL Cy, /bit 2 ORL Cy, /Acc.7 2 ORL Cy, /P1.5


Boolean Operation Group Move bit data. No other register or flags are affected MOV Cy, bit 2 MOV Cy, Acc.7 2 MOV Cy, P1.5

2 2

MOV bit, Cy MOV Acc.5, Cy MOV P3.2, Cy



Avoid Plastics Plant a Tree Let us take care of our earth for future generation


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.