Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

lookup tables

Status
Not open for further replies.

tresca

Member
I've never really used a lookup table before and I've read some stuff online. I'm really just posting to ensure my understanding is correct.

The project I want to implement this on is just a throbbing led. The look up table is precomputed gamma corrections for the led.

Lets say I have a small look up table...(im just making this stuff up as i go along, so these numbers dont really mean anything...yet)

int lookup[6]={10,15,26,45,25,1}

and if i want to cycle through these numbers..all i really need is a look to cycle through the indexes and do something with the number retrieved...

is that it ?
is all it really is, is just an array with determined values and giving it another name...'lookup' ?
 
Essentially, yes. A lookup table is just an array where you can store predetermined values when the cost of the storage space needed for the table is less than the cost of computing the values on the fly. I remember using them for some graphics work on pre-DX x86 processors which didn't have floating point coprocessors; it was usually more efficient to compute the trig tables at program startup and just reference those tables later than it was to try to do the math on the fly.


Torben
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top