View previous topic :: View next topic |
Author |
Message |
rashworth
Joined: 23 Jan 2004 Posts: 4 Location: Silverstone UK
|
ADC Congfiguration (vref) on 12F675 |
Posted: Sun Jan 25, 2004 6:32 am |
|
|
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);
} |
|
|
![](templates/subSilver/images/spacer.gif) |
Felix Althaus
Joined: 09 Sep 2003 Posts: 67 Location: Winterthur, Switzerland
|
|
Posted: Sun Jan 25, 2004 6:44 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
arif Guest
|
|
Posted: Sun Jan 25, 2004 3:15 pm |
|
|
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;
}
} |
|
![](templates/subSilver/images/spacer.gif) |
rashworth
Joined: 23 Jan 2004 Posts: 4 Location: Silverstone UK
|
12F675 ADC Setup |
Posted: Mon Jan 26, 2004 5:27 am |
|
|
Thanks Arif,
All is now working.
It appears the header file is missing some useful info for setting up the ADC reference voltage.
Rob |
|
![](templates/subSilver/images/spacer.gif) |
|