Newb Q re. interrupts & timers

Hello, all,
First post.

Arduino is "in the mail". I'm studying up and seem to be missing some documentation.

I have the Arduino Reference (it came with the Arduino-011 package) and the Atmel reference (376 pages!) for the ATmega168.

I want to use timers and interrupts yet I see little (only attach & detach; not even enable & disable!) information in the Arduino extended reference.

Where's the "nitty gritty" on implementing interrupts and using timers in Arduino? Is this possible using the Arduino tools? Or does this require something like writing an assembly lib. routine?

Help finding documentation and suggestions as to how interrupts and timers are used would be appreciated...ß :frowning:

I found this article which helps in the basics, but it's not done in the Arduino environment:
http://www.evilmadscientist.com/article.php/avrdac

Thanks,
Dave

PS, if this is an inappropriate place to ask this Q, apologies; just point me in the right direction...

There's a pretty good library that implements timer interrupts on Arduino:
http://www.arduino.cc/playground/Code/FrequencyTimer2

Just remember whatever frequency you set, it will run your interrupt handler at twice that rate (it's a silly bug that caused me a lot of trouble).

There's a pretty good library that implements timer interrupts on Arduino:
http://www.arduino.cc/playground/Code/FrequencyTimer2

Thanks for your reply.

I don't want to implement interrupts generated by the counter. I want to use external interrupts to execute a routine which will read the value of the counter then reset it. I'm comparing the timing of 2 external events. (I need 2 timers, 2 external interrupts.)

So the general answer to my Q is that this capability isn't handled by Arduino's standard implementation; I need to use library functions to handle interrupts and manipulate the counters? This is why no mention is made in the reference?

Thanks again,
Dave
Newb'

You can use the External interrupts 0 and 1, available on digital pins 2 and 3 respectively. These are the two interrupts that use the attachInterrupt function. When you call it, it will automatically enable the interrupts for those two vectors.
You can set the interrupts to trigger on the falling or rising edge of the signal, or when it is low. The datasheet describes them as INT0 and INT1, starting from page 67.