View previous topic :: View next topic |
Author |
Message |
Beginner Guest
|
PIC18 A/D q. select analog |
Posted: Thu Feb 03, 2005 2:05 pm |
|
|
I must use analog port in PIС18F4320 :
as PIN RA3-Vref+; RA4 - button; RA5 - analog in;
RA0,RA1,RA2-digital i/o ;
How I can do this?
If I can use analog port as
only: A0, or A0 and A1 or A0 and A1 and A2 //etc/
in header file.
PLEASE answ/ me! |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Thu Feb 03, 2005 3:37 pm |
|
|
Read the data sheet for the chip.
You can only configure the port as the _hardware_ allows. What you describe cannot be done.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Beginner Guest
|
|
Posted: Thu Feb 03, 2005 3:41 pm |
|
|
So If I use Vref , then I can't use RA0,RA1,RA2 as digital io? |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Feb 03, 2005 6:33 pm |
|
|
Beginner wrote: | So If I use Vref , then I can't use RA0,RA1,RA2 as digital io? |
No, if AN0 is a digital i/o then you don't get any analog inputs. The analogs need to start at AN0 and go up. |
|
![](templates/subSilver/images/spacer.gif) |
Beginner Guest
|
|
Posted: Fri Feb 04, 2005 11:14 am |
|
|
And about this:
I use PORTA0,1,2 as digital output and can use analog input(RA3 - Vref; RA5-input;) when digital don't use . So I must commutate from analog to digital.
This is too not correct???? |
|
![](templates/subSilver/images/spacer.gif) |
Beginner Guest
|
|
Posted: Fri Feb 04, 2005 11:17 am |
|
|
By communitate with function setup_adc_ports();????? |
|
![](templates/subSilver/images/spacer.gif) |
|