Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/29/03 14:17
Read: times


 
#37652 - RE: register protection in 8051
in the code, i am incrementing the register r5. say, it is first initialised to zero.then i am pushing to the stack. i 'll increment it inside the interrupt loop. so, now if i pop it again, then will it be initilaised again to zero value?

1) Get rid of whatever is in your head re interrupts and push and pop it is wrong.

2)
When entering an interrupt service routine (ISR)
a) ALWAYS push the PSW
b) push a, b, dph and dpl if they are used in the ISR.

In the ISR
anything you need to be the same when the ISR is entered again MUST be global variables. (Others, please do not argue about local permanent variables - it is beyond the scope of this)

When exiting the ISR
pop what you pushed on entry in reverse order.

Erik

List of 13 messages in thread
TopicAuthorDate
register protection in 8051            01/01/70 00:00      
   RE: register protection in 8051            01/01/70 00:00      
RE: register protection in 8051            01/01/70 00:00      
   RE: register protection in 8051            01/01/70 00:00      
      RE: register protection in 8051            01/01/70 00:00      
         RE: register protection in 8051            01/01/70 00:00      
            RE: register protection in 8051            01/01/70 00:00      
RE: register protection in 8051            01/01/70 00:00      
RE: register protection in 8051            01/01/70 00:00      
RE: register protection in 8051            01/01/70 00:00      
RE: register protection in 8051            01/01/70 00:00      
RE: register protection in 8051            01/01/70 00:00      
   RE: register protection in 8051            01/01/70 00:00      

Back to Subject List