Vendrus
Newbie level 2
I'm stumped.
I'm currently using a PIC16F887 to read three different analogue voltages off different pins, which it happily does - except there's a ~10% variation in the readings off all three.
I've tried everything I can think of - setting the ADC clock to Fosc/32 (from internal 4MHz clock), increasing the supposedly appropriate 5ms delay after channel switching to 10, even 20ms, but nothing has any significant effect.
The first ADC is a measure of a voltage, reduced by potential divider then separated from the rest of the circuit by an opto-isolator. Input resistance is ~2kΩ. The input Voltage at the relevant PIC pin ranges from 1 to 4V, with a 10-20mV high frequency ripple due to DC-DC converters elsewhere in the circuit. However, the PIC reads values that vary far more wildly.
The other two are from LM35 temperature sensors, and the lines again exhibit no noise other than the high-freq 10-20mV ripple. I should add that the rail voltages (which the ADCs are referenced to) exhibit the same characteristics. There's some pretty decent EMC precautions on this PCB.
That said, I'm at a loose end. The input voltage characteristics heavily suggest that it's a PIC issue/setting, but I can't work out how to fix it if it is. Averaging is all very well, but for such a large inaccuracy it'd just be shoving the problem under the carpet.
Anyone got any ideas?
I'm currently using a PIC16F887 to read three different analogue voltages off different pins, which it happily does - except there's a ~10% variation in the readings off all three.
I've tried everything I can think of - setting the ADC clock to Fosc/32 (from internal 4MHz clock), increasing the supposedly appropriate 5ms delay after channel switching to 10, even 20ms, but nothing has any significant effect.
The first ADC is a measure of a voltage, reduced by potential divider then separated from the rest of the circuit by an opto-isolator. Input resistance is ~2kΩ. The input Voltage at the relevant PIC pin ranges from 1 to 4V, with a 10-20mV high frequency ripple due to DC-DC converters elsewhere in the circuit. However, the PIC reads values that vary far more wildly.
The other two are from LM35 temperature sensors, and the lines again exhibit no noise other than the high-freq 10-20mV ripple. I should add that the rail voltages (which the ADCs are referenced to) exhibit the same characteristics. There's some pretty decent EMC precautions on this PCB.
That said, I'm at a loose end. The input voltage characteristics heavily suggest that it's a PIC issue/setting, but I can't work out how to fix it if it is. Averaging is all very well, but for such a large inaccuracy it'd just be shoving the problem under the carpet.
Anyone got any ideas?