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

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

RE: [avr-gcc-list] assembly-c mix and interrupts


From: Weddington, Eric
Subject: RE: [avr-gcc-list] assembly-c mix and interrupts
Date: Thu, 19 Nov 2009 06:40:43 -0700

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of darkschine
> Sent: Thursday, November 19, 2009 6:09 AM
> To: address@hidden
> 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.




reply via email to

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