Yeah, deja vu indeed....
Ed,
* The resolution of the ADC is 10 bits.
* It does not return a reading directly in Volts.
* Basically it takes the difference between Vref+ and VRef- and divides that by 1024 (2^10, the resolution of the ADC). Each "count" in the value is then "worth" that amount.
So, if VRef- is GND (0V) and VRef+ is 5V the difference between the two is 5V. Each "count" in the ADC result is then "worth" 5/1024=4.88mV.
If the ADC returns 745 the voltage at its input is 5/1024*745=3.638V
I can't make out anything from that datasheet, it's just garbage numbers when viewed on my machine. I managed to find this one. And, I'm guessing you've got the 7psi sensor, correct? If so then something like this might work. I have not tested it though so all bets are off....
Of course you need to configure pins etc as usual (!)
Code:
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
/Henrik.
Bookmarks