AnsweredAssumed Answered

12bit ADC stop3 wait mode for avoiding noise?

Question asked by Cristian Martinez on Dec 1, 2010
Latest reply on Dec 7, 2010 by Daniel Lundin

Hi All.

 

This post continues the chapters of using the 12 bit ADC on JM16 series here and later here.

 

Mac, I have been reading again your tips, after using the voltage reference the measurements goes better, but still have fluctuations, small... but around +-8 values in the range of 4096 samples of the 12bit conversion.

 

Vref is totally stable near the micro. (+-1 mv)

Vsignal the same.

 

Vdd is tied to VddADC but Im not sure if those small fluctuations in the ADC Power are the responsible.

 

So before change my mind using an external ADC, I would ask you about how putting the ADC in sleep mode for reduce noise... Any ideas?

I´ve been reading that stop3 mode is the best option, but it seems it needs external ADCLK???

 

If you dont mind I will post some code I use for using the conversor.

 

 

void ADCInit(void) {      APCTL1_ADPC0 = 1;  // YOUT   APCTL1_ADPC1 = 1;  // ZOUT   APCTL1_ADPC2 = 1;  // POT   APCTL2_ADPC8 = 1;  // XOUT   ADCSC2 = 0x00;     // Disable HW trigger and autocompare    ADCCFG_ADIV = 3;   ADCCFG_MODE =  1;    // 1=12 bit.   ADCCFG_ADICLK = 3;    ADCCFG_ADLSMP = 1;   // 1 = long sample time    /* ADCSC1:  COCO=0,AIEN=0,ADCO=0,ADCH4=1,ADCH3=1,ADCH2=1,ADCH1=1,ADCH0=1 */   ADCSC1= 0x1F;}

The function that enables the conversion is:

 

byte AD1_Measure(byte WaitForResult){  if (ModeFlg != STOP) {               /* Is the device in different mode than "stop"? */    return ERR_BUSY;                   /* If yes then error */  }  ModeFlg = MEASURE;                   /* Set state of device to the measure mode */  AD1_HWEnDi();                        /* Enable the device */  if (WaitForResult) {                 /* Is WaitForResult TRUE? */    while (ModeFlg == MEASURE) {}      /* If yes then wait for end of measurement */  }  return ERR_OK;                       /* OK */}

 AD1_HWEnDi(); writes ADCSC1 register with ADCSC1= 0x42;  -> irq enable and ch2 enable

 

When I want to get a conversion I Call:

 

AD1_Measure(1)

 

I take 50 values and divide, but there is some small strange fluctuation

 

Can you help me about using the stop3 mode with some code example or anything for reducing noise in the moment of the conversion? That is my last chance! :s

 

Regards.

 

Cristian.

Outcomes