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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Andy Neil
04/27/02 09:13
Read: 2877 times
Basingstoke
Uk


 
#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      Muhammad Sajjad      04/27/02 00:06      
RE: what is lookup tabels and how they work      Andy Neil      04/27/02 09:13      
RE: what is lookup tabels and how they w      Steve M. Taylor      04/27/02 15:43      
RE: what is lookup tabels and how they work      Phillip M Gallo      04/27/02 17:56      
RE: what is lookup tabels and how they work      YASHWANTH Y.V.      04/28/02 09:54      
RE: when not to use a lookup table      J. Guy      04/28/02 10:58      
RE: when not to use a lookup table      Phillip M Gallo      04/28/02 21:47      
RE: when not to use a lookup table      Muhammad Sajjad      04/29/02 05:10      

Back to Subject List