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 09:30
Modified:
  08/23/05 09:44

Read: times


 
#99886 - further optimisation
Responding to: ???'s previous message
Russell,

I don't see where does Jeroen's ISR use PSW - and the same applies for yours...

Of course one has to be aware that if he uses the same resources in interrupts and main he needs to preserve them - most often pushing them - and PSW and A are the most common examples.

There is also no problem with using registers for ISRs - again, with the same caution. This has to be applied for any resorce shared between interruptible parts of program and the interrupts (and gets more serious when dealing with nested interrupts). But also there is no need to spend the valuable stack space if not necessary (this also applies to calling routines from ISR, which might better be inlined - as you did).

Another thing what I don't understand in your reply is why do you clr ti, if it is nowhere tested.

Oh yes, and you can't do push/pop a ...

I would modify the ISR better this way (with the appropriate initialisation of tcount and ti):
 clr  TR0
 mov  TH0,#HIGH(-4800h)	; set for 20 ms
 mov  TL0,#LOW(-4800h)	;
 setb TR0
; push acc  ;if needed
; push psw  ;if needed
 djnz tcount,xx2
 mov  tcount,#250
xx1:
 jnb  ti,xx1
 mov  SBUF,#'C'
 clr  ti
xx2:
; pop  psw ;if needed
; pop  acc ;if needed
 reti

Jan Waclawek


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