PDA

View Full Version : some problem with a pic adc



lutherblisset
- 30th May 2017, 13:57
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?

HenrikOlsson
- 30th May 2017, 21:39
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.

lutherblisset
- 31st May 2017, 12:08
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....