[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Re: More interrupt oddity
From: |
Chris Baugher |
Subject: |
[avr-gcc-list] Re: More interrupt oddity |
Date: |
Sat, 20 Oct 2001 14:11:43 -0500 (CDT) |
On Fri, 19 Oct 2001, Chris Baugher wrote:
>
> Hello again,
>
> I've stumbled into another interrupt problem. The code looks like this:
Ok, I solved my own problem. What I did wrong was this:
volatile char displacement;
SIGNAL(SIG_INTERUPT0) <------notice mis-spelling, should be SIG_INTERRUPT0
{ with 2 R's
--displacement;
}
The goofy part is that the linker didn't give any errors or warnings that
something may be wrong. Shouldn't it fail with an undefined symbol or
something?
C|
> volatile char displacement;
>
> SIGNAL(SIG_INTERRUPT0)
> {
> --displacement;
> }
>
> SIGNAL(SIG_INTERRUPT1)
> {
> ++displacement;
> }
>
>
> INTERRUPT(SIG_OVERFLOW0)
> {
> ...
>
> read value of displacement and do some stuff
>
> ...
>
> }
>
>
> What's happening is that the increment and decrement are being eliminated
> somehow during linking. I know this because the list file shows the
> correct code but the object module only has one instruction (reti) for
> each ISR. How can I keep this from happening?
>
> Thanks again.
>
> Chris|
>
>
>