Well, managed to get a result in excel, :-) but my conversion to "integer" math for PBP does not work, I've tried probably 40 different variations of the code below and am still not getting a result, :-(

The excel formula works as follows:

rho: 1.225 Air Density constant

Zo: 0.75 Zero Offset

Vs: 3260 Voltage supply

Vo: 1.2 Voltage out from sensor (Output from ADC)

Formula1 Dp=(Vs*(Vo/Vs)-Zo)

Formula 2 Mps=SQRT((2*Dp*1000)/rho)

However, translated into PBP I tried the following:

Code:

rho = 1225 'Constant for pressure calc
Zo = 74 'Zero Offset
Vs1 = 3260 'Vref
AD_in = 0
Pres = 0
volt = 0
for samples = 1 to 4 '4 Samples from AD - Sensor is low pass filtered
ADCIN 4, ad_in
volt = volt + ad_in
Pause 25
Next Samples
volt = volt / 4 'Average AD
volt = volt * 3186 'convert to voltage out
Vind = DIV32 10000 'DIV32
'Excel Formula:
'Dp=(Vs*(Vo/Vs)-Zo)
dy_p = vind * 1000
Dy_p = (vind / Vs1)
dy_p = (dy_p * vind) / 1000
dy_p = dy_p - Zo
LCDOUT $FE, $80+6, dec2 dy_p, " " 'output to first line
'Excel Formula:
'Mps=SQRT((2*Dp*1000)/rho)
Vmps = dy_p / 1000
vmps = vmps * 2 * 1000
vmps = vmps / (rho/1000)
vmps = sqr vmps
lcdout $FE, $C0+5, dec2 vind 'output to second line

Can anyone help steer me in the right direction? I tried using the DIV32 after the multipys but also then got some unexpected values.

Many Thanks

Rob

## Bookmarks