PelatihanMikrokontroller
15 Januari 2011
Microcontroller Kits
Programmer and Target 89s51
Simple Mikrokontroller 89s51 Trainer
Standart
Mikrokontroller 89s51 Trainer
Super Mikrokontroller Trainer 89s51
All Kits
Include
ย
ย Data Transfer
ย
Internal RAM
Table 3 shows the menu of instructions that are available for moving data around within the internal memory spaces, and the addressing modes that can be used with each one. With a 12MHz clock, all of these instructions execute in either 1 or 2ms. The MOV <dest>, <src> instruction allows data to be transferred between any two internal RAM or SFR locations without going through the Accumulator. Remember, the Upper 128 bytes of data RAM can be accessed only by indirect addressing, and SFR space only by direct addressing.The Data Transfer instructions include a 16-bit MOV that can be used to initialize the Data Pointer (DPTR) for look-up tables in Program Memory, or for 16-bit external Data Memory accesses.
ย
Table 1.4.3. MCS-51 Data Transfer Instruction
Mnemonic |
Operation |
Addressing Mode |
Exect. |
|||
Dir |
Ind |
Reg |
Imm |
Timer uS |
||
Mov A,<src> | A=<src> |
|
|
|
|
|
Mov <dest>,A | <dest>=A |
|
|
|
|
|
Mov <dest>, <src> | <dest>=<src> |
|
|
|
|
|
Mov DPTR,#data16 | DPTR=16 bit immediate const |
Accumulator Only |
|
|||
Push <src> | Inc SP |
|
|
|
|
|
Pop <src> | Dec SP |
Data Pointer Only |
|
|||
Xch A,<byte> | Acc and <byte> exchange data |
Accumulator Only |
|
|||
Xchd A,@Ri | Acc and @Ri exchange low nibbles |
|
|
|
|
;Lesson 1.4.1.
Org 0hStart:Mov A,#1 ; put 1 into the accumulator ADD A,#2 ; add the constant 2 to Accumulator (1+2) Mov 78h,#3 ; put 3 into internal RAM 78h
ADD A, 78h ; add Acc and RAM 78h content
Mov R0, #79h; put 79 into R0 Mov @R0, #4 ; put 4 into RAM 79h ADD A,@R0 ; add Acc and RAM 79h content Mov R5, #5 ; put 5 into R5 ADD A,R5 ; add Acc and R5 end
;Lesson 1.4.2.
Org 0hStart:Mov 78h,#34h ; [ 78h ] = 34h Mov 79h,#12h ; [ 79h ] =12h Mov 7Ah,#0EFh; [ 7Ah ] = EFh Mov 7Bh,#12h ; [ 7Bh ] = 12h Mov A,78h ; A = [ 78h ] Add A,7Ah ; A = A + [ 78h ] Mov 78h,A ; [ 78h ] = A Mov A,79h ; A = [ 79h ] ADDC A,7Bh ; A = A + [ 7Bh ] + C Mov 79h,A ; [ 79h ] = A end
Comments, questions and discussion about this topic
ย
ย
ย