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

setup_adc_ports problem

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







setup_adc_ports problem
PostPosted: Thu May 13, 2004 12:42 pm     Reply with quote

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.
valemike
Guest







PostPosted: Thu May 13, 2004 12:49 pm     Reply with quote

from pic16f767.h

#define ANALOG_AN0 0x0E // A0

Instead of "RA0_ANALOG", try writing "ANALOG_AN0"

-Mike
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 13, 2004 1:16 pm     Reply with quote

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
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu May 13, 2004 2:21 pm     Reply with quote

It should be setup_adc_ports(AN0_ANALOG);
This will make only pin A0 analog while using VCC as your reference.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 13, 2004 2:41 pm     Reply with quote

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.
klee
Guest







thanks
PostPosted: Thu May 13, 2004 3:10 pm     Reply with quote

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
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