avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Interrupt Handling


From: Rich Neswold
Subject: Re: [avr-gcc-list] Interrupt Handling
Date: Fri, 14 Dec 2001 13:49:19 -0600
User-agent: Mutt/1.2.5i

Wasn't it 14-Dec-2001, at 02:18PM, when Torsten Hahn said:
> can i write my own function with all the things that an interrupt handler 
> makes (save the SREG etc.) ?
> I want to have something like:
> 
> SIGNAL(SIG_OVERFOLW0) { ... code ...}
> SIGNAL(MySignal){... other code ...}
> 
> wich results in an function with all the stuff a "normal" interrupt handler 
> does. And then, in the programm, "switch" from one handler for the 
> SIG_OVERFOLW0 interrupt to the other one by writing the address of MySignal 
> to the interrupt vector table;
> 
> Is this possible ? And how i have to define MySignal ?

Nope. The interrupt table is in FLASH, so it can't be modified while the
processor is running. How about this psudo-code:

    static void func_a(void)
    {
        ... do something here ...
    }

    static void func_b(void)
    {
        ... do another thing here ...
    }

    SIGNAL(SIG_OVERFLOW0)
    {
        if (some state)
            func_a();
        else
            func_b();
    }

If you don't want to waste the stack space for the function calls, you
could simply inline the function at the appropriate spot.

-- 
 Rich Neswold
 
 efax: 1.240.536.7092
  web: www.enteract.com/~rneswold/
 
 rand: b03a8a99b6f8b3a5036df3bb

Attachment: pgp7LALQpJGsr.pgp
Description: PGP signature


reply via email to

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