**RESOLVED** ADC module, only getting a max count of 511
Moderators: David Barker, Jerry Messina
**RESOLVED** ADC module, only getting a max count of 511
First time using the ADC module with a PIC18F4620 to measure 0-5V. Works fine to 2.50V, beyond that, the result stays constant. I checked ADResult and it shows 511 counts from 2.50-5.00V. Any ideas what I'm doing wrong?
Last edited by rmteo on Sun Feb 07, 2010 5:28 pm, edited 1 time in total.
I'm using the default from the sample ADIn.bas, what should they be?
Code: Select all
TRISA.0 = 1 // configure AN0 as an input
ADCON1.7 = 1 // set analogue input on PORTA.0
-
- Registered User
- Posts: 185
- Joined: Mon Mar 10, 2008 8:20 am
- Location: Seattle, WA USA
- Contact:
Try changing the conversion time....I was having this same problem too, reading exactly half scale as maximum.
From the documentation:
sub SetConvTime(pValue as byte)
• pValue - ADC conversion time. Valid arguments are FOSC_2, FOSC_4,
FOSC_8, FOSC_16, FOSC_32, FOSC_64 and FRC. You should refer to your
particular device datasheet for further information.
Set the ADC conversion time
From the documentation:
sub SetConvTime(pValue as byte)
• pValue - ADC conversion time. Valid arguments are FOSC_2, FOSC_4,
FOSC_8, FOSC_16, FOSC_32, FOSC_64 and FRC. You should refer to your
particular device datasheet for further information.
Set the ADC conversion time