Pic 16F887 ADC Reading Low

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Pic 16F887 ADC Reading Low

Post by Desdewit »

Hi Guys

I'm using a V3 Development board with a pic 16F887 but at full voltage the adc reads only 1021.
I've tested the program with a 16f876 & 16f877 and they both read 1023.
Anyone else having the same problem? :?

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Pic 16F887 ADC Reading Low

Post by medelec35 »

Not had the same problem, but I have checked with a microcontroller simulator that works with hex files.
Using AN1 I get 0 to 1023. You are using AN1?

Personally I would blame the microcontroller itself especially if the other micro controller work just fine when no other hardware has been changed.

Also If you have a DMM it may be worth checking the voltage at the pin of microcontroller with respect to 0V.

Martin
Martin

me10kky
Posts: 4
Joined: Wed Mar 21, 2012 5:36 pm
Contact:

Re: Pic 16F887 ADC Reading Low

Post by me10kky »

Im kinda new to this, but how exactly would you practially measure the digital value after conversion?

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Pic 16F887 ADC Reading Low

Post by medelec35 »

The meter will be measuring the analogue voltage at the input pin.
It may be the microcontroller is dragging the 5V down slightly?
What is the integer value if you disconnect variable resistor and just short the input directly to +5V?
I assume you are using an LCD or RS232 to display the ADC value?


Martin
Martin

Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Re: Pic 16F887 ADC Reading Low

Post by Desdewit »

Hi Martin

The voltage at the input pin is 5.00V on the meter and stay the same with all three pic's but the lcd reads 1021 with the 887.
Is it possible for the config bits of the pic to cause this. :?:

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Pic 16F887 ADC Reading Low

Post by medelec35 »

I have got a 16F883.
I will try that this morning and see what I get since they are from the same family and use same ADC files within Flowcode.
I will post results, so it can be determined if its chip or Flowcode causing the issue.

Martin
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Pic 16F887 ADC Reading Low

Post by medelec35 »

I have just tried with 16F883.
Using both FC4 and FC5 the results are the same.
I also can't get the value to exceed 1022.
Results are between 1021 and 1022.

Since simulator showed 1023 as stated in previous post, I would take an educated guess as its the chip at fault.

if your looking out for a number that's 1023, then it maybe best to use if >1020
You will be loosing 4 to 8 mV resolution.

Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Pic 16F887 ADC Reading Low

Post by Benj »

Hello,

Have you tried playing with the precharge time or the conversion speed via the ADC component properties. On an AVR you cannot get a sample at the limits unless you change the settings from the defaults. Once you do this it all works great.

Post Reply