Do you have a keypad or buttons between Rd4:7 and Rb4:7 ? You must enable pull-up resistor on Rb or to put aditional external resistence to Vcc. The folowing routine was written for jal but is almost in asm. It reads the Rb7 -variable usa and Rb6 -variable apa and detect low to high transition on this pins. Check also the AN566 procedure interrupt_on_change is pragma interrupt assembler local loop, usa_p, apa_p, out n movwf w_temp -- save swapf status, w movwf status_temp loop: bcf intcon_gie -- disable all interrupts btfsc intcon_gie -- be sure goto loop btfss intcon_rbif -- test if interrupt goto out -- if not go out from isr btfsc usa -- if yes test which pin goto usa_p btfsc apa goto apa_p goto out apa_p: bcf intcon_rbie -- disable irq on change bsf apa_flag goto out usa_p: bcf intcon_rbie bsf usa_flag out: bcf intcon_rbif -- else prepare for next interrupt swapf status_temp, w -- restore movwf status swapf w_temp, f swapf w_temp, w retfie end assembler end procedure On Fri, 12 Jan 2001, Andrew Quinn wrote: > Port B Interrupt on change has really got me stumped. I have looked > everywhere and can't find anything that explains why I can't get the > following test code to work. I can only assume that the interrupt doesn't > happen because RD3 is never set when I toggle any of the RD4:7 lines. > > If anyone can shed any light on this it would be most appreciated? > > Regards.... Andrew > > list p=16f877 > > ; Include file, change directory if needed > > include "p16f877.inc" > > ORG 0x0000 > > NOP > > CLRF STATUS > > CLRF PCLATH > > GOTO START > > ORG 0x0004 > > BSF PORTD,3 > > BTFSC PORTB,7 > > GOTO $-1 > > MOVF PORTB,W > > BCF INTCON,RBIF > > RETFIE > > START BSF STATUS,RP0 > > BSF OPTION_REG,7 > > MOVLW B'11110000' > > MOVWF TRISB > > MOVLW B'00000000' > > MOVWF TRISD > > MOVWF TRISE > > BCF STATUS,RP0 > > CLRF PORTB > > CLRF PORTD > > BSF PORTD,2 > > CLRF INTCON > > BSF INTCON,GIE > > BSF INTCON,INTE > > BSF INTCON,RBIE > > HERE GOTO HERE > > END > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads