Thanks Charles that will certainly help me to get started.
As far as A/D readings are concerned, to get a relationship to altitude should I work backwards from the formula:

P = 0.0039 * ADval + 1.53

to get Pressure. Then I would take the pressure value and use a standard barometric chart such as the one Aerostar has linked to in this thread
to get altitude data. This data would go into one table and the A/D values into the other table?

And what if my sensor is off by some error factor. If I can determine the amount of error, should I offset all the A/D reading by a set amount
to offset the error?


Quote Originally Posted by Charles Linquis View Post
I'm sure there are equations out there, but I imagine most are a bit hard for integer math.

An approach I would use:

Assuming that your A/D readings decrease with altitude:
Build an array (array 1) with ArrayWrite that has as many points as you can easily create that contains the A/D readings of increasing altitude.

If the elements of your array are at even altitudes (100, 200, 300, 400 feet, for example), create a simple equation of altitude vs. array element.
example - element 1 = 100 feet, element 2 = 200 feet. Then the translation is element X 100 = altitude.

If the elements of your array are not at evenly spaced altutudes, they you will have to create another array (array 2) with the translation.
example - element 1 = 132 feet, element 2 = 619 feet,

Take your A/D reading and check against every element of array 1 in a for-next loop.
When the A/D is larger than the reading, note the element (n). Also note the value in element n-1.

Subtract the value of element n from the value in n-1. Call this value "DELTA". If you are using array2, do the subtraction on those elements.

Subtract the value of your A/D from the value in n. Call this value DELTA2
divide DELTA by DELTA2 (you may have to multiply and use LONGs to get adequate resolution).
Multiply the altitude difference of n and n-1 by the previous result.