Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/16/00 08:38
Read: times


 
#2685 - RE: On more question on 8051
I'm not exactly sure what you want to do, Jack. If its just a case of copying a block of internal rom (code space) to external ram, then check out the instructions movc (moves a code byte to the accumulator) and movx to move it to external ram. Info in the tutorials section. Both of these instructions can use the data pointer (DPTR) to address the source / destiantion byte. If the sections of memory are a nice number apart (e.g. 08000h as you imply) then it gets easier.

You never know - this might even work. My excuse is I have never used external ram before.

; Affects - Accumulator, DPTR
mov dpl, #0

memcpy:
mov dph, #0 ; Data pointer contains 0

clr acc
movc A, @A+DPTR ;Move from code address 0 to accumulator

mov dph, #080h ; Data pointer now contains 8000h + dpl

movx @dptr, a ; Copy the byte out to external ram

inc DPTR ; Set the address for the next location

mov a, dpl

jnz memcpy ; Back to the start unless we have done
; 255 bytes, and dpl has wrapped beck to zero

This should copy 255 bytes from 0 - ff in code space to external ram from 8000 to 80ff.
If this is what you want to do, I'd love to know if it works. I have no boards with external ram, so can't test it. (All the stuff we do is really small)


List of 5 messages in thread
TopicAuthorDate
On more question on 8051            01/01/70 00:00      
RE: On more question on 8051            01/01/70 00:00      
RE: On more question on 8051            01/01/70 00:00      
RE: On more question on 8051            01/01/70 00:00      
RE: On more question on 8051            01/01/70 00:00      

Back to Subject List