avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Problem accessing bytes in program space


From: Rich Teer
Subject: Re: [avr-libc-dev] Problem accessing bytes in program space
Date: Mon, 28 Jan 2008 14:05:36 -0800 (PST)

On Mon, 28 Jan 2008, Paulo Marques wrote:

> > from elsewhere leads to data being read from God knows where:
> > 
> >     uart_puts (strcpy_P (buf, (PGM_P)pgm_read_word (&sms_keys[num][2])))
> 
> This is not what you want to do. What you want is more like (untested):
> 
> uart_puts (strcpy_P (buf, (PGM_P)(pgm_read_word(&sms_keys[num]) + 2)));

That did the trick--many thanks!

> At best, you're fetching the address of the second character of string "num",
> reading a pointer from that address, and then using that pointer to copy a
> string from.

Ah, the problem lies between my chair and keyboard.  :-)

Thanks again,

-- 
Rich Teer, SCSA, SCNA, SCSECA, OGB member

CEO,
My Online Home Inventory

URLs: http://www.rite-group.com/rich
      http://www.linkedin.com/in/richteer
      http://www.myonlinehomeinventory.com




reply via email to

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