ISR(ANALOG_COMP_vect)

hello, i’m trying to star an interumpt when the IR send voltage greater then 1,1v (wich is acbg), it means the IR send 1,1v at 54cm so a voltage greater then 1,1v is between 20cm-53cm thats where i want the interupt to occur , from the datasheet i got 3 modes of compar ;Rising (11),failing(10) and change(00) but the problem is that the 3 of them give me the same answer they generate an interumption between 54cm and 150cm and the interumpts stop at 20cm-53cm

#include <avr/interrupt.h>


void setup()
{//i use arduino nano 
pinMode(7,INPUT);
Serial.begin(9600);
ACSR = B01011010; 
//analog interrupt example with the nano
//set the ACSR (analog comparator control and status register)
//ACSR - [ACD, ACBG, ACO, ACI, ACIE, ACIC, ACIS1, ACIS0]
//[ACD: anlog comparator, ACBG: analog comparator bandgap select: AIN1 is applied to positive input
//ACO: analog comparator output, ACI: analog comparator interrupt flag: clear pending interrupt
//ACIE: analog comparator interrupt:enable ,ACIC: analog comparator input capture: disable
//ACIS1: enable for rising edge, ACIS0: enable for rising edge
//ACIS1: disable for toggle, ACIS0: disable for toggle]
}

void loop()
{
}

ISR(ANALOG_COMP_vect)
{
Serial.println("Interrupt Executed!");
}

when the IR send voltage greater then 1,1v

As far as I know an IR receiver outputs a digital signal not a analog value.Also has a rule of the thumb you should not use the print inside an ISR function.Serial prints takes take by the nature of serial communication and the ISR function has to done very quickly.Instead just mark a volatile variable and use that variable in the loop to do something after the ISR occur( light an LED for example)

HugoPT:
Has far as I know an IR receiver outputs a digital signal not a analog value.Also has a rule of the thumb you should not use the print inside an ISR function.Serial prints takes take by the nature of serial communication and the ISR function has to done very quickly.Instead just mark a volatile variable and use that variable in the loop to do something after the ISR occur( light an LED for example)

i'm using a IR distance sensor and i changed my code i was aware of the problem set by the serial print but the more important is the analog comparator that generate the countray of what i want

What analog comparator?

aarg:
What analog comparator?

the analog comparator of an arduino nano or mega or leonardo

i mean i have the 3 boards

no one got an idea