Hello, I am writing a program that has to multiply the incoming DAC data on the ADuC812 8051 by a sixth order polynomial equation. I was wondering if anyone had any information regarding using look up tables or any good sites as I have not found the internet useful. As I have to multiply the equation by possibly 4096 steps is there a way to cut down on the possible number of values? Thank you, Marcus
mathematically, you are trying to compute y = f(x); a lookup table implementation simply treats this as
y = f[x];
Your usage of the word "multiply" seems strange. You don't usually multiply a number by an equation. Feels like what you actually is you want to evaluate that 6th order polynomial for each of your input values. On an 8051, this indeed will benefit a lot from a precomputed table, if you can afford the memory space that will consume. If you can't afford a full-size table, interpolate linearly in a smaller one. In C, using a table of 256 entries to interpolate for 4096 values:
ix = x >> 4; rx = x & (1 << 4 - 1); return ( table[ix] * (1<<4 - ix) + table[ix+1] * ix ) >> 4;
"For more sophisticated interpolation, you may have to generate a non-evenly spaced table, and search for the right place in that before you interpolate." Sounds like the old "Differences" column in 4-figure log tables...
Depending on your equation, you also might be able to factor it into a combination of several smaller lookup tables, saving memory at the cost of more computation to combine the partial results.