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: Christian Ludlam
Subject: Re: [avr-gcc-list] Re: Structs in program memory.
Date: Tue, 11 May 2004 17:18:50 +0100
User-agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.05) POPstar/2.05

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


reply via email to

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