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

18F4550 10 bit A/D with a Refrence Voltage

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



Joined: 16 May 2008
Posts: 2

View user's profile Send private message AIM Address

18F4550 10 bit A/D with a Refrence Voltage
PostPosted: Fri May 16, 2008 1:16 pm     Reply with quote

I can't seem to find how to setup a reference voltage for A/D on the 4550.
Looking through the 18F4550.h file there isn't any way to do it?

Anyone have any ideas?

--Adam
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 16, 2008 1:25 pm     Reply with quote

See this section in the .H file:
Code:
// The following may be OR'ed in with the above using |
#define VSS_VDD               0x00              // Range 0-Vdd
#define VREF_VREF             0x30              // Range VrefL-VrefH
#define VREF_VDD              0x20              // Range VrefL-Vdd
#define VSS_VREF              0x10              // Range 0-VrefH
adamgreg



Joined: 16 May 2008
Posts: 2

View user's profile Send private message AIM Address

How do you specify which pin is the ref
PostPosted: Fri May 16, 2008 1:38 pm     Reply with quote

Alright so I want Pin_A1 to be the Analog input and I want Pin_A3 to be the reference pin. How do you specify which pin is the ref pin?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 16, 2008 1:56 pm     Reply with quote

The A/D reference voltage pins are always on AN3 and AN2.
To use AN1 for A/D input and to use AN3 for Vref+, do this:
Code:

setup_adc_ports(AN0_TO_AN3 | VSS_VREF);
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