Trying to poll values from the ADC above a certain threshold

Hey Guys,

I am working on a project on trying to poll values from the ADC outside a certain window. I plan to use the ADC's window comparision register functionality to achieve this functionality. I have tried to do it but nothing seems to work. Please find attached my code.

void setup()
{ 
 
 //ADC Configuration
 analogReadResolution(12);//Setting the ADC resolution to 12 bits
 ADC->ADC_MR|=0x80;//Setting the ADC Mode Register to Freerun Mode to get the best sampling rate.
 ADC->ADC_CHER = 0x80; // Enable ADC channels A0
 adc_set_comparison_channel(ADC, ADC_CHANNEL_7);//Enabling comparision functionality on A0
 adc_set_comparison_mode(ADC, ADC_EMR_CMPMODE_IN);//Enabling Window mode
 adc_set_comparison_window(ADC,0,2048);
 //ADC->ADC_IER|=0x04000000;
 //adc_configure_trigger(ADC, ADC_TRIG_SW, 0);
  //NVIC_EnableIRQ(irq)
 ADC->ADC_CR=2;
 //adc_configure_trigger(ADC, ADC_TRIG_SW, ADC_MR_FREERUN_ON);
 analogWriteResolution(12);
 //analogWrite(DAC0, 0); // Enables DAC0

}

void loop()
{
 
 
 
         Serial.println(ADC->ADC_ISR); 

 
}