Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] problems

2008-03-23 by John Samperi

At 11:59 AM 23/03/2008, you wrote:
>     lds     R22,    Z+
>......
>    What am I doing wrong, please?

Apart from what Don said, you need to use LPM to get
stuff from code space NOT LDS which is from ram.

Also the address need to be multiplied by 2 as data is sored
in bytes but the program space address is in words (16 bits)

So:
         ldi             zl,low(LABEL*2)
         ldi             zh,high(LABEL*2)
         lpm             temp,z+                 ;read char

And finally all data bytes that are not in even boundaries will
have a 0x00 added to it.

Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************

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.