avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] SREG save?


From: gouy yann
Subject: Re: [avr-gcc-list] SREG save?
Date: Tue, 14 Dec 2004 13:17:54 +0100 (CET)

Hi,

if the code in your interrupt routine modifies the
SREG and it would certainly, then saving SREG is
mandatory because when returning from the interrupt,
the interrupted code doesn't know SREG could have been
modified and relies on its original value.

concerning the use of cli() and sei(), you would
probably saved SREG before calling them to keep the
original state of the interrupt flag.

if you want your interrupt routine to run
uninterruptible, you should use INTERRUPT() rather
than SIGNAL().

bye.
   Yann

 --- Gergely Szentesi <address@hidden> a
écrit : 
> Hi!
> 
> I`m working on a small project with an atmega128
> proc.
> About the gcc i have a following question: 
> Should i save the SREG ( system register ) to a
> register when the program enters to a signal or
> interrup routine or after a cli() ( disable global
> interrupt )?
> 
> SIGNAL(...)
> {
>     char csreg;
>     csreg = SREG;        //is it important or not?
>     ...code....
>     SREG = csreg;
> }
> 
> Thanx: )
> 
> 
> Szentesi
> 
> University of Debrecen Medical and Health Science
> Center
> Faculty of Medicine Department of Biophysics and
> Cell Biology
> P.O.Box 39, Nagyerdei krt. 98
> H-4012 Debrecen
> Hungary
>  
> Phone/Fax:  (36) (52) 412-623
> mailto:address@hidden
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
>  

=====



        

        
                
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/ 
 
Avec Yahoo! faites un don et soutenez le Téléthon en cliquant sur 
http://www.telethon.fr/030-Don/10-10_Don.asp


reply via email to

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