Continue to Site

# A/D help steady reading in low range but bounces in high

Status
Not open for further replies.

#### usaf1

##### New Member
I'm using the PIC16F877 and was using a 0-5VDC power supply to input a known value into the A/D. At 2.5 volts it returned from 295-305, not too bad of variance, but at 5 volts it returned values that ranged from 590s- 790s. That's way too much bouncing.

First question, how do I get the higher values to be more stable?

Second question, if it's a 10 bit A/D, shouldn't a 0V input return a 0 reading, and a 5V input return a 1024 reading? If 10 bit means 2^10 = 1024.

As far as hardware hooked up I was using a 1k resistor between the power supply and the chip to limit the current.

I tried using the A/D in polling on a couple of tries as well as the interrupt mode a couple times after that. What's the proper order of steps in getting the A/D to work properly, maybe I have a step out of order.

It mentions something about an acquisition time before it translates the input value. I inserted a delay between the ADC Wait statement and the ADC store statement is this a needed or a bad thing?

I've seen some people mention that to return a stable value in all ranges that an external ADC chip is far better than the one on the PIC. Is this true, does the PIC one normally wander like this? The A/D is the only real reason why I'm using the 877, that and for the memory. But, if I'm going to have to use an external ADC then I'm sure I could probably get a smaller PIC.

Any help would be very much appreciated.

As far as hardware hooked up I was using a 1k resistor between the power supply and the chip to limit the current.

Are you inserting that resistor between the power supply and the VCC pin of the chip? That would be a bad idea. The chip needs a stable supply at the VCC pins.

What voltage reference are you using? Is it from the VCC pin or through an external reference (RA3). The conversion result is proportional to this reference. This probably why the result is unstable. To get a really accurate result down to 1-bit accuracy of the 10-bit ADC, you need a voltage reference with an acuracy better than 0.1%.

No, the 1k is between an external power supply that I'm using for the external reference into RA0. I can just pick at random which A/D pin I can use, right? This one had RA0-3 and RE0-2.

The power supply above is not the same power supply that is running the chip and LCD via Vcc. There is no resistor between the Vcc and power supply.

The accuracy of .1%. Internally is the A/D comparing the voltage in to RA0 to the voltage on Vcc? Because then if my power supply for the chip and LCD is not stable enough would this affect the reading?

Thanks.

That is correct. The analog inputs are being compared to the voltage reference. Therefore, A/D conversion of 0 (zero) equals Vref- and A/D conversion of 1024 equals Vref+.

I have used external A/D converters. The PICs compare favorably to external ones.

Status
Not open for further replies.

Replies
10
Views
1K
Replies
1
Views
2K
Replies
6
Views
4K
Replies
15
Views
4K
Replies
7
Views
2K