1) Pressure sensor using -ref (2.0 V) and Vdd
2) Pressure sensor using Vss and Vdd
3) Channel 2 ( my -vref channel to test that I am getting 2.0 V )
This is what my serial output looks like for the code I attached..
"-ref=0 norm=3368 chan2=2710"
My question is why am i getting 0 when using -ref?? I tested using -ref set to 1.0 V and everything was working fine but at 2.0 V (where i need it to be) I get 0?
I have tried the following:
ADC.SetConvTime(fosc_64)
adc.SetAcqTime(50)
with no luck.. I have even tried using delays after switching ADCON1.. Same result.. Any Ideas.. Thank you
Code: Select all
Sub Mode_2()
Dim
achan1 As Word,
achan2 As Word,
achan3 As Word
While true
ADCON1=%00101010 // Using -vref
achan1 = ADC.Read(0)
DelayMS(500)
ADCON1=%00001010 // Using Vss and Vdd as ref
achan2 = ADC.Read(0)
achan3 = ADC.Read(2)
USART.Write("-ref=",DecToStr(achan1),10,"norm=",DecToStr(achan2),10,"chan2=",dectostr(achan3))
DelayMS(500)
If escape = true Then
Break
EndIf
Wend
End Sub