I am having accuracy problem with PIC16F877A ADC. I am using 2 ADC channels for analog signal input and switching one after reading value on other channel continuously in ADC interrupt. I have set Vref- on 1Volt and Vref+ on 3 references are fixed and showing no variations. after scaling the readings i am putting result on seven segment displays and pwm channels for each analog input. both channels giving variation in reading of around 2~3BIT LSB at fixed input signal. I am using dc signals for input.
A reading that varies by 2 or 3 represents just 6mV at the Vref voltages given. Getting DC voltages that are ripple free is very difficult especially in a digital environment. I suspect it is simply noise. Try putting 100nF ceramic capacitors on the two input pins.
Another possible source of error is not allowing sufficient acquisition time.
A reading that varies by 2 or 3 represents just 6mV at the Vref voltages given. Getting DC voltages that are ripple free is very difficult especially in a digital environment. I suspect it is simply noise. Try putting 100nF ceramic capacitors on the two input pins.
Another possible source of error is not allowing sufficient acquisition time.
I am using 20MHz clock,TAD = 64Tosc, giving 300us delay before channel switching and giving 300us after channel selecting which I think is enough time for acquisition. I have tried 100nF caps as well
How fast do you need to sample... If its only 4 / 5 times a second then you can oversample.... read and sum the ADC 24 times.. then dividing by 6, will give a reasonable 12 bit precision.
What is your source impedance?, switching channels can be slow, as the sample and hold has to charge/discharge, which is dependent on the source impedance. If it's switched too fast, then the higher one reads low, and the lower one reads higher.