|
Pelatihan
Dasar Mikrokontroller
14-15 April 2007
Surabaya
Rp. 300.000
Microcontroller Kits
Programmer
and Target 89s51
Rp.100.000
(USD $10)
Simple
Mikrokontroller 89s51 Trainer
Rp, 350.000
(USD $35)
Standart
Mikrokontroller 89s51 Trainer
Rp. 650.000
(USD $65)
Super
Mikrokontroller Trainer 89s51
Rp.1.250.000
(USD $125)
 |
|
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
|
|
Programmer
ISP
89s
Free Software
a. Edsim 51
b. MIDE-51
c. ATMEL ISP
Lesson 1:
Architecture
1.1.Memory
1.2.SFR
1.3.Addressing
1.4.Instruction
Set
1.5.Assignment
Lesson 2:
Input Output
2.1.LED
2.2.Swicht
2.3.7
Segmen
2.4.LCD
Character
2.5.ADC
2.6.DAC
2.7.Motor
Stepper
2.8.Keypad
2.9.Assignment
Lesson 3:
Timer Counter
3.1.Basic
3.2.Mode
0
3.3.Mode
1
3.4.Mode
2
3.5.Mode
3
3.5.Assignment
Lesson 4:
Serial Comm.
4.1.Basic
4.2.LED
4.3.Rotate
LED
4.2 ADC
4.3.LCD
4.4.Assignment
Lesson 5:
Interuption
5.1.Basic
5.2.Timer
5.2.External
5.3.Assignment
|