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

hOW TO DISABLE vREF PINS

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



Joined: 15 Aug 2007
Posts: 5

View user's profile Send private message

hOW TO DISABLE vREF PINS
PostPosted: Wed Sep 26, 2007 10:41 am     Reply with quote

HI i am using a PIC 18f8720 and what to disable the Vref pins (RA2 and RA3) i only want to use them as analogue inputs. Can anyone please advice.
thankx
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Sep 26, 2007 11:11 am     Reply with quote

The options for the Analog pins are setup with this CCS function:
Quote:
setup_adc_ports()

The values that can be used with that function are given near the end
of the 18F8720.H file. Look in that file.

There are settings to select a range of pins to be A/D pins.
Also, the 18F8720.H file lists some settings to enable the Vref pins.
So to disable Vref, just select this constant:
Code:
VSS_VDD

Actually, because that constant is equal to 0x00, you could just leave it
out.
Both of these lines of code will do the same thing. They setup pins
AN0 to AN3 as analog pins, and they disable Vref.
Code:

setup_adc_ports(AN0_TO_AN3);

setup_adc_ports(AN0_TO_AN3 | VSS_VDD );
omallicha



Joined: 15 Aug 2007
Posts: 5

View user's profile Send private message

PostPosted: Wed Sep 26, 2007 11:14 am     Reply with quote

thanks for the suggestion, i will try that shortly, and will keep you updated
omallicha



Joined: 15 Aug 2007
Posts: 5

View user's profile Send private message

PostPosted: Wed Sep 26, 2007 11:26 am     Reply with quote

Hi,
i tried out your suggestion but im still having problems, the actual problem is that i have about 4 a/d inputs A0,A1,A2 and A3, i noticed that when i increase the voltage input of A2 the input values of A1 increases even though there is no connection to the PIN and it has a pull down resistor to ground. i was under the impression that it was due to the Vref+ please correct me if im wrong and advise.
thanks
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Sep 26, 2007 11:52 am     Reply with quote

Two questions:
1) Does the pull down resistor meet the imput impedance requirements of the A/D?
2) Are you waiting the required settling time between changing A/D channels?

Either of these can make voltage seem to leak from one channel to another.
_________________
The search for better is endless. Instead simply find very good and get the job done.
omallicha



Joined: 15 Aug 2007
Posts: 5

View user's profile Send private message

PostPosted: Wed Sep 26, 2007 1:18 pm     Reply with quote

Quote:
Does the pull down resistor meet the imput impedance requirements of the A/D?

The pin was designed to be an input from a pressure sensor(0-5v) but because of the unavailability of the senor, i temporaryly connected a 1k resistor to ground. this was because i wanted to keep the value at 0v which seemed not to be working.
Quote:
Are you waiting the required settling time between changing A/D channels?


i am actually delaying for 10us.

Code:
setup_adc_ports(AN0_TO_AN3 | VSS_VDD );
SETUP_ADC( ADC_CLOCK_INTERNAL );
SET_ADC_CHANNEL( 1 );
   delay_us(10);
   
 filter_sensor1 = READ_ADC();
 delay_cycles(1);
filter_sensor =(filter_sensor1*k);
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