some problem with a pic adc
i try to work with the adc (12bit) of the pic16f1786. My settings are as follows:
ANSELA = %00010111
ADCON0 = %01111101 ' Using 12 Bit, Fixed Voltage reference
ADCON1 = %11110011 ' 2's Compliment, FRC, VREF- to VSS(ADNREF), VREF to FVR
ADCON2 = %00001111 ' ADC Negative to VSS
FVRCON = %11001111 ' Enable FVR, and 4.096v Reference
WPUA = %00000000
But when I try to acquire from a source it gives me a somewhat incorrect value, if I dont understand it. The measured source with the digital voltmeter gives 1.40 volts while the pic gives me the value 1435. But with a fvr of 4.096 volts and 12 bits (4096 levels) does not have a 1: 1 ratio? That is 1435 means 1,435 volts?
Re: some problem with a pic adc
If I read the datasheet properly the accuracy specification on the FVR is +/- 3% so you're still within that window.
Vdd must be above 4.75V and there's a comment saying the specification is valid for the industrial temperature range part only. What's your Vdd and exact part number?
Also, are you doing any filtering/averaging in your code? You might benefit from that if you have noise coupled into your signal which your DMM filters out.
/Henrik.
Re: some problem with a pic adc
thank you henrik, the averaging seems to be good but today i will try to check the "zeroing", maybe the problem is there. the Vdd comes from a common 7805 and it's something near 4,97 volts....