> -----Original Message-----
> From: 
> avr-gcc-list-bounces+eric.weddington=atmel....@nongnu.org 
> [mailto:avr-gcc-list-bounces+eric.weddington=atmel....@nongnu.
> org] On Behalf Of darkschine
> Sent: Thursday, November 19, 2009 6:09 AM
> To: avr-gcc-list@nongnu.org
> Subject: [avr-gcc-list] assembly-c mix and interrupts
> 
> 
> Before I continue, I would like to suggest a resolution to my 
> problem. I am
> using the ATmega328P
> My assembly code follows a standard that ALL registers used 
> are pushed and
> popped from the stack. However, my assembly code does NOT 
> store the SREG.
> Could this be causing my problems?

Yes.

If your interrupt routine starts, performs some code which changes the value of 
SREG, and then returns back to mainline code which has some branch instruction 
that depends on the Status Register to determine which branch to take, then you 
will get unexpected results as the Status Register now reflects what happened 
in your interrupt code and not what happened in the mainline code before the 
interrupt occurred.


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to