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

problem with ADC port on 16F876

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







problem with ADC port on 16F876
PostPosted: Tue Jan 03, 2006 12:58 pm     Reply with quote

Hallo ALL there!!

I Have a problem with the 16F876 pic.
When I read the AN0 analog input which is driven by a 1K potentiometer I can only see a value from 0 to 255 (the variable is of type int). The value I see goes from 0 to 255 3 times when I turn the potentiometer till the end. I use CCS C ver 3.26 and I use the read_adc function and it seems return only the LSB of the 10 bit value. Maybe I must use another function?

I have this device

#device *=16 ADC=10 ICD=TRUE
or
#device *=16 ADC=16 ICD=TRUE

Anyone can help me???

THANK YOU VERY MUCH

Paolo
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 03, 2006 1:04 pm     Reply with quote

What about this thread, where he said to use "%LX" to display it ?
http://www.ccsinfo.com/forum/viewtopic.php?t=25563
Paolo
Guest







I have found the solution
PostPosted: Tue Jan 03, 2006 1:08 pm     Reply with quote

I was using an int variable but I must use an int16 type!

THANKS TO ALL
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