AnsweredAssumed Answered

Hi. I need help with mc9s08qg8 ADC

Question asked by SANTHOSH GOVARDHAN rajamanickam on Jul 15, 2011
Latest reply on Jul 19, 2011 by bigmac

 this is the code i am using and i am not able to get the output. can you suggest me with any possible sollutions please?

 

 

#include <hidef.h> /* for EnableInterrupts macro */

#include "derivative.h" /* include peripheral declarations */

 

void main(void)

{

  EnableInterrupts;


 

  PTADD = 0x00;

  PTAPE = 0xFF;

  PTBDD = 0xFF;

 

  for(;:smileywink:

  {

    __RESET_WATCHDOG();

   

    ADCSC1_ADCH = 0x00; 

    ADCSC1_AIEN = 1;

    ADCSC1_ADCO = 0;

    ADCSC2_ADTRG = 0; 

    ADCSC2_ACFE = 0; 

    ADCCFG_ADICLK = 0; 

    ADCCFG_ADIV = 0; 

    ADCCFG_MODE = 0x00; 

    ADCCFG_ADLSMP = 0; 

    APCTL1 = 0x01;

 

      if(ADCSC1_COCO==1)

      {

           

            PTBD_PTBD0 = ADCRL_ADR0;

            PTBD_PTBD1 = ADCRL_ADR1;

            PTBD_PTBD2 = ADCRL_ADR2;

            PTBD_PTBD3 = ADCRL_ADR3;

            PTBD_PTBD4 = ADCRL_ADR4;

            PTBD_PTBD5 = ADCRL_ADR5;

            PTBD_PTBD6 = ADCRL_ADR6;

            PTBD_PTBD7 = ADCRL_ADR7;

                       

      }

 

   

  }

}

Outcomes