Subversion Repositories Code-Repo

Rev

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

Rev 123 Rev 126
Line 10... Line 10...
10
 
10
 
11
    adc_data.last_channel = 0;
11
    adc_data.last_channel = 0;
12
    adc_data.result = 0;
12
    adc_data.result = 0;
13
 
13
 
14
    ADCON0bits.VCFG1 = 0; // VRef- = AVss
14
    ADCON0bits.VCFG1 = 0; // VRef- = AVss
15
    ADCON0bits.VCFG0 = 0; // VRef+ = AVdd
15
    ADCON0bits.VCFG0 = 1; // VRef+ != AVdd
16
    ADCON1bits.ADFM = 1; // Right justified result
16
    ADCON1bits.ADFM = 1; // Right justified result
17
    ADCON1bits.ADCAL = 1; // Calibrate A/D
17
    ADCON1bits.ADCAL = 1; // Calibrate A/D
18
    ADCON1bits.ACQT = TAD;
18
    ADCON1bits.ACQT = TAD;
19
    ADCON1bits.ADCS = FOSC;
19
    ADCON1bits.ADCS = FOSC;
20
    ADCON0bits.ADON = 1; // Enable A/D module
20
    ADCON0bits.ADON = 1; // Enable A/D module