What about GIE? Shouldn't you be setting that as well? -Neil. -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Tim Daneliuk Sent: Tuesday, June 04, 2002 4:27 PM To: PICLIST@MITVMA.MIT.EDU Subject: [PIC]: RB0/INT Madness Importance: High I've got a 16F84A PIC circuit with nothing connected to PORTB at the moment. I want to use RB0 as an interrupt as described in the docs but cannot seem to get the thing to work. Here is how I am initializing the hardware: ------------------------------------------------------------------------ init: clrf INTCON ; all interrupts off, flags cleared ; setup control registers bsf INTCON,T0IE ; unmask TMR0 interrupts bsf INTCON,INTE ; unmask RB0 interrups bsf STATUS,RP0 ; select register bank 1 clrf TRISA ; set PORTA to all outputs movlw 0ffh movwf TRISB ; set PORTB to all inputs bsf OPTION_REG,NOT_RBPU ; no pullups bsf OPTION_REG,INTEDG ; RB0 interrupt on rising edge bcf OPTION_REG,T0CS ; TMR0 clocked on internal clock movlw tmr0_pre ; set TMR0 prescaler value iorwf OPTION_REG,F bcf STATUS,RP0 ; select register bank 0 Blah, blah, blah, ... -------------------------------------------------------------------------- Here is the relevant portion of the interrupt handler: --------------------------------------------------------------------------- org 04H movwf _w ; save context movfw STATUS bcf STATUS,RP1 bcf STATUS,RP0 movwf _status movfw FSR movwf _fsr movfw PCLATH movwf _pclath clrf PCLATH ; Figure out who interrupted and service it btfsc INTCON,T0IF ; did we get a TMR0 interrupt? goto svc_tmr0 ; yup btfsc INTCON,INTF ; did we get an RB0 interrupt? goto svc_rb0int ; yup goto restore_context ; nope ; RB0 ISR svc_rb0int: bcf INTCON,INTF ; clear the interrupt condition ******** WE NEVER SEEM TO GET HERE FOR SOME REASON ************** goto restore_context ; ISR done, return to main ; end of RB0 ISR ; TMR0 ISR svc_tmr0: bcf INTCON,T0IF ; clear the interrupt condition Blah, blah, blah ... ---------------------------------------------------------------------------- - I am trying to manually force the interrupt to check the interrupt handler by using a wire to connect RB0 to +5V (I realize this will bounce and do all kinds of noisy things), but, for some reason, the interrupt never seems to occur. That is, I never seem to get to the code contained in sv_rb0int: Any ideas out there? -- ---------------------------------------------------------------------------- -- Tim Daneliuk tundra@tundraware.com -- 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