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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/18/02 02:41
Read: times


 
#21870 - RE: help with memory mappind and LCD´s m
Hello Steve!

I'm already using "MOV DPTR,#xxxxH" and "MOVX @DPTR,A", but this don't work for me since I want to change data in the workspace memory area, not in the external memory area.

Let's suppose that I want to show a message in the LCD:

=================

MOV DPTR, message ; storing the message start (2000h in the WORKSPACE area, right?) in the DPTR

LCALL lcdmsg ; calling the LCD message routine, that uses DPTR as the message start

org 2000h
message:
DB 'good MORning!', 00h

==================

That program would display:

good MORning!

in the LCD and thats correct. Now suppose that my program also has a clock and change the message according the time. And now is evening, so the program do:

==================

chgmsg:
MOV DPTR, message+6 ; storing the position of letter 'M' in DPTR

MOV A,'E' ; storing the letter 'E' in Acc
MOVX DPTR, A ; storing the letter 'E' at the memory position 2006h in the EXTERNAL memory area, right?
inc DPTR ; next letter to change ('O')

MOV A,'V' ; storing the letter 'V' in Acc
MOVX DPTR, A ; storing the letter 'E' at the memory position 2007h in the EXTERNAL memory area, right?
inc DPTR ; next letter to change ('R')

MOV A,'E' ; storing the letter 'E' in Acc
MOVX DPTR, A ; storing the letter 'E' at the memory position 2008h in the EXTERNAL memory area, right?

LCALL lcdmsg ; calling the LCD message routine, that uses DPTR as the message start
;the message displayed in the LCD is:
;good MORning!
;this is wrong :-(
===========================================

What I wold to appear in the LCD is:

good EVEning!

but since the data was changed in the EXTERNAL memory and my LCD routine is looking for data in the WORKSPACE memory it won't happen :-(

It wouldn't happen in the development kit that I used since it worked using the external memory as the workspace memory.

I just don't know how to change data in the workspace area since I can't figure how to address (and change!) a memory position in the workspace area! I think that it is possible, but I just can't figure how, since I never had to worry about this before!

I'm sorry if I don't expressed myself clearly (or understood you clearly), but English isn't my first language.

Any advices about the example that I put here?

TIA

orlando

Steve M. Taylor wrote:
-------------------------------
You have it all already. The only 16 bit regsiter in an 8052 is the DPTR, move a 16 bit address into that, say MOVX @DPTR,A and the accumulator contents get moved to the location pointed to by the DPTR.

How do you set the DPTR ?
Either directly as MOV DPTR,#0FFFEH
or
MOV DPH,#0FFh
MOV DPL,#0FEh

Since DPH (DPTR high byte) and DPL (DPTR low byte are 8 bit registers, you can (witrh care) manipulate 16 bit numbers in your code.

Steve


List of 13 messages in thread
TopicAuthorDate
help with memory mappind and LCD´s msg            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      
RE: help with memory mappind and LCD´s m            01/01/70 00:00      

Back to Subject List