PDA

View Full Version : Pic16f1825 adcon0



nobner
- 17th May 2014, 23:25
Hi,
i'm using PIC16F1825 for the first time and want to use RC2 as analog input.
Therefore i want to use the internal voltage reference (4.096V).
I set the FVRCON = %10000011.
But there is an item in the ADCON0 that i don't understand...
I think i have to use ADCON0 = %00011001 for using analog channel 6?
But what means (bit6-2) "11111 = FVR (Fixed Voltage Reference) Buffer 1 Output?
What is this for?
Must i use this for my reference voltage?

Thanks in advance
best regards
norbert

Aussie Barry
- 18th May 2014, 05:20
Hi Norbert,

I used the PIC16F1825 in a recent project with ADC input on AN0.
I used FRVCON = %11010011 to enable the fixed voltage reference and set the voltage to 4.096V.
Your ADCON0 = %000110001 is correct for selecting AN6 as the ADC channel (RC2).
To apply the fixed voltage reference to the ADC you must set bit 1-0 of ADCON1 to "11"
In my application I used ADCON1 = %10100011 to right justify the output, set A/D clock to Fosc/32 and set Vref- to VSS.
You may need to change the A/D clock selection depending on you own oscillator choice.

Cheers
Barry
VK2XBP

HenrikOlsson
- 18th May 2014, 06:32
Hi,

But what means (bit6-2) "11111 = FVR (Fixed Voltage Reference) Buffer 1 Output?[
It simply selects the output of the FVR and "connects it" to the ADC input in order to sample it, just as any other input.


What is this for?
It can be used to "calibrate" the ADC when you're not actually using the FVR as VRef for the ADC.


Must i use this for my reference voltage?
No, in your case, with the output of the FVR used as VRef for the ADC there's no need to sample the FVR output - it would/should Always return a result of 1023.

/Henrik.

nobner
- 19th May 2014, 09:41
Hello Barry / Henrik,
thanks for reply, it helped me understanding this function.
I did my settings this way - everything's fine.
Thanks for help.
Norbert