Yahoo Groups archive

AVR-Chat

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

Message

Re: WinAVR / GCC question re Stack

2009-03-25 by Graham Davies

--- In AVR-Chat@yahoogroups.com, David VanHorn <microbrix@...> wrote:
>
> ... pgm_read_byte_near is returning
> values that aren't anything like
> what's in the string ...
>  LCD_Data_A = pgm_read_byte_near(BootString[i]);
>  lcd_putc(LCD_Data_A);

You're passing to pgm_read_byte_near() character values taken from data memory at the address of BootString in program memory.  I would expect some kind of warning from the compiler about the implicit cast from the char value to the pointer expected as the argument.  Do you have all the warnings turned on?

You need to pass to pgm_read_byte_near() the address of the character you want to read, thus:
LCD_Data_A = pgm_read_byte_near( &(BootString[i]) );

Graham.

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.