AnsweredAssumed Answered

Need RS08LE4 ADC Help

Question asked by Jeremy Means on Apr 2, 2010
Latest reply on Apr 5, 2010 by Jeremy Means

Hello all.  I am very confused about how to use the ADC for a new board that I am putting together.

 

Whenever I use an ADC on a new design, I always ensure that my code is reading it properly, so I just setup the internal channels VrefH and VrefL channels to be read to verify that the 0x000 and 0x3FF (or thereabouts) are being read back consistently, and then I would change my code to switch between the various channels as necessary and go full-speed for my oversampling algorithms.

 

The problem I am having is that even though my voltage is steady (using a 5V switching supply for this part), my ADC inputs are all over the map, as low as 0x357 and upwards of 0x3FD.  I have done something similar before with little jitter of perhaps 3-4 counts in a noisy environment.

 

Please let me know if there are any thoughts on this, as it is driving me nuts!

 

 

I have attached my code below.

 

void main(void)
{

word wADC_Input;

APCTL1 = 0x04;   //ADC2 is used as an ADC input.
ADCCFG = 0b00001000;    //Clock Divide = Input Clock / 2, long sample time, 10-bit mode, input clock = bus-clock / 2.
ADCSC1 = 0x1D;

 

for(;:smileywink: //Infinite loop.
    {
        __RESET_WATCHDOG(); /* feeds the dog */

        if(ADCSC1 & 0x80)
        {  //Is conversion complete?
            wADC_Input = ADCR;

            //Setup a read for the next ADC Channel.
            ADCSC1 = 0x1D;
        }
    }

}

Outcomes