Lookup Table Implementation
Rational Statemate allows the definition of lookup tables to represent the type of non-linear Y=F(X) functions that are so common in the world of microcontrollers. The data for a lookup table can be defined manually in Rational Statemate, or imported from any ASCII data file. You can elect to have linear interpolation between defined points, or a histogram-like mode. Upper and lower bounds can be defined, as can the search order to use (low-to-high, high-to-low).
In the sample lookup table below, the input is defined as Integer, and the return value of the function is defined as Real.
Using the settings linear interpolation, high-to-low search order, lower bound = 0, upper bound = 4, the following code will be generated:
Out = (Y2-Y1)/(X2-X1)*(In-X1)+Y1
LOOKUP1_retval = (4 - 3)/((double)1000 - 100)*(IN1 -
LOOKUP1_retval = (3 - 2)/((double)100 - 10)*(IN1 -