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 support@ccsinfo.com

PIC16F877 Analog/Digital Inputs

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



Joined: 18 Jan 2006
Posts: 43

View user's profile Send private message

PIC16F877 Analog/Digital Inputs
PostPosted: Wed Apr 04, 2007 1:13 pm     Reply with quote

Hi, I was wondering if it might be possible to set all ANx inputs for analog but still use some for digital input only ?

I have a circuit here that uses AN0,1 for analog input and then RA3,4,5 for digital input. I'm not clear about which constant to use for SETUP_ADC_PORTS().

I'd appreciate any ideas.
Thanks. Don
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 04, 2007 1:42 pm     Reply with quote

Only certain combinations of analog and digital pins are allowed by
the PIC hardware. See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=30320&highlight=analog&start=5
adrian



Joined: 08 Sep 2003
Posts: 92
Location: Glasgow, UK

View user's profile Send private message

PostPosted: Thu Apr 05, 2007 5:36 am     Reply with quote

One way around this type of problem is to read the analogue voltage of the digital input, then compare the analogue reading with the expected equivalent logic high/low digital value.
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