Look up Table is a powerful technique used for computing data of a non linear function. For example, the resistance of typical NTC thermistors do not vary linearly with the temperature change. If you supply a constant current source to an NTC thermistor you will obtain a voltage value that can be read by the ADC input, but the readings do not vary linearly with the temperatures and therefore you can't simply use a formula to calculate the temperature corresponding to a particular analog reading.
However, since all thermistor manufacturers supply resistance vs temperature tables for their thermistor, you can therefore compute the corresponding ADC values and enter these values into a "look up table". When you obtain an ADC reading you can then search the LUT to find the temperature that match the analog reading.
Of course very often the data obtained may not match the LUT data exactly since the table only provide discrete data points, a linear interpolation technique is typically used to find data that fall between two table points.
Other uses of LUT can be to compute the square, trigonometric or logarithm function and their inverse without floating point support.
To assist user in implementing a LUT quickly, we are providing two LUT examples which can be downloaded from the following link:
http://www.tri-plc.com/download/LookupTables.zipOne of the example implements a square and a square root function, and the other implements a SINE and Inverse SINE function. These two programs are almost identical except for the data values that are stored into the lookup table.
You can copy the standard lookup table functions supplied in the sample program and use them in your program immediately without modification. All you need to modify is the INIT function that populate the lookup table with data that are relevant to your project. Using the supplied code you should find it very easy to implement other look up tables such as COSINE, LOG, pressure sensor, force sensors etc.
? Last Edit: Today at 05:52:03pm by support ?