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

ADC Congfiguration (vref) on 12F675

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



Joined: 23 Jan 2004
Posts: 4
Location: Silverstone UK

View user's profile Send private message Send e-mail

ADC Congfiguration (vref) on 12F675
PostPosted: Sun Jan 25, 2004 6:32 am     Reply with quote

I am trying to use Vref on the 12F675. I only require A0, as an analogue input, but I need to use A1 as the reference. How is this accomplished using the 12F675?

Code:

void Config_ADC()
{
      setup_adc_ports(AN0_ANALOG);//? here to set vref?
      setup_adc(ADC_CLOCK_INTERNAL);
      set_adc_channel(0);
}
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

PostPosted: Sun Jan 25, 2004 6:44 am     Reply with quote

Hello

In the PIC12CE674 header file I found defined this:
AN0_ANALOG_AN1_REF
I don't know exactly the 12F675 but I bet you can use this setup constant with it.

May you want to have a look into the 12F675.H header file.

mfg
Felix
arif
Guest







PostPosted: Sun Jan 25, 2004 3:15 pm     Reply with quote

try this
it is working.

#include <12f675.h>
#device adc=10
#use delay(clock=4000000)
#fuses intrc_io,noWDT,NOPROTECT,NOMCLR,NOBROWNOUT


#byte ADCON0 =0x1f
#byte ADRESL =0x9E
#bit VREFF =ADCON0.6


main()
{
setup_adc_ports(AN0_ANALOG);
setup_adc(internal);
VREFF=1;

while(true)
{
xxxxx;
}
}
rashworth



Joined: 23 Jan 2004
Posts: 4
Location: Silverstone UK

View user's profile Send private message Send e-mail

12F675 ADC Setup
PostPosted: Mon Jan 26, 2004 5:27 am     Reply with quote

Thanks Arif,

All is now working.

It appears the header file is missing some useful info for setting up the ADC reference voltage.

Rob
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