[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Two interrupts one function?

From: Ned Konz
Subject: Re: [avr-gcc-list] Two interrupts one function?
Date: Sun, 14 May 2006 06:14:28 -0700
User-agent: Thunderbird (Macintosh/20060308)

Trampas wrote:
I have two external interrupts connected to a quadature encoder, I do the same operations when either interrupt pin is changed. I was wondering if it was possible to have one ISR that is called from both interrupts. If so how do I do it?

Seems like this would work (jump from the second handler to the first).
Look at the definition of ISR(), EMPTY_INTERRUPT(), and _VECTOR()

avr-gcc -Os -mmcu=atmega128 -Wa,-ahlsd=twoisrs.lst -o twoisrs.elf twoisrs.c

#include <avr/io.h>
#include <avr/interrupt.h>

// defines __vector_1
        // do your thing here...

// or use whatever interrupt number you need to:

void INT1_vect(void) __attribute__ ((signal, naked));

void INT1_vect(void)
    __asm__ __volatile__ ("jmp __vector_1" ::);

int main(void)

Ned Konz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]