storing calculated values into PROGMEM


i trying generate table of calculated values , store them in progmem examples show static data (e.g. know data stored , putting in variable declaration).

here example of (but not work):
code: [select]

#include <avr/pgmspace.h>

#define tablesize 1024

progmem prog_uint16_t datatable[tablesize];


void setup() {
 for (int i=0; i<256; i++) {
   datatable[m] = int(float(m*m/1023.0));

  serial.begin(9600);
}

void loop() {
unsigned int displayint;
int k;    // counter variable

// read 2-byte int
for (int k=0; k<tablesize; k++) {
displayint = pgm_read_word_near(datatable + k)
serial.println(displayint);
}

}


should use 1 of progmem libraries?
should write app generate these values , copy them in program before compiling?
 

quote
i trying generate table of calculated values , store them in progmem examples show static data (e.g. know data stored , putting in variable declaration).

the progmem unable store non-const data far know.

quote

should write app generate these values , copy them in program before compiling

yes. :)


i curious:
why can't use function 1 proposed here: http://www.arduino.cc/cgi-bin/yabb2/yabb.pl?num=1248272002/10#1 ?  :)


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > storing calculated values into PROGMEM


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums