Thanks Ioannis it works great now! Next is trying to understand the program Henrik wrote.
Accumulator VAR WORD
i VAR BYTE
ADResult VAR WORD
Accumulator = 0
Main:
For i = 0 to 39
ADCIN 4, ADResult
Accumulator = Accumulator + ADResult
PauseUs 500
NEXT
ADResult = Accumulator / 10 ' Psuedo 12bit resolution, ADResult is now 0-4092
' Sensor outputs 0.5V (ADResult=409 ) at 0psi (nominal)
' Sensor outputs 4.5V (ADResult=3683) at 7psi (nominal)
ADResult = ADResult - 409 ' Offset for zero output, ADResult is now 0 to 3274 for 0 to 7psi
ADResult = ADResult */ 547 ' Scale up, ADResult is now 0 to 6995 for 0 to 7psi
' Display Pressure: x.xx psi
HSEROUT["Pressure: ", DEC ADResult/1000, ".", DEC2 ADResult//1000, "psi", 13]
PAUSE 1000
Goto Main
If I know that at zero PSI the A/D gives 110 as a value and now it looks like we are using a high value of 4092 would I not take and use 4 times the 110 value?
Next, where did the 547 value come from and should it be "adjusted"?
Thanks, Ed
Bookmarks