fuzedmass
Junior Member level 2
Hello,
I am currently using DSPIC33fJ128GP710 at 80MHZ (FRC with PLL). I am using the ADC of dspic33f in
1. 12bit mode.
2. Vref+ = 3.3v & Vref-=0v.
3. I have configured TAD and Sampling time to be automatic.
Now the problem I am facing is that the digital value is not constant, I mean I know that you get a very very small error but in my case ADC always shows +-300 digital value error on a constant voltage (using online debugging of PICkit2 I have noted the digital value), I have also configured 10bit ADC but this problem still persisted.
Should I configure TAD and Sampling time to be maximum, is this the problem ?
My CODE:
//
AD1CSSH=0x1000; //select AN28 for analog input
//
AD1CHS0 = 28; // channel input is AN28
AD1CON1bits.ASAM = 1; // SAMP bit auto set
AD1CON1bits.SSRC = 7; // auto sampling and convert
AD1CON1bits.AD12B = 1; // select 12-bit, 1 channel ADC operation
// No channel scan for CH0+, Use MUX A, SMPI = 1 per interrupt, Vref = AVdd/AVss
AD1CON2 = 0x0000;
AD1CON3bits.SAMC=0x3; // auto sample time
AD1CON3bits.ADCS=0x1f; // conversion clock select
IFS0bits.AD1IF = 0; // reset ADC interrupt flag
AD1CON1bits.ADON = 1; // turn on ADC module
while(IFS0bits.AD1IF == 0); // wait for conversion
AD1CON1bits.ADON = 0; // turn off ADC module
IFS0bits.AD1IF = 0; // reset ADC interrupt flag
Please Help me. Thanks
I am currently using DSPIC33fJ128GP710 at 80MHZ (FRC with PLL). I am using the ADC of dspic33f in
1. 12bit mode.
2. Vref+ = 3.3v & Vref-=0v.
3. I have configured TAD and Sampling time to be automatic.
Now the problem I am facing is that the digital value is not constant, I mean I know that you get a very very small error but in my case ADC always shows +-300 digital value error on a constant voltage (using online debugging of PICkit2 I have noted the digital value), I have also configured 10bit ADC but this problem still persisted.
Should I configure TAD and Sampling time to be maximum, is this the problem ?
My CODE:
//
AD1CSSH=0x1000; //select AN28 for analog input
//
AD1CHS0 = 28; // channel input is AN28
AD1CON1bits.ASAM = 1; // SAMP bit auto set
AD1CON1bits.SSRC = 7; // auto sampling and convert
AD1CON1bits.AD12B = 1; // select 12-bit, 1 channel ADC operation
// No channel scan for CH0+, Use MUX A, SMPI = 1 per interrupt, Vref = AVdd/AVss
AD1CON2 = 0x0000;
AD1CON3bits.SAMC=0x3; // auto sample time
AD1CON3bits.ADCS=0x1f; // conversion clock select
IFS0bits.AD1IF = 0; // reset ADC interrupt flag
AD1CON1bits.ADON = 1; // turn on ADC module
while(IFS0bits.AD1IF == 0); // wait for conversion
AD1CON1bits.ADON = 0; // turn off ADC module
IFS0bits.AD1IF = 0; // reset ADC interrupt flag
Please Help me. Thanks