Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Reading from flash in Assembly

2004-12-03 by John Samperi

At 10:54 AM 3/12/04 -0000, you wrote:
>
>Ok, and the final soloution is ;-
>
>mov r30, step
>ldi r31, high(array<<1)
>add r31, num
>lpm r18, z
>out portd, r18
>
>As I'm only using Bytes not Words, I didn't need to left shift the ZL (r30)
>value.

But DOES IT WORK? :-) The flash is in 2 byte lots (16 bit) that is the reason
you need to multiply by 2 to get to the address.

What happens if the data is the 2nd byte of the array? It seems to me that
you need at least 1 multiplication and 2 16 bit additions to get it working
anywhere in  flash. If the above works well I have to redo some of my
code that gets the data from a character set lookup table (224 rows, 7
columns).

I don't quite understand how it would work... but then again I may have it
all wrong as I don't have the original post anymore.

Regards

John Samperi

******************************************************
                        Ampertronics Pty. Ltd.
  11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
         Tel. (02) 9674-6495       Fax (02) 9674-8745
               Email: samperi@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.