On 2006-03-20, Roberto Padovani <padovan...@gmail.com> wrote:

> Has anyone ever changed an interrupt handler during runtime?

I've done it on other processors, but I've never done it by
changing a value in flash.  I've done it by changing the value
of a vector that's in RAM, and also by putting the address of a
RAM-resident jump instruction in flash, and then changing the
destination of that jump instruction at run-time.

> I need to do that and any idea is welcome.
>
> I suppose I should declare two ISR like:
>
> interrupt (NOVECTOR) ISR1 {....}
> interrupt (NOVECTOR) ISR2 {....}
>
> and then write the address  of the routine I want in the flash in the
> vector table.

Is this something you're going to do often? It takes a lot of
time and power to write to flash.  And you don't get an
infinite number of write cycles either.

> Or maybe is it better something like:
>
> interrupt (TIMERA0) ISR {
>      if (flag)
>           func1();
>     else
>           func2();
> }
>
> I would prefer the first solution because I have some
> performance issues with the second one.

It depends on when and how often you need to change ISRs.

-- 
Grant Edwards                   grante             Yow!  MERYL STREEP is my
                                  at               obstetrician!
                               visi.com            


Reply via email to