Quote:
|
Originally Posted by Greg Marra
Sweet.
We were considering using the EEPROM when we ran out of code space last year, and this ought to make it a lot easier to do.
Thanks!
|
Yes, EEPROM is a great place to locate, for example, trigonometric lookup table(s). A little piece of of code like this:
Code:
#include <math.h>
#include "eeprom.h"
unsigned int i;
unsigned char data;
//create a zero to ninety degree lookup table
for(i=0; i<=90; i++)
{
// wait, if necessary, for a free slot on the circular queue
while(EEPROM_Queue_Free_Space() == 0);
// normalize the output to the maximum value a byte variable can hold
data = (unsigned char)(255.0 * sin((float)i * 3.14159 / 180.0));
EEPROM_Write(i, data);
}
will generate one quadrant of a sine lookup table in EEPROM. Execute the code and you'll have a semi-permanent table in EEPROM that will allow you to very quickly solve sin(x) and cos(x).
-Kevin