avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Re: Structs in program memory.


From: Douglas Dotson
Subject: Re: [avr-gcc-list] Re: Structs in program memory.
Date: Tue, 11 May 2004 15:12:34 -0700 (PDT)

I guess my concern is how do I declare a pointer to
something in program memory. Is there any special
consideration? I have an array of structs but I am
accessing the individual elements via a pointer
rather than a subscript.

Doug

--- Christian Ludlam <address@hidden> wrote:
&gt; On 11 May Douglas Dotson wrote:
&gt; 
&gt; &gt; Thanks to all for your suggestions. I'm not
&gt; &gt; clear on how to access an array of structs
by
&gt; &gt; using a pointer. Is there a way to define a
&gt; pointer
&gt; &gt; that point to program memory rahter than
data
&gt; &gt; memory?
&gt; 
&gt; To read an array in program space you have to
pass
&gt; the address of the element
&gt; to one of the read program space functions.
Instead
&gt; of
&gt; 
&gt;   a = array[1];
&gt;   
&gt; you need
&gt; 
&gt;   a = pgm_read_word(&amp;array[1]);
&gt; 
&gt; -- 
&gt; Christian Ludlam
&gt; address@hidden
&gt; 
&gt; _______________________________________________
&gt; avr-gcc-list mailing list
&gt; address@hidden
&gt; http://www.avr1.org/mailman/listinfo/avr-gcc-list



reply via email to

[Prev in Thread] Current Thread [Next in Thread]