|
From: | Bart McCoard |
Subject: | [avr-gcc-list] progmem |
Date: | Mon, 19 Mar 2001 08:02:03 -0600 |
Greetings,
Does anyone know of an easy way to access a long in program memory? I want to build a lookup table in program memory and then access it to perform calculations. I know that I can call the PRG_RDB(temp_table[index]); function 4 times to build the long. Is there a better way? I'm also not sure how to define a (byte*) pointer to program memory so that I can access each byte individually when building up the long value. Any help would be appreciated.
#define tc 128
__attribute__ ((progmem)) long temp_table[] = {-50.00*tc,-49.32*tc,-35.78*tc,-27.24*tc,-20.68*tc,-15.24*tc,-10.45*tc,
-6.183*tc,-2.202*tc, 1.516*tc, 5.055*tc, 8.503*tc, 11.83*tc, 15.11*tc,
18.40*tc, 21.69*tc, 25.00*tc, 28.37*tc, 31.83*tc, 35.40*tc, 39.15*tc,
43.10*tc, 47.32*tc, 51.87*tc, 56.87*tc, 62.43*tc, 68.87*tc, 76.53*tc,
86.27*tc, 96.28*tc, 108.8*tc, 110.0*tc, 110.0*tc};
long out, p1, p2;
p1 = temp_table[index];
p2 = temp_table[index+1];
out = p2-p1;
Thanks!
Bartman
[Prev in Thread] | Current Thread | [Next in Thread] |