Hi,
I'm using the MC908SQG4 (pdip 8 pins) for adquire two volatge levels using the ADC module. I don't need and interruption during the normal opreration so I decide to use a polling software solution, and here begins the problem. I'm just debbuging some test code just to verify the adquisition method, and when I start the conversion as soon as i choose the input channel the COCO flag is set to 1, and finish the conversion process without result (ok result equals 0) here is the code
ADC configuration:
void initCAD(){
//0001 1000
ADCCFG_ADICLK=0;
ADCCFG_MODE=2; //10 --> 10 bits
ADCCFG_ADLSMP=1;
ADCCFG_ADIV=0;
ADCCFG_ADLPC=0;
ADCSC2=0x00;
//0001 1111
ADCSC1_ADCH=0x1F;
ADCSC1_ADCO=0;
ADCSC1_AIEN=0;
//0000 0011 PTAD0+PTAD1
APCTL1=0x03;
}
main loop:
for(;
{
delay1ms();
ADCSC1_ADCH=0x01; --> here I select CH0 or CH1 and COCO flag is SET
while (!ADCSC1_COCO) ;
ADCSC1_ADCH=0x1F; --> disable de ADC module
resL=ADCRL;
resH=ADCRH;
} /* loop forever */
Anybody can help me? I miss something but I'm not abble to find it!
Thx for all,
Added p/n to subject.
Message Edited by NLFSJ on 2009-03-19 12:36 PM