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

Setting up ADC ports and older PICs

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



Joined: 24 Sep 2006
Posts: 262

View user's profile Send private message AIM Address

Setting up ADC ports and older PICs
PostPosted: Mon Aug 25, 2014 12:49 pm     Reply with quote

I pass along the following as useful information. Always check the .h file if you have compile problems.

I used
Code:
setup_adc_ports(AN0_AN1_AN2_AN3_AN4);

for a 16F874A and it works.

I tried
Code:
setup_adc_ports(AN0_AN1);

for the 16F874A and it will not compile. What if I only want the two ADC inputs? Look for a newer PIC (16F884?)

I tried
Code:
setup_adc_ports(AN0_AN1_AN2_AN3_AN4);

for a 16F722 and it does not compile. I must use
Code:
setup_adc_ports(sAN0|sAN1);

which I got from the .h files and it works.

Why the _ and | and why the s before the ANx?

Answers from CCS: Older chips only allowed certain combinations of AN pins to be set to analog so we used the AN0_AN1_AN2_AN3_AN4 constants for each combination that was allowed. Newer chips allow any combination of pins so we used the OR bar method to specify the desired pins. The s was because many users by then used their own defines with ANx to identify the pins for other uses.

Me: If you stick with the same PIC for years check occasionally for a newer pin compatible replacement. The 16F722 is not that old and is I2C slave only but the newer 16F882 chip can be master as well. A 10 year old car is "old" but a 10 year old PIC is ancient.
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