Go Down

Topic: Analog Comparator Interrupt (Read 8689 times) previous topic - next topic

sirch

afremont - many thanks, that's excellent.

PhiPha

Hello guys!

I have trouble in my head :-D... I'm trying to measure pulse width at treshold on Arduino MEGA2560, so I've decided to use the analog comparator.

I want to have:
signal connected to AIN0
treshold connected to AIN1

easy code:
void setup()
{

Serial.begin(9600);
ACSR = B00011011; // comparator interrupt enabled and tripped on falling edge.
}

void loop()
{
}

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


Which pin am I supposed to use? I've read the datasheet and there is no connection of AIN0 to any pin, where I can connect my signal :-/

Any advices??

Thank you!

Go Up