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
For example, the ADD A,
ADD a, 7FH (direct addressing)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.
ADD A, @R0 (indirect addressing)
ADD a, R7 (register addressing)
ADD A, #127 (immediate constant)
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+ | V | V | V | V | 1 |
Subb A,[byte] | A=A-[byte] | V | V | V | V | 1 |
Inc A | A=A+1 | Accumulator Only | 1 | |||
Inc [byte] | [byte] | V | V | V | 1 | |
Inc DPTR | DPTR=DPTR+1 | Data Pointer Only | 2 | |||
Dec A | A=A-1 | Accumulator Only | 1 | |||
Dec [byte] | [byte] | V | V | V | 1 | |
Mul AB | B:A=BxA | Accumulator and B Only | 4 | |||
Div AB | A=Int[A/B] | Accumulator and B only | 4 | |||
DA A | Dec Adjust | Accumulator Only | 1 |
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] | [byte] | V | V | V | V | 1 |
Anl [byte] | [byte] | V | V | V | V | 1 |
Orl A,[byte] | A=A or [byte] | Accumulator Only | 1 | |||
Orl [byte] | [byte] | V | V | V | 1 | |
Orl [byte] | [byte] | Data Pointer Only | 2 | |||
Xrl A,[byte] | A=A xor [byte] | Accumulator Only | 1 | |||
Xrl | [byte] | V | V | V | 1 | |
Xrl [byte] | [byte] | 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 |
No comments:
Post a Comment