
Chapter 12 Device Logic (Pawn)
native CalcTable(key, &value, const table[][TablePoint], size = sizeof table);
Searches for a certain value in the "key" column of the transferred reference point table and supplies
the relevant value from the "value" column in the table. If the searched value is between two reference
points, the returned value is interpolated linearly between the two adjacent values in the "value" column
(linear equation: y = k*x + d). Non-linear characteristic curves (e.g. connection between ADC value ->
temperature) can be reproduced with this function.
Parameter
Explanation
key
Value that is used for the search
value
Includes the result of the calculation by the function
table
The table that is searched must be a "TablePoint" type table.
size
Number of rows in the table
Explanation
Return value
l
OK, if the relevant value was found
l
TAB_ERR_FLOOR, if the searched value is lower than the first table entry.
"value" contains the first table entry.
l
TAB_ERR_CEIL, if the searched value is higher than the last table entry.
"value" contains the last table entry.
l
< OK, if another error occurs (see "Return codes for general purposes" in
chapter "Constants" on page 84).
Note:
Additional explanation on the "
table
" reference point table
The rows of the table can be displayed in an x/y coordinate system. The values in the "key" column are
displayed on the X axis and the associated values in the "value" column are displayed on the Y axis.
Display of the reference point table as an x/y coordinate system
native CalcTableF(Float:key, &Float:value, const table[][TablePointF], size = sizeof table);
The functionality is the same as that of the "CalcTable" function. The difference is that "Float" is the data
type for all elements of the "CalcTableF" function.
Rev. 01
141