[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Interrupt handling
From: |
Kreyl Laurelindo |
Subject: |
[avr-gcc-list] Interrupt handling |
Date: |
Tue, 25 May 2004 09:21:42 +0400 |
Hi!
Writing asm codes, I usually used things like this:
============
...
.org 0x09
reti ; Timer0 overflow handler
...
; in main function:
...
_start:
sei
sleep ; enter sleep mode
; do smth
rjmp _start
===========
E.g., I did not need anything else from that "Timer0 overflow
interrupt handler" than just awake from sleep mode. Now, I tried use
the same in c:
==========
...
void init (void)
{
... //setup timers, sleep mode, usart, etc.
}
void main (void)
{
init();
while(1)
{
usart_send('1');
sei();
sleep();
usart_send('2');
... // do something
}
}
SIGNAL (SIG_OVERFLOW0)
;
==============
So, if this would work as I want, I would see '1' and then '2' at
terminal window. But I see only '1', as if 'while' loop begins again
after awake (not next instruction, as in aseembly). So, I decided I do
not understand something in interrupts realisation.
I tried 'asm volatile ("nop"::);' instead of just ';', and this had no
effect, too.
Maybe, things of such type would be realised in other way? I just want
to wake after sleep :-) with no need of special interrupt routines.
Kreyl
- [avr-gcc-list] Interrupt handling,
Kreyl Laurelindo <=