Page 1 of 1


Posted: Wed Feb 27, 2008 11:34 am
by Peter

I want to use the Interupt1 to measure a fequency.
If there is a falling edge the timer has to start. At a rising edge the timer should stop.

So my question is how to initialize the interupt. In the usbInit() the Interup0 is initialized.
But my interupt should only be acitve if it will be used. So I want to activate and disable it on some points in the programm.

My other question is, how and where I have to write the ISR?
Can I write it like this:

Code: Select all


I hope you can help me.

One last question I have:
Is there anywhere a tutorial or a documentation how AVR-USB is used?


Posted: Thu Feb 28, 2008 11:01 pm
by christian
Regarding how to enable/disable interrupts: You have to set the interrupt-enable bit for your interrupt in the appropriate register. That's similar to the code in usbInit().

The interrupt handler should not be declared with ISR if you use AVR-USB since it must allow other interrupts. Use UTIL_INTERRUPT instead where UTIL_INTERRUPT is declared as

Code: Select all

#define UTIL_INTERRUPT(signame)                         \
    void signame (void) __attribute__ ((interrupt));    \
    void signame (void)

There's currently no tutorial, only examples, see our reference implementations.