vinodstanur
Advanced Member level 3
- Joined
- Oct 31, 2009
- Messages
- 751
- Helped
- 114
- Reputation
- 234
- Reaction score
- 114
- Trophy points
- 1,333
- Location
- Kerala (INDIA)
- Activity points
- 7,054
#include <htc.h>
#define _XTAL_FREQ 4e6 // 4MHz
__CONFIG(0x3F3A);
void main()
{
TRISB=0;
TRISA=1;int a,b;
ADCON1=0b00001111;
__delay_us(10);
ADCON0=0b01000001;
__delay_us(20);
while(1)
{
ADGO=1;
while(ADGO);
PORTB=ADRESH;
__delay_ms(100);
}
}
(i just started learning ADC)
In the above program, AN3 set as +vref and AN2 is set as -vref.
But when i connect a +voltage to pic RA3 then it is taking much current through that RA3. When i connect an LED between VDD and RA3, then the LED glows brightly! This much current is needed for vref? Now am confused :roll:, actually
1> what is +Vref and - Vref?:x
2>How to use those ?:x
#define _XTAL_FREQ 4e6 // 4MHz
__CONFIG(0x3F3A);
void main()
{
TRISB=0;
TRISA=1;int a,b;
ADCON1=0b00001111;
__delay_us(10);
ADCON0=0b01000001;
__delay_us(20);
while(1)
{
ADGO=1;
while(ADGO);
PORTB=ADRESH;
__delay_ms(100);
}
}
(i just started learning ADC)
In the above program, AN3 set as +vref and AN2 is set as -vref.
But when i connect a +voltage to pic RA3 then it is taking much current through that RA3. When i connect an LED between VDD and RA3, then the LED glows brightly! This much current is needed for vref? Now am confused :roll:, actually
1> what is +Vref and - Vref?:x
2>How to use those ?:x