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 13:31
Modified:
  01/10/08 13:32

Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#149218 - Bogus Interrupt Usage
Responding to: ???'s previous message
Your idea of how to keep the A register from being trashed is wrong.

Take for example your main line code snippett...
N9:
        MOV A,#'N'
	CALL TX_BYTE
	MOV A,#'9'
	CALL TX_BYTE
RET


If the Interrupt triggers between the MOV A,#nnn and the CALL instruction then the TX_BYTE routine will not get the intended output value due to this interrupt code:
ORG 0003H ;STANDARD EXTERNAL INTERRUPT INT0 ENTRY POINT
EXTINT0:
	MOV A,P0
	SETB P3.7 ;HIGH TO LOW TRANSITION TO CLR INTERRUPT LINE AND ENABLE OUTPUT LATCHES
	CLR P3.7 ;NOTE: P3.7 = RD PIN ON 8051
	MOV R5,#0FFH			      
RETI

To prevent this you need to place the PUSH ACC and POP ACC instructions in the interrupt service routine.

By the way your placing the branch and return type instructions out by the left margin is not a good way to format assembly language code. It may work for you but it is so non-standard that others that look at the code to try to help will likely just walk away.

Michael Karas




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