[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Help: Weirdness with interrupts, ending up in unreac
From: |
Christian Ludlam |
Subject: |
Re: [avr-gcc-list] Help: Weirdness with interrupts, ending up in unreachable code |
Date: |
Wed, 26 Nov 2003 02:06:41 GMT |
User-agent: |
Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.03) POPstar/2.05 |
On 26 Nov Dan Lyke wrote:
[snip]
> Because I can't find "timer_enable_int" in any of my libraries, and I have:
>
> __vector_7() // SIGNAL(_SIG_OVERFLOW0)
> {
> if (slowdown)
> {
> slowdown--;
> }
> TCNT0 = 128; // will be variable once I get this working
> sei();
> }
>
Don't declare your function as __vector_7, use SIGNAL(SIG_OVERFLOW0). I
assume you tried this but you've got an extra _ in your signal name which
will cause the function to be ignored - it would be nice if the compiler
could warn you about this, and that has been suggested many times before.
The reason this will help is that the SIGNAL() macro tells the compiler that
the functon is an interrupt handler, which will make it preserve more
registers than it would normally have to. It will also preserve the status
register (SREG) which will remove the need for the extra sei().
HTH,
--
Christian Ludlam
address@hidden