View previous topic :: View next topic |
Author |
Message |
klee Guest
|
setup_adc_ports problem |
Posted: Thu May 13, 2004 12:42 pm |
|
|
Hi,
I just started working with this IDE and I'm having trouble assigning the A0 pin to be analog. The compiler doesn't seem to recognize this line:
setup_adc_ports (RA0_ANALOG);
However, using // setup_adc_ports( ALL_ANALOG ); // compiles just fine. Is this a bug in my code or with the software?
I'm using a PICF767. |
|
![](templates/subSilver/images/spacer.gif) |
valemike Guest
|
|
Posted: Thu May 13, 2004 12:49 pm |
|
|
from pic16f767.h
#define ANALOG_AN0 0x0E // A0
Instead of "RA0_ANALOG", try writing "ANALOG_AN0"
-Mike |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu May 13, 2004 1:16 pm |
|
|
Quote: | The compiler doesn't seem to recognize this line:
setup_adc_ports (RA0_ANALOG); |
To find a list of parameters that may be used with the CCS
library functions for your particular PIC, you should look
in the 16F767.H file. It has everything you need.
Look here: c:\Program Files\Picc\Devices |
|
![](templates/subSilver/images/spacer.gif) |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu May 13, 2004 2:21 pm |
|
|
It should be setup_adc_ports(AN0_ANALOG);
This will make only pin A0 analog while using VCC as your reference. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu May 13, 2004 2:41 pm |
|
|
Quote: | It should be setup_adc_ports(AN0_ANALOG); |
It seems to depend on the version of the compiler.
PCM vs. 3.188 has it this way, for 16F767.H:
Code: | #define ANALOG_AN0 0x0E // A0 |
But vs. 3.190 has got it this way:
Code: | #define AN0_ANALOG 0x0E // A0 |
Obviously, changing the constants around between
versions is not a good thing for CCS to do. |
|
![](templates/subSilver/images/spacer.gif) |
klee Guest
|
thanks |
Posted: Thu May 13, 2004 3:10 pm |
|
|
Thanks for the loads of responses.. I found that
setup_adc_ports(AN0_ANALOG);
compiles and seems to work correctly in my version of CCS C IDE version 3.43.
klee |
|
![](templates/subSilver/images/spacer.gif) |
|