[AVR Interrupt] push/pop or temp register

Thread Starter

roberto k.

Joined Apr 25, 2018
7
Hi,
Is it better to use push/pop to save/restore SREG or a general pourpose register ?

What is different about the two
Thanks
 

DickCappels

Joined Aug 21, 2008
10,169
Both.
I always push then pop on chips with the stack in RAM. That's why the stack is there. On chips with hardware stacks, stack space is too precious so I use a dedicated memory location or a dedicated register.
 

Thread Starter

roberto k.

Joined Apr 25, 2018
7
Thankyou Mr.DickCappels .A few hours ago I read that there is a slight difference regarding the speed ( n° cycles),
but in my application It's irrelevant :)
 
Top