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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/18/03 20:14
Read: times


 
#45894 - Interrupt
Hi all,
My program is use a interrupt do detect the keys.
After detected the enter or exit flags, it returned to an unexperted address which is over my program.
(For other keys, all things is normal)
Please kindly suggest how to correct.
Thank you for your kind attention.....

;Define Bit variables
FLAGS DATA 20h
Enter_flag BIT FLAGS.0 ;Flags indicate enter button
Exit_flag BIT FLAGS.1 ;Flags indicate exit button

ORG 0000h
AJMP Main
ORG 0013h
LJMP INT1_ISR
ORG 0030h
Main:
SETB TCON.2 ;edge-trigger interrupt
MOV IE,#10000100b ;Enable INT
MOV P1,#00001111b ;Conf.input port
CLR ENTER_FLAG
CLR EXIT_FLAG

Enter_Loop: ;Loop for the flags
JBC Exit_flag,EXIT ;Check exit_flags
JBC Enter_flag,Continue ;Check enter_flags
SJMP Enter_Loop
Continue:
;do something else
RET
Exit:
;do something else
RET

INT1_ISR:
PUSH ACC ;store the content
MOV A,P1 ;read data from 74c922
ANL A,#00001111b ;masking P1.0 to P1.3
MOV DPTR,#L_table ;Load look-up table
MOVC A,@A+DPTR ;get value from table
CJNE A,#0Bh,enter ;check for exit key
SETB Exit_flag
SJMP Re_I
enter: CJNE A,#0Ah,table ;check for enter key
SETB Enter_flag
SJMP Re_I
table:
ACALL Store ;store input number
POP ACC
Re_I: RETI <-----after set bit enter or exit flags it can't return to Enter_Loop!

ORG 0400h ;must be away and not
;overlap main program code
L_table:
DB 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0
END

List of 6 messages in thread
TopicAuthorDate
Interrupt            01/01/70 00:00      
   RE: Interrupt            01/01/70 00:00      
   RE: Interrupt            01/01/70 00:00      
   RE: Interrupt            01/01/70 00:00      
   RE: Interrupt            01/01/70 00:00      
   RE: Interrupt            01/01/70 00:00      

Back to Subject List