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