AnsweredAssumed Answered

Interrupts dont work on Aduc7061

Question asked by lenin122 on Jul 23, 2013
Latest reply on Jul 23, 2013 by lenin122

I'm using EVAL - ADUC7061MKZ and IAR Embedded Workbench. I've statred ADC and trying to get ADC result via interrupt system, but my program doesn't enter in IRQ_HANDLER. Source samples here:

// Bit Definitions
#define BIT0  0x01
#define BIT1  0x02
#define BIT2  0x04
#define BIT3  0x08
#define BIT4  0x10
#define BIT5  0x20
#define BIT6  0x40
#define BIT7  0x80
#define BIT8  0x100
#define BIT9  0x200
#define BIT10 0x400
#define BIT11 0x800
#define BIT12 0x1000
#define BIT13 0x2000
#define BIT14 0x4000
#define BIT15 0x8000
#define BIT16 0x10000
#define BIT22 0x400000
#define BIT24 0x1000000
#define BIT30 0x40000000

#include<Analogdevices\ioaduc7060.h>
#include<stdbool.h>
#include<stdint.h>



long Ves = 0;
int delay_ms = 9047;




void init_acp()
{
  // Configure ADC0 for continuous conversions, 100hz, AIN0/1 Differential inputs
  ADCMSKI = BIT0;                                                                                // Enable ADC0 result ready interrupt source
  ADCFLT  = 0x5408;
  ADC0CON = BIT10 + BIT15;              // Gain = 32, Unipolar, enable ADC0, Int Reference
  ADCCFG = 0; 
  // Offest Self Calibration
  ADCMDE  = BIT2 + BIT4 + BIT7; 
  while((ADCSTA & BIT0) != BIT0){}          // Wait for Calibration routine to complete

  // Gain Self Calibration
  ADCMDE  = BIT0 + BIT2 + BIT4 + BIT7; 
  while((ADCSTA & BIT0) != BIT0){}          // Wait for Calibration routine to complete

  ADC0CON = BIT0 + BIT2 + BIT4 + BIT10 + BIT13 + BIT14 + BIT15;              // Gain = 32, Unipolar, enable ADC0, Int Reference
  ADCMDE  = BIT0 + BIT7;                                                             // Enable Continuous conversion mode
}


void init()
{
  POWKEY1 = 0x1;
  POWCON0 = 0x78;                       // Set core to max CPU speed of 10.24Mhz
  POWKEY2 = 0xF4;
  //GP0PAR = (1<<8) + (1<<12);
  GP0DAT = (1<<25) + (1<<26) + (1<<27); //display ports as output
  GP0DAT &= ~((1<<24)+(1<<28)); //buttons ports as input
  GP2DAT &= ~1; //buttons ports as input
  FEEMOD = 0x8;                                          // bit 3 should be set to allow erase/write command                          // erase last page of user code 

  // Initilize Timer 0 in Periodic mode with timeout period of 1 Second
  //T0LD  = 0x8000;                              // 32768 clock ticks
  //T0CON = BIT6 + BIT7;          // Periodic mode, enable timer, 32768hz clock/1
}




int main(void)
{
  init();
  init_acp();
  IRQEN = BIT10;                              // Enable Timer 0 IRQ
  while (1)
  {
    longtodisp(Ves);
    disp_out();
    delay(delay_ms);
  }
}


 __irq void IRQ_Handler(void)
{
  unsigned long IRQSTATUS = 0;

  IRQSTATUS = IRQSTA;             // Read off IRQSTA register
  Ves = 1000;
  if ((IRQSTATUS & BIT10) == BIT10)          //If ADC0 interrupt source
  {
    Ves = ADC0DAT;
  }

}

What wrong?

Outcomes