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

Using Port A partially analog and digital

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



Joined: 19 May 2009
Posts: 60

View user's profile Send private message

Using Port A partially analog and digital
PostPosted: Fri Jul 02, 2010 6:22 am     Reply with quote

Is it possible to use port A (PIC18f2685) partially analog and digital in the same project ?

I want A0 and A1 as digital outputs and the rest as analog inputs. How should I declare this ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Fri Jul 02, 2010 7:06 am     Reply with quote

1) - Yes.
2) - No.

Look at the section entitled 'Register 19-2' in the data sheet.
See the table of the possible analog/digital pin combinations.

You can define A0, and A1, A2, A3 as analog, and the rest as digital, but _not_ have the low pins as digital, and higher pins as analog.
There are 'partial' ways of cheating this a little, but all incur potential costs (power, noise, and only limited use of the other pins).
Build your project to use the pins the way the manufacturer designed the chip. Much easier in both the short, and long term.

Best Wishes
andrewg



Joined: 17 Aug 2005
Posts: 316
Location: Perth, Western Australia

View user's profile Send private message Visit poster's website

Re: Using Port A partially analog and digital
PostPosted: Fri Jul 02, 2010 7:11 am     Reply with quote

Skirmitt wrote:
Is it possible to use port A (PIC18f2685) partially analog and digital in the same project ?

Yes, but only in the combinations documented in the PIC datasheet.
Skirmitt wrote:
I want A0 and A1 as digital outputs and the rest as analog inputs. How should I declare this ?

For the 18F2685, it can't be done.

The '2685 supports up to eight analog inputs. If you need six, they must be AN0, 1, 2, 3, 4, and 8.
_________________
Andrew
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