-
Using VREF with 16F88
Hi All,
I am trying to use the programmable VREF of the 16F88. I can get the ADC to work correctly without using the vref. Here are my fuse settings:
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
TRISB = %11111111
TRISA = %00010000
CMCON = %00000000
ANSEL= %00000010
adcon1 = %00000001
ADCON1 = %10100000
CVRCON = %11000010
With these settings, I see the 1.5V or so on the VREF. I have tried to set the ADC as using either VREF-VSS or +VREF -VREF. In either case, I get a reading of 1023 on the ADC. Any ideas?
Thanks!
Jonathan
-
jpeakall, I notice that you have ADCON1 being set twice. Is this a mistake? Also, what voltage do you have impressed on the second a/d channel AN1? Also you have the Tris register for PortA.1 set for output, this needs to be set for an input state.
Dave Purola,
N8NTA
-
DUH!
Turns out I had the - vref and +vref pins backwards! I'm helping...
Jonathan