A lot depends on the accuracy you need. If the values in the table that aerostar 'pointed to' are good enough, then
Create an array that has an element for every listed altitude in the table.
Using the formula that you mention, calculate the A/D value for each of the cells of the array. And fill the array with those A/D values.
Filling the array with A/D values rather than pressures will save your PIC a lot of processing time (EXCEL can help you save a lot of work by doing the calcs).
Create a second array with the altitudes represented by the cells in the first array. Cell #0 = 0 (feet), cell #1 = 50 (feet), cell #2 = 100 etc.
In your program, get an A/D count and compare it against every cell in array #1 starting with the first. Just as an example, assume that array element #19 has a value of 493 and element number #20 has a value of 470. If your A/D has a result of 482, and you worked through the array, you would find that the first cell where your A/D count was larger was cell #19. Now you can check the value of element #19 in Array 2. There is your altitude.
If you need more accuracy, you will have to interpolate. That is what I was referring to in the earlier post. But if you don't need that kind of accuracy, there is no need to explain further. If you do, I'll explain that later.
Bookmarks