AnsweredAssumed Answered

QD4 ADC problem

Question asked by Abhijit Jagtap on Feb 25, 2009
Latest reply on Feb 25, 2009 by Abhijit Jagtap

Hello

 

I am trying to use the AD2 in QD4 as an ADC input.

This is measuring a +5V max signal.I am testing it at 2.5V.

 

For this I wrote this code


void main(void)   {  ICSTRM = ICSTRM_FLASH;  ICSC2 = 0x00;  ICSC1 = 0x06;  //Wait until output FLL is selected (CLKST=0)  while (ICSSC & 0x04)    ;                      SOPT1_COPE = 0;    //disable COP            // set up adc  ADCSC1_ADCH = 0x1f; // disables the ADC during config  ADCCFG_ADICLK = 0;// bus clk   ADCCFG_MODE = 0b00; // conversion mode, 00 = 8 bit, 10 = 10 bit mode  ADCCFG_ADLSMP = 1;  // sample time, 1 = long sample time  ADCCFG_ADIV = 1;    // clock divide, 1 = input clock/2  ADCCFG_ADLPC = 1;  // low power config, 1 = low power    ADCSC2_ADTRG = 0;   // trigger select, 0 = software trigger  ADCSC2_ACFE = 1;    // compare function, 1 = enable compare function  ADCSC2_ACFGT = 1;   // 1 = compare function greater than    ADCSC1_ADCO = 1;    // enable single conversion, 1 is continuous conversion  ADCSC1_AIEN = 1;    // enable ADC interrupt  APCTL1_ADPC2 = 1;   // disable I/O control on pin      ADCCVL = 0x80;      // set a compare value      PTADD_PTADD0 =  0x01;    PTAD_PTAD0 = 0;     //reset LED      ADCSC1_ADCH = 0x02;   //ADP2 enable              EnableInterrupts;   // enable interrupts           ADCSC1_COCO = 0;   for(;;)     {    //__RESET_WATCHDOG();  feeds the dog     } //loop forever      /* please make sure that you never leave this function */                                                        }// end main interrupt 19 void ADC_ISR(void)   {     PTAD_PTAD0 =1;    ADCSC1_ADCH = 0x1f; // disable the ADC      }

 But even if ADCRL is <0x80, the ADC interrupts,which it should not.

 

I want to interrupt only on ADCRL>=ADCCVL but this is not happening.

 

I am using this on USBSPYDER.

 

Am I doing something silly?

 

Please help...Thanks and Regards :smileyhappy:


Outcomes