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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/10/08 22:31
Read: times


 
#149285 - set a trap and walk right into it
Responding to: ???'s previous message
Regarding the PUSH ACC and POP ACC--note that the external interrupt and the global interrupt bit has been enabled in the last 3 lines of the following code snippet (copied from the main part of the program):
relying on an interrupt only enabled when it "can do no harm" is a surefire way to create somnething that will bite you in the muscle you sit on some day.

SAVE THE REGISTERS

MOV A,P0 ;MOV 8 BIT DIGITAL VALUE FROM ADC TO ACC
also
for the teasons stated above use a memory location, not a register to transfer the read byte.

Yes, there MAY be a case or two where the timing budget is so narrow that tricks like not saving registers may be appropiate, but they are few and I would in such a case use a faster processor rather that resorting to such tricks. I do have a case in my past (when the '51s were steam driven) where R7 was SOLELY used for transfer between an int and the main, but NEVER the acc. That program had, for every 25 lines the following comment
; DO NOT USE R7 it s reserved for interrupt/main use

Erik


List of 8 messages in thread
TopicAuthorDate
Check my External Interrupt code            01/01/70 00:00      
   new question about external interrupt code            01/01/70 00:00      
      Scarry Type ISR Programming            01/01/70 00:00      
         Problem solved...almost...            01/01/70 00:00      
            Bogus Interrupt Usage            01/01/70 00:00      
               An alternative to your solution?            01/01/70 00:00      
                  set a trap and walk right into it            01/01/70 00:00      
   A comment on comments            01/01/70 00:00      

Back to Subject List