Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/27/02 15:13
Read: times


 
#22213 - RE: what is lookup tabels and how they work
"I am new to microcontrollers"

It's a general programming technique - not restricted to microcontrollers (even Excel has lookup tables!)

In fact, the answer is all in the name; it's just a table (or "array" in programmer speak) in which you look-up a value to find the answer to some question.

I hope you're familiar with the mathematical notation
y = f(x)
which means, the value of y is related to the value of x by some function f
In 'C', we could implement this using a lookup table (array):
y = f[x]
f is an array in which each element contains the value of y corresponding to the index x

One application is in implementing trig functions; eg,
int sin_table[] = 
{
       0, // 1000 * sin(0)
      17, // 1000 * sin(1)
      35, // 1000 * sin(2)
       :
     500, // 1000 * sin(30)
       :
     707, // 1000 * sin(45)
       :
    1000  // 1000 * sin(90)
};
Note the factor of 1000 - to give useful integer values (sometimes known as "fixed point")

List of 8 messages in thread
TopicAuthorDate
what is lookup tabels and how they work            01/01/70 00:00      
RE: what is lookup tabels and how they work            01/01/70 00:00      
RE: what is lookup tabels and how they w            01/01/70 00:00      
RE: what is lookup tabels and how they work            01/01/70 00:00      
RE: what is lookup tabels and how they work            01/01/70 00:00      
RE: when not to use a lookup table            01/01/70 00:00      
RE: when not to use a lookup table            01/01/70 00:00      
RE: when not to use a lookup table            01/01/70 00:00      

Back to Subject List