Yasser,
You're a bad student !!!
What did I tell you about " mismatch condition " ???
Code:
STATE var Byte
I var Byte
PORTA = 0
PORTB = 0
'************************************************* ****************
'* Interrupt Initialzing *
'************************************************* ****************
INTCON = %10001000 ' GIE and RBIE are set
OPTION_REG = %10000000
'************************************************* ****************
'* Initialzation *
'************************************************* ****************
PORTB = 0
TRISB = %00010000
ON INTERRUPT GOTO DIRECTION
'************************************************* ****************
'* Main Program *
'************************************************* ****************
MAIN:
lcdout $fe,1,"Main Routine"
FOR I = 1 to 50 : PAUSE 10 : NEXT I ' For quick response
GOTO MAIN
END
'************************************************* ****************
'* Interrupt Service Routine *
'************************************************* ****************
DISABLE
DIRECTION:
STATE = PORTB ' End of Mismatch Condition
lcdout $fe,1
lcdout "Interrupt !!!"
IF State.4 THEN
LCDOUT $FE,$C0," LOW to HIGH "
ELSE
LCDOUT $FE,$C0, " HIGH to LOW "
ENDIF
PAUSE 1000
INTCON.0 = 0
RESUME
ENABLE
END
That works fine ... for a 16F84 !
Alain
Bookmarks