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

CCS C, PIC18F67K22 ADC problem ?

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



Joined: 22 Aug 2013
Posts: 2

View user's profile Send private message Send e-mail

CCS C, PIC18F67K22 ADC problem ?
PostPosted: Fri Aug 23, 2013 3:54 am     Reply with quote

Hi, guys.

I'm trying to get a ADC value from AN0 pin with PIC18F67K22.
PIC18F67K22 has 12bit ADC module.

c code with CCS C.

#DEVICE PIC18F67K22 ADC=12

main()
{
unsigned int adc_value=0;
setup_adc_ports(sAN0, VSS_VDD ); // VDD=5V, VSS=GND
setup_adc(ADC_CLOCK_INTERNAL); //
set_adc_channel(0);
delay_ms(100);

adc_value = read_adc();
printf("adc0 = %4X , ", adc_value};
}

then, outptut of printf() is adc0=0079;
BTW, ADRESH = CDh, ADRESL = 79, it means adc0 = ADRESL.
why adc_value doesn't include ADRESH value ?

please help me.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Fri Aug 23, 2013 4:49 am     Reply with quote

Nothing to do with the ADC.....

How big is an int?.

Read the manual section on 'Basic and Special types'.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sat Aug 24, 2013 2:39 am     Reply with quote

Duplicate post. Learn to use "code" button

Mike
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