Subversion Repositories Code-Repo

Rev

Rev 128 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 128 Rev 129
Line 3... Line 3...
3
 
3
 
4
static ADC_DATA adc_data;
4
static ADC_DATA adc_data;
5
static ADC_DATA *adc_data_p = &adc_data;
5
static ADC_DATA *adc_data_p = &adc_data;
6
 
6
 
7
void ADC_Init(unsigned char TAD, unsigned char FOSC) {
7
void ADC_Init(unsigned char TAD, unsigned char FOSC) {
8
    TRISAbits.TRISA0 = 1;
8
    ADC_AN0_TRIS = 1;
9
    TRISAbits.TRISA1 = 1;
9
    ADC_AN1_TRIS = 1;
10
    TRISAbits.TRISA2 = 1;
10
    ADC_AN2_TRIS = 1;
11
 
11
 
12
    adc_data_p->last_channel = 0;
12
    adc_data_p->last_channel = 0;
13
    adc_data_p->result = 0;
13
    adc_data_p->result = 0;
14
 
14
 
15
    ADCON0bits.VCFG1 = 0; // VRef- = AVss
15
    ADCON0bits.VCFG1 = 0; // VRef- = AVss