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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/07/05 10:46
Modified:
  02/07/05 10:59

Read: times


 
#86737 - Setup stack inside interrupt
Responding to: ???'s previous message
My usual solution is much like of ' Bartosz Wucke'.

But since my timer interrupts are likely used for other important jobs, I add in the least important one a line like the following one:

JNB FLAG_wait, TMRcont

So as long as the 'FLAG_wait' is not set, the other functions in the timer interrupt routine are normally executed. Otherwise the following lines will be executed instead (might need more instructions like CLR TR?... etc):

CLR FLAG_wait ; since it is set for one time job.
POP tempByte ; 'tempByte' is any redundant register
POP tempByte ; to remove the unwanted actual address
PUSH DPL ; DPTR has to be already loaded to
PUSH DPH ; point the new destination address
RETI ; Return from timer interrupt

But before the check-pin instruction the following need to be added too:

SETB FLAG_wait ; important
MOV DPTR, #exit_label ; the new destination, important
CLR TR0 ; or TR1, to change TLx and/or THx
MOV TL0, #-limitL ; limitL= low byte of maxDelayCycles
MOV TH0, #-limitH ; limitH= high byte of maxDelayCycles
SETB TR0 ; or TR1, to activate the timer

JNB P1.0,$ ; or alike, now has a time limit
....
....

(by the way, why does the post here look different than the text I copied from?)


List of 15 messages in thread
TopicAuthorDate
How to escape from an endless loop ?            01/01/70 00:00      
   what is the problem?            01/01/70 00:00      
   Counter            01/01/70 00:00      
      How about another BIT flag            01/01/70 00:00      
         how would you do that            01/01/70 00:00      
         Problem Solved with a combination.            01/01/70 00:00      
   External interrupt            01/01/70 00:00      
      Additional explanation about the problem            01/01/70 00:00      
         loops            01/01/70 00:00      
            Not in the ISR            01/01/70 00:00      
         Answer t o additional explanation            01/01/70 00:00      
   Messing with stack inside interrupt...            01/01/70 00:00      
      Setup stack inside interrupt            01/01/70 00:00      
   I am sure it is good way for you!            01/01/70 00:00      
      Your idea is good.            01/01/70 00:00      

Back to Subject List