Data Transfer 80C51

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]
V
V
V
V
1
Mov [dest],A [dest]=A
V
V
V
V
1
Mov [dest],[src] [dest]=[src]
V
V
V
V
1
Mov DPTR,#data16 DPTR=16 bit immediate const
Accumulator Only
1
Push [src] Inc SP
V
V
V

1
Pop [src] Dec SP
Data Pointer Only
2
Xch A, [byte] Acc and [byte] exchange data
Accumulator Only
1
Xchd A,@Ri Acc and @Ri exchange low nibbles
V
V
V

1
;Lesson 1.4.1.

Org 0h
Start: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 0h
Start: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

No comments:

Post a Comment


Dengan Mozilla Firefox --- Website Terbuka Optimal Dengan Resolution 1024 768 Pixels ---- By MASTER DIGITAL Powered By ARYANTO