PDA

View Full Version : A/D problem ON 16F688



Christopher4187
- 19th October 2005, 01:02
Hi,

I have a small program where I measure 0-5V on a 16F876 and it works good. I tried the same program on the 16F688 and it doesn't work for crap. I have tried many different settings but I can't get it to work. It is extremely erratic and mostly displays 192, 64 and zero. Below is my program and if someone has any suggestions or if you have used the A/D on the 688 please chime in.

Thanks,

Chris

@ DEVICE PIC16F688, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_ON, MCLR_OFF, BOD_ON,PROTECT_OFF

Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
ADCON0.7 = 1 ' right justify conversion result
ANSEL = %10000000 ' ANS7 analog, all others digital
TRISC = %11111000
WAT VAR WORD


DETWAT:
ADCIN 7,WAT
PAUSE 100
SEROUT2 PORTC.2,16468,[254,1," SENS ", DEC WAT]
goto DETWAT

Acetronics2
- 19th October 2005, 14:03
Hi, Chris

What about ADCON 1 ???

Alain

Christopher4187
- 19th October 2005, 22:13
I was told by Charles at ME Labs that the adcon 1 setting is not needed. Anyway, I tried that before and it still didn't work. I read and re-read the data sheet but I am still missing something.