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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/23/05 16:29
Read: times


 
#99913 - Actually, PSW IS affected
Responding to: ???'s previous message
in the ISR by the line
	djnz	R3,	EXIT

DJNZ will affect carry. So formally, he does need to save PSW.

BUT: because his main loop is so shockingly simple, he will never notice the ISR thrashing PSW, so in practice, in this particular case, he will not benefit from saving either the accu or PSW.

To Jeroen:

I would also like to point out that the SEND subroutine is bad (do not reset TI manually before sending a character! What if the UART is still busy?) and that it's called from within the timer ISR. Since the SEND routine polls TI in a tight loop and doesn't return until TI goes high again, the timer ISR will not return until the UART has sent the character out completely, this makes the timer ISR waste a lot of cycles. I wonder why you made it a subroutine anyway, since you only use it once. Why not simply include the write to SBUF in the timer ISR directly?
Now I know it will probably work for a simple project like this, but it's not good practice. If you ever want to make more serious programs, "techniques" like "doing potentially time consuming things inside an ISR" and "JNB SOMETHING,$" will kill you. Unlearn them quickly!


List of 19 messages in thread
TopicAuthorDate
Timer miscounts?            01/01/70 00:00      
   Counter counts upwards            01/01/70 00:00      
   solved            01/01/70 00:00      
   More problems            01/01/70 00:00      
      further optimisation            01/01/70 00:00      
         Right here:            01/01/70 00:00      
            Bible time...            01/01/70 00:00      
               you are right            01/01/70 00:00      
               Thinking time            01/01/70 00:00      
                  how precise "bibles" are            01/01/70 00:00      
   Actually, PSW IS affected            01/01/70 00:00      
      bible time again and again            01/01/70 00:00      
         Not there???????            01/01/70 00:00      
   wilbers.asm updates            01/01/70 00:00      
      The shame of it all!            01/01/70 00:00      
         I am sorry            01/01/70 00:00      
            old farts make mistakes too            01/01/70 00:00      
               No offense taken            01/01/70 00:00      
         wow what a replies            01/01/70 00:00      

Back to Subject List