PDA

View Full Version : help for the adc of the 16f1786



lutherblisset
- 11th December 2016, 19:38
i try make a 12 bit conversion with this:

define ADC_BITS 12
define ADC_SAMPLEUS 50
adval var word
ADCON0= %00000000
ADCON1= %10000000
trisa=%111111

start:
adcin 0, adval
LCDOUT $FE,2,"value:",dec adval
goto start
-------------------------------------

but the result is too low, with 1,4 volts on ra0 the resulting value is "7", what is wrong? Now the vref (adcon1 reg) is 5v i think....may i have to set the fvrcon register too?

AvionicsMaster1
- 20th December 2016, 13:25
ADCON0= %00000000 among other things doesn't turn on the ADC.

More code and a schematic if that doesn't help.