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: Gavin Jackson
Subject: RE: [avr-gcc-list] Interrupt handling
Date: Wed, 26 May 2004 16:55:33 +1200

Can you confirm that you have a valid address at the
Timer 0 overflow vector. It sounds like the processor
is jumping to reset every time the interrupt fires.

Another thing you could do to check if this is the
case is to put a usart_send('0') just before you
enter the while loop. That way if you get a '01'
every time the interrupt fires you'll know that its
jumping to the reset vector rather than you interrupt
handler.

Regards

Gavin


-----Original Message-----
From: Kreyl Laurelindo [mailto:address@hidden 
Sent: Tuesday, 25 May 2004 5:22 p.m.
To: address@hidden
Subject: [avr-gcc-list] Interrupt handling


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 mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

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