Tutorial Microcontroller MCS-51 ATMEL ISP

Microcontroller Kits
Programmer and Target 89s51

Simple Mikrokontroller 89s51 Trainer


Standart
Mikrokontroller 89s51 Trainer


Super Mikrokontroller Trainer 89s51

+

All Item Include

Programmer
Via USB

 

 

BACK NEXT

 1.4. Instruction Set

Arithmetic Instructions
The menu of arithmetic instructions is listed in Table 1.4.1 The table indicates the addressing modes that can be used with each instruction to access the <byte> operand.
For example, the ADD A,<byte> instruction can be written as:

         ADD a, 7FH (direct addressing)
         ADD A, @R0 (indirect addressing)
         ADD a, R7 (register addressing)
         ADD A, #127 (immediate constant) 

The MUL AB instruction multiplies the Accumulator by the data in the B register and puts the 16-bit product into the concatenated B and Accumulator registers.

The DIV AB instruction divides the Accumulator by the data in the B register and leaves the 8-bit quotient in the Accumulator, and the 8-bit remainder in the B register.

Table 1.4.1. MCS-51 Arithmetic Instruction

Mnemonic
Operation
Addressing Mode
Exect.
Dir
Ind
Reg
Imm
Timer uS
Add A,<byte> A=A+<byte>
V
V
V
V
1
Addc A,<byte> A=A+<byte>+C
V
V
V
V
1
Subb A,<byte> A=A-<byte>-C
V
V
V
V
1
Inc A A=A+1
Accumulator Only
1
Inc <byte> <byt>=<byt>+1
V
V
V
1
Inc DPTR DPTR=DPTR+1
Data Pointer Only
2
Dec A A=A-1
Accumulator Only
1
Dec <byte> <byt>=<byt>-1
V
V
V
1
Mul AB B:A=BxA
Accumulator and B Only
4
Div AB

A=Int[A/B]
B=Mod[A/B]

Accumulator and B only
4
DA A Dec Adjust
Accumulator Only
1

Logical Instructions
Table 1.4.2 shows the list of 80C51 logical instructions. The instructions that perform Boolean operations (AND, OR, Exclusive OR, NOT) on bytes perform the operation on a bit-by-bit basis. That is, if the Accumulator contains 00110101B and byte contains 01010011B, then:



Table 1.4.2. MCS-51 Logical Instructions

Mnemonic
Operation
Addressing Mode
Exect.
Dir
Ind
Reg
Imm
Timer uS
Anl A,<byte> A=A and <byte>
V
V
V
V
1
Anl <byte>,A <byte>=<byte>anl A
V
V
V
V
1
Anl <byte>,#data <byte>=<byte>and #data
V
V
V
V
1
Orl A,<byte> A=A or <byte>
Accumulator Only
1
Orl <byte>,A <byt>=<byt>orl A
V
V
V
1
Orl <byte>,#data <byte>=<byte> or #data
Data Pointer Only
2
Xrl A,<byte> A=A xor<byte>
Accumulator Only
1
Xrl<byte>,A <byt>=<byt>xor A
V
V
V
1
Xrl <byte>,#data <byte>=<byte>xor #data
Accumulator and B Only
4
CLR A

A=00h

Accumulator only
1
CPL A A= not A
Accumulator only
1
RL A Rotate A left 1 bit
Accumulator only
1
RLC A Rotate A left trough Carry
Accumulator only
1
RR A Rotate A right 1 bit
Accumulator only
1
RRC Rotate A right trough carry
Accumulator only
1
SWAP A Swap nibbles in A
Accumulator only
1

Comments, questions and discussion about this topic

BACK NEXT