title: ADC interrupt not getting called
body: <p>I want ADC Interrupt Service Routine to be called after each End of Conversion. However it is not being called.</p>
  
  <p>Here's is my code:</p>
  
  <pre><code>#define RCC_APB2ENR   (*((volatile unsigned long*) 0x40021018))
  
  #define ADC1_CR1      (*((volatile unsigned long*) 0x40012404))
  #define ADC1_CR2      (*((volatile unsigned long*) 0x40012408))
  #define ADC1_SMPTR2   (*((volatile unsigned long*) 0x40012410))
  #define ADC1_SQR1     (*((volatile unsigned long*) 0x4001242C))
  #define ADC1_SQR3     (*((volatile unsigned long*) 0x40012434))
  #define ADC1_DR       (*((volatile unsigned long*) 0x4001244C))
  
  #define NVIC_SETENA_0 (*((volatile unsigned long*) 0xE000E100))
  #define NVIC_CLRENA_0 (*((volatile unsigned long*) 0xE000E180))
  
  
  volatile short conversionResult = -1;
  
  void ADC_IRQHandler(void)       // ADC Interrupt service routines
  {   
  
      if((ADC1_CR2 &amp; 0x00000002) == 0x00000002)       // check if EOC bit set
          conversionResult = ADC1_DR;     
      else
          conversionResult = -1;          
  }
  
  
  void ADC_Init(short mode)
  {
      // enable ADC Interrupts
      NVIC_SETENA_0 |= 0x00040000;
  
      // enable clock for ADC_1
      RCC_APB2ENR |= 0x0000200;
  
      ADC1_CR2 &amp;= 0x00000000;             // resetting controll registers
      ADC1_CR1 &amp;= 0x00000000;
  
      ADC1_CR1 |= 0x00000020;             // EOC interrupt enable
  
      if(mode == 1)                       // continous mode
          ADC1_CR2 |= 0x00000002;
  
  
      ADC1_CR2 |= 0x00000001;         // Waking up from power Down State
  
      // Perfroming Calibration
  
      ADC1_CR2 |= 0x00000004;
      while((ADC1_CR2 &amp; 0x00000004) != 0);
  }
  
  
  void ADC_ChannelConfig(short channelNumber, short sampleTime)
  {
      //selecting channel
      ADC1_SQR3 |= channelNumber; 
  
      //setting sample time for this channel
      int temp = sampleTime;
      temp = (temp &lt;&lt; channelNumber * 3);
  
      ADC1_SMPTR2 |= temp;
  }
  
  void ADC_StartConversion()
  {
      ADC1_CR2 |= 0x00000001;         // enable adc again to start conversion
  }
  
  int main(void)
  {
      ADC_Init(0);
      ADC_ChannelConfig(2, 3);
  
      ADC_StartConversion();
  
      while(1)
      {
      }
  
      return (1);
  }
  </code></pre>
  
  <p>Here's the disassembly after the interrupt occurs, 
  <a href="https://i.stack.imgur.com/HUora.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HUora.png" alt="enter image description here"></a></p>
  
  <p>I tried changing </p>
  
  <blockquote>
    <p>void ADC_IRQHandler(void)</p>
  </blockquote>
  
  <p>to,</p>
  
  <blockquote>
    <p>void ADC1_IRQHandler(void)</p>
  </blockquote>
  
  <p>but it still didn't worked.</p>
  
  <p>The Micro-controller I am using is STM32F103RB. Thanks!</p>