Vasanta Tanna

MCF52235 ADC issue - AN7 as ADC input, never get read value in software routine?

Discussion created by Vasanta Tanna on Aug 29, 2010
Latest reply on Sep 1, 2010 by Mark Butcher


I have question about ADC of 52233 chipset. I am using AN0 to AN5 as GPIO output for analog chip select and AN7 pin as ADC input. When I select chip using AN0-5, I can see sample on AN7 using scope, but when I read in software routine, I am not getting value.

I am reading AN7 using this:
 volt_buf1 = (int)  ((MCF_ADC_ADRSLT7&0x7FF8) >> 3);

but I never get AN7 valu into volt_buf1, any reason?

 

 

this is init code for AN0-5 and AN7

 

//AN0-5 as GPIO output and AN7 as ADC Input:

MCF_GPIO_DDRAN =
     MCF_GPIO_DDRAN_DDRAN6 |
     MCF_GPIO_DDRAN_DDRAN5 |
     MCF_GPIO_DDRAN_DDRAN4 |
     MCF_GPIO_DDRAN_DDRAN3 |
     MCF_GPIO_DDRAN_DDRAN2 |
     MCF_GPIO_DDRAN_DDRAN1 |
     MCF_GPIO_DDRAN_DDRAN0 ;


//AN7 as ADC input
MCF_GPIO_PANPAR = MCF_GPIO_PANPAR_PANPAR7;

MCF_GPIO_PORTAN = 0;

Thanks for help



Outcomes