Instruction set-2 of 8051

Page 1


8051 Instruction set-2

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


Arithmetic Operation Group Add specified register content to Accumulator ADD A, Rn 1 ADD A, R5 Acc Acc + R5 Add internal memory content to Accumulator ADD A, direct Acc 23 2 ADD A, 14h 14h 56 Acc

23 + 56


Arithmetic Operation Group Add specified memory content to Accumulator ADD A, @Ri 1 ADD A, @R0 Acc Acc + @R0 Add immediate data to Accumulator ADD A, #data Acc 23 2 ADD A, #45h data 45 Acc

23 + 45


Arithmetic Operation Group Add register content and Carry to Accumulator ADDC A, Rn 1 ADDC A, R5 Acc Acc + R5 + Cy Add memory content and Carry to Accumulator ADDC A, direct Acc 20 2 ADDC A, 14h 14h 54 Cy 1 Acc 20 + 54 + 1


Arithmetic Operation Group Add memory content and Carry to Accumulator ADDC A, @Ri 1 ADDC A, @R0 Acc Acc + @R0 + Cy Add immediate data and Carry to Accumulator ADDC A, #data Acc 32 2 ADDC A, #23h data 23 Cy 1 Acc 32 + 23 + 1


Arithmetic Operation Group Subtract register content and Borrow from Acc. SUBB A, Rn 1 SUBB A, R5 Acc Acc - R5 - Cy Subtract internal memory content and Borrow from Accumulator SUBB A, direct Acc 67 2 SUBB A, 14h 14h 55 Acc

67 – 55 - Cy


Arithmetic Operation Group Subtract memory content & Borrow from Acc. SUBB A, @Ri 1 SUBB A, @R0 Acc Acc - @R0 - Cy Subtract immediate data & Borrow from Acc. SUBB A, #data Acc 56 2 SUBB A, #45h data 45 Acc

56 – 45 - Cy


Arithmetic Operation Group Increment the Accumulator content INC A 1 INC A Acc Acc + 1

Increment the specified register content INC Rn 1 INC R0 R0 R0 + 1


Arithmetic Operation Group Increment the direct memory content INC direct 2 INC 41h (41h) (41h) + 1

Increment the specified memory content INC @Ri 1 INC @R1 (@R1) (@R1) + 1


Arithmetic Operation Group Increment the 16 bit Data Pointer by 1 1 INC DPTR INC DPTR (DPTR) (DPTR) + 1 DPH DPL

DPH DPL

12h FEh INC DPTR INC DPTR INC DPTR 13h 01h


Arithmetic Operation Group Decrement the Accumulator content DEC A 1 DEC A Acc Acc - 1

Decrement the specified register content DEC Rn 1 DEC R5 R5 R5 - 1


Arithmetic Operation Group Decrement the direct memory content DEC direct 2 DEC 41h (41h) (41h) - 1

Decrement the specified memory content DEC @Ri 1 DEC @R1 (@R1) (@R1) - 1


Arithmetic Operation Group Multiply unsigned Accumulator and B register contents MUL AB Result-Low order byte Result-High order byte

Acc B register

Carry flag is always cleared If the result is more than 255, the OV flag is set


Arithmetic Operation Group Divide unsigned Accumulator content by unsigned B register content DIV AB Result - Quotient Result - Remainder

Acc B register

Carry and Over-flow flags will be cleared


Arithmetic Operation Group Decimal adjust Accumulator for Addition DA A This instruction adjusts the eight bit value in the accumulator, producing the proper BCD digit If the accumulator bits 3-0 are greater than nine, or if the AC flag is one, six is added to the accumulator producing the proper BCD in the low order nibble. If the accumulator bits 7-4 are greater than nine, or if the Cy flag is one, six is added to the accumulator producing the proper BCD in the high order nibble. This instruction cannot simply convert a hexadecimal number in the accumulator to BCD notation.



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.