Go Down

Topic: Analog Comparator Interrupt (Read 9806 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy