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

Select adc channel pic18f2458

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



Joined: 09 Dec 2020
Posts: 13

View user's profile Send private message

Select adc channel pic18f2458
PostPosted: Thu Dec 10, 2020 5:16 pm     Reply with quote

Hello,
I configured PIC18F2458 as analog input from A0 to A9 which is
Code:

#define AN0_TO_AN9   0x05   // A0 A1 A2 A3 A5 B2 B3 

How do I select channel B2, B3 ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 10, 2020 6:40 pm     Reply with quote

Your PIC doesn't support individual enables for the analog pins. You have
to select one of the preset groups. Look in the 18F2458.h file to see what
groups are available. If you just want two analog pins, you will have to
use AN0 and AN1.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Dec 11, 2020 9:18 am     Reply with quote

It is worth perhaps saying that the ability to enable individual channels
for the ADC is a feature that has appeared in later PIC's.

The PIC18F27J53, is pretty much pin compatible with the 2458, except
for losing pin 6 to Vddcore, and supports individual ADC channel enables.
It does lack EEPROM, but the virtual EEPROM driver can be used. Has a
lot more ROM and RAM, and is cheaper. So if you must use the high channels
for the ADC, consider if you could change to this chip. It also has much
more flexibility in the peripheral use (PPS), and draws less power.
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