Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: This assembly oughta be something silly...Thanks

2005-06-15 by alex_de_lara

No, I am not confused. 

I wasn't intending to store anything in SRAM. I just wanted it 
defined and reserved, no matter where, as long as I could 
get the bytes one by one.

Since this is a fixed text there is no need to copy to RAM
or EEPROM to use it later. That yes, would be waste of cpu :-)

What I was missing are the specific concepts :

LD  - loads from the SRAM 
LPM - loads from the FLASH (which they call it program)

The instruction set doc is a little confusing, since I was 
trying to apply previous concepts ( z80, 8085, 8088 etc...)
It's probably more than enough once I get the full hang of 
the AVR family.

>> then use an EEPROM reading routine to get it

So I am assuming from this that there will be similar quirks 
to access eeprom... alright !

Thank you all for the enlightenments.

-Alex

--- In AVR-Chat@yahoogroups.com, John Samperi <samperi@a...> wrote:
> At 05:20 AM 16/06/2005, you wrote:
> >My string is actually in the code space, which is fine since
> >right now I just need it to be in someplace.
>  >.dseg
>  >Test_str:
>     .db      "The old brown fox jumps over the lazy dog."
>     .db      0x0d, 0x0a, 0

> I think you are confused. You CANNOT store your string
> in ram that way. You can use either .cseg and put it in
> flash and then use the LPM instruction as others have
> pointed out.
 
> You can put into EEPROM using .eseg and then use an EEPROM
> reading routine to get it out of EEPROM.
> 
> OR
> 
> You can put it in flash as above, copy it to ram at run
> time and THEN use ld    r16,Z+ to retrieve it. At present
> you are to reading from ram that may not be there
> (i.e. 0xff data)

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.