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 CCS Technical Support

analog port configuration for 18F2620

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



Joined: 01 Apr 2007
Posts: 195

View user's profile Send private message

analog port configuration for 18F2620
PostPosted: Sun Aug 19, 2007 5:21 pm     Reply with quote

I'm looking at the analog port configuration section of the CCS 18F2620 support file and the codes associated with selecting active analog input channels... The following is a snippet of the file:

// Constants used in SETUP_ADC_PORTS() are:
#define NO_ANALOGS 0x0F // None
#define ALL_ANALOG 0x00 // A0 A1 A2 A3 A5 B2 B3 B1 B4 B0
#define AN0_TO_AN11 0x03 // A0 A1 A2 A3 A5 B2 B3 B1 B4
#define AN0_TO_AN10 0x04 // A0 A1 A2 A3 A5 B2 B3 B1
#define AN0_TO_AN9 0x05 // A0 A1 A2 A3 A5 B2 B3
#define AN0_TO_AN8 0x06 // A0 A1 A2 A3 A5 B2
#define AN0_TO_AN4 0x0A // A0 A1 A2 A3 A5
#define AN0_TO_AN3 0x0B // A0 A1 A2 A3
#define AN0_TO_AN2 0x0C // A0 A1 A2
#define AN0_TO_AN1 0x0D // A0 A1
#define AN0 0x0E // A0

From the Microchip 18F2620 datasheet, the codes match from 0x0f, 0x0e, 0x0d, 0x0c, and 0x0b but the datasheet lists entries for AN4 (on pin 6 of the 18F2620) and the CCS doesn't seem to list any entries for the AN4. None of the rest of the codes seem to match.

I'm trying to set up for 8 analog inputs with a PIC18LF2620 or 18LF2525 device. Which code should I use and which pins will the analogs be input onto?

Thanks.
Code:
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 19, 2007 6:31 pm     Reply with quote

Look at the PCFG-bits table in the A/D section of the 18F2620 data sheet:
Quote:

ADCON1: A/D CONTROL REGISTER 1

PCFG3:PCFG0: A/D Port Configuration Control bits


Quote:
CCS doesn't seem to list any entries for the AN4

For AN0-AN4 as analog, the table has the value of 0x0A.


Also note that AN5-AN7 are not available on the 18F2620. Microchip
places this note below the table:
Quote:
2: AN5 through AN7 are available only on 40/44-pin devices.
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