Close

PIC24FJ256GA110 ADC config file.

A project log for Multimeter +

Dual input 24 bit Multimeter with USB interface, single channel 10 bit USB oscilloscope, PWM out, 2 Ch Data-logger, R, C, Digital sniffer.

romanRoman 02/23/2016 at 03:070 Comments
  • void ADCH0_init(void){
        _ADSIDL  = 0; 
        //FORM<1:0>: Data Output Format bits
        _FORM0   = 0;         
        _FORM1    = 0;         
        //SSRC<2:0>: Conversion Trigger Source Select bits
        _SSRC0    = 1;       
        _SSRC1      = 1;
        _SSRC2     = 1;         
        _ASAM       = 1;          
        AD1CON2bits.VCFG    = 0b000;    // VR+ = AVDD, VR- = AVSS
        _CSCNA     = 0;          // 0 = Do not scan inputs. 
        _BUFM                       = 0;  
        AD1CON2bits.SMPI    = 0;      
        _ALTS                         = 0; 
        _ADRC = 0b0;  // 0 = Clock derived from system clock
        AD1CON3bits.SAMC    = 0b00001;  
        AD1CON3bits.ADCS    = 0b00000000;
        AD1PCFGLbits.PCFG0  = 0;    // Set AN0 as analog channel. 
    
       _CH0SA = 0b00000; 
        _AD1IE  = 0; 
        _SAMP   = 1;  //Start sampling    
    }
    

    It looks like I get less then 500 ksps, need to go through the code and figure out why.

    Discussions