AnsweredAssumed Answered

ADC problem

Question asked by dgipling on Dec 4, 2009
Latest reply on Sep 14, 2010 by Vasanta Tanna

Hi, I am pretty new to ColdFire CPU and have just started to work with it.  I want to use the ADC converter to do some simple measurments.  I have tried the following code but all that is printed is 0 for all channels.

 

           MCF_ADC_CTRL2 = 0x1F; //slowest possible clock
          
           MCF_ADC_POWER &= ( MCF_ADC_POWER_PD0 |   //power up ADC
                  MCF_ADC_POWER_PD1 |
                  MCF_ADC_POWER_PD2 );
          
           MCF_GPIO_PANPAR = 0xff;   //use adc on AN0-7
          
           MCF_ADC_CTRL1 = 0x2000;  //start convertion single ended once seqential
          
           while ( MCF_ADC_ADSTAT & 0xc000 ); //wait till convertions ready
          
           for ( i = 0; i < 8; i++ )
            printf ( "ADC%d: %x\n", i, MCF_ADC_ADRSLT(i));

 

The CPU is a 52233 using a 25MHz Xtal multipledied with 2 by the PLL to be able to use fast ethernet.   

Outcomes