Hi. The "Global Interrupt Enable flag" (GIE) is handled automaticly (cleared when the interrupt code is called and set by the RETFIE instruction). You should only clear this bit if you want to globaly disable interrupts *outside* of your ISR. On the other side, you have to clear the specific "XX Interrupt Flag" (RBIF in your case) that caused the interrupt to happen. If not, your ISR will be called recursively as soon as he RETFIE instruction is executed. Now, regarding your code... What *did* you expect ? How *did* it work ? One thing, this code : BTFSC PORTB, 7 GOTO BIT_7 will goto "BIT_7" if "PORTB, 7" is set ("1"), no matter if it has changed since last time. Is that what you want ? If you realy want to check for changes, you have to save the last state of each bit and compare with that. And, if two bits changes at the same time, you will probably miss one of them. Jan-Erik. -----Original Message----- From: WH Tan [mailto:tanwh@NOTES.SRC.GLOBAL.SHARP.CO.JP] Sent: den 17 oktober 2003 06:28 To: PICLIST@MITVMA.MIT.EDU Subject: [PIC]: RB change ISR I am confuse with the following code, because it didn't work as expected. Perhaps I am missing something. Can somebody on the list please correct my mistake. Thanks in advance. WH Tan PAGE0_START ORG 0x0000 ; RESET vector location GOTO START ORG 0x0004 MOVWF W_TEMP SWAPF STATUS, W MOVWF STATUS_TEMP BCF INTCON, GIE ;Is this code is a must, or ;PIC will do it for me? BTFSC INTCON, RBIF ; Check is RB change ISR? GOTO ISR_RBIF ; Yes GOTO END_ISR ; No ISR_RBIF BTFSC PORTB, 7 GOTO BIT_7 BTFSC PORTB, 6 GOTO BIT_6 BTFSC PORTB, 5 GOTO BIT_5 BTFSC PORTB, 4 GOTO BIT_4 GOTO END_ISR END_ISR SWAPF STATUS_TEMP, W MOVWF STATUS SWAPF W_TEMP, F SWAPF W_TEMP, W BCF INTCON, RBIF BSF INTCON, GIE ; Again, is this code necessary? RETFIE BIT_7 ; Send send some character to LCD ; to indicate a change on RB7 .... GOTO END_ISR BIT_6 ~ BIT_4 ; Do exactly same as BIT_7 -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body