CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

ADC problems PIC16F873A

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hx716



Joined: 20 Nov 2004
Posts: 1

View user's profile Send private message

ADC problems PIC16F873A
PostPosted: Sat Nov 20, 2004 2:15 pm     Reply with quote

Hello. I am new at it. I am trying to use PIC16F873A 10 bit ADC. The Vdd is 3.3 V at 8.0 MHz.
I use the following code:

#include <16F873A.h>
#fuses HS, NOWDT, NOPROTECT, NOLVP, NOBROWNOUT, PUT
#use delay(clock=8000000)

unsigned int16 value = 0;
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_32);
set_adc_channel(0);
delay_us(10);
value = read_adc();

The maximum value I get with Vdd applied to AN0 is 256. It looks like it workes like 8 bit ADC not 10bit. Any Idia?

Thank you in advance.
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Sat Nov 20, 2004 4:14 pm     Reply with quote

The magic line:

#device ADC=10
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group