Naruto Uzumaki

Unexplainable behaviour of ADCs on HC908JL16

Discussion created by Naruto Uzumaki on Jul 19, 2011
Latest reply on Jul 19, 2011 by bigmac

Hello!

 

 

I am having a really wierd problem with the ADCs of MC68HC908JL16. The odd numbered ADCs will work, the even numbered wont. The ADC is called as:

 

unsigned short int GetADCValue(unsigned char ADCChannelNumber)

{

ADCLK=0x10;

ADCSC=ADCChannelNumber;

 while(1)  {

 if (ADCSC&0x80==0x80)

  break;

 } 

return (unsigned short int) ADRL;
}    

so i initialize in the 8 bit 1 sample mode....the odd adcs will work, but if i use an even numbered ADC like 0,2,4,6 etc. it will not work. Actually, the condition (ADCSC&0x80==0x80) is never met for some reason. The odd channels do work confirmed. I checked this in hardware not software by displaying the ADC's value on an LCD.

 

Any help in this regard will be highly appreciated!

Outcomes