bonjour,
Je voudrais être sûr de ma programmation pour lancé un sample simultané sur AN0 et AN1 de mon 30f4012 pour les stocké dans ADCBUF1 et 0, merci.
Voici ma config ADC
Code://ADPCFG: A/D Port Configuration Register ADPCFG = 0xFFFF; //set all digital _PCFG0 = 0; //AN0 analog input _PCFG1 = 0; //AN1 analog input //ADCON1: A/D Control Register 1 ADCON1 = 0; //clear register A/D off _FORM = 2; //fractional 0 - 0.999 _SSRC = 3; //Motor Control PWM interval ends sampling and starts conversion _SIMSAM = 1; //simultaneous sample _ASAM = 1; //Sampling begins immediately, SAMP bit is auto set //ADCON2: A/D Control Register 2 ADCON2 = 0; //clear register _VCFG = 0; //VrefH = Avdd, Vref- = AVss ADCON2bits.CHPS = 1; //convert CH0 & CH1 //ADCON3: A/D Control Register 3 ADCON3 = 0; //clear register _ADRC = 0; //use system clock (TCY = 34 ns) _ADCS = 5; //TAD min = 84ns => TCY * (ADCS + 1 ) /2 = 100ns //ADCHS: A/D Input Select Register ADCHS = 0; //clear register, all CHx- to Vref- _CH0SA = 1; //CH0 <- AN1 _CH123SA = 0; //CH1 <- AN0, CH2-3 don't care //ADCSSL: A/D Input Scan Select Register ADCSSL = 0; //clear register //A/D interrupt config IFS0bits.ADIF = 0; //clear ADC interrupt flag // IEC0bits.ADIE = 1; //enable A/D conversion interrupt ADCON1bits.ADON = 1; //Turn on A/D
-----