[Top][All Lists]

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

Re: [avr-gcc-list] String in flash

From: Russell Shaw
Subject: Re: [avr-gcc-list] String in flash
Date: Wed, 15 Oct 2003 02:07:00 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030311 Debian/1.2.1-10

Russell Shaw wrote:
E.Weddington wrote:

I've read all the manual and header files. I've tried:
This is the way you would declare it outside a function:

#include <avr/pgmspace.h>
#include <inttypes.h>

static uint8_t hex[] PROGMEM = "0123456789abcdef";

Use the pgm_read_byte() macro to read a data value that is placed in flash such as:

val = pgm_read_byte(&(hex[3]));   // val == '3'

Sorry if the docs are confusing about this.

I tried PROGMEM and found these both give the same result:

static uint8_t hex[] PROGMEM = "0123456789abcdef";
static uint8_t PROGMEM hex[] = "0123456789abcdef";

Please disregard the last message (i got thoughroughly confused;)

reply via email to

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