This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Lookup Tables

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

Parents
  • 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;
    

    The '4' in there is log2(4096/256).

    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.

Reply
  • 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;
    

    The '4' in there is log2(4096/256).

    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.

Children