|
|
View previous topic :: View next topic |
Author |
Message |
Skirmitt
Joined: 19 May 2009 Posts: 60
|
Using Port A partially analog and digital |
Posted: Fri Jul 02, 2010 6:22 am |
|
|
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: 19513
|
|
Posted: Fri Jul 02, 2010 7:06 am |
|
|
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
|
Re: Using Port A partially analog and digital |
Posted: Fri Jul 02, 2010 7:11 am |
|
|
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 |
|
|
|
|
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
|