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
I want to give ADC reference volts Vref+ (VDD/1000) and Vref-(VSS) .
HOW? (i want to give above vref in program.(not in AN3 and AN2)
my program with Vref+(VDD) and Vref-(VSS) is below and its working;
(most significant 8 bits are shown iin port b)
#include <htc.h>
#define _XTAL_FREQ 4e6 // 4MHz
__CONFIG(0x3F3A);
void main()
{
TRISB=0;
TRISA=1;
ADCON1=0b00001110;
__delay_us(10);
ADCON0=0b01000001;
__delay_us(10);
while(1)
{
ADGO=1;
while(ADGO);
PORTB=ADRESH;
__delay_ms(50);
}
}
HOW? (i want to give above vref in program.(not in AN3 and AN2)
my program with Vref+(VDD) and Vref-(VSS) is below and its working;
(most significant 8 bits are shown iin port b)
#include <htc.h>
#define _XTAL_FREQ 4e6 // 4MHz
__CONFIG(0x3F3A);
void main()
{
TRISB=0;
TRISA=1;
ADCON1=0b00001110;
__delay_us(10);
ADCON0=0b01000001;
__delay_us(10);
while(1)
{
ADGO=1;
while(ADGO);
PORTB=ADRESH;
__delay_ms(50);
}
}