Hello everyone,
In the code below, Im trying to use the interrupt that is generated when there is a change in the PORTB pins <4,5,6,7>. The datasheet says that I need to enable the interrupt in the 3rd pin(RBIE) of INTCON. And the interrupt flag is the 0th pin(RBIF) of INTCON. I've configured MPLAB to provide stimulus to the 5th pin of PORTB at the 20th instruction cycle.
When I run the program, MPLAB provides the stimulus at the 20th instruction cycle and the RBIF flag gets set since there is a change in the 5th pin, but it is not generating an interrupt. That is, the program execution continues with the next statement without jumping to "Program Counter Address" 0x04(Default location for ISR).
Am I making a mistake somewhere?
Thank you.
In the code below, Im trying to use the interrupt that is generated when there is a change in the PORTB pins <4,5,6,7>. The datasheet says that I need to enable the interrupt in the 3rd pin(RBIE) of INTCON. And the interrupt flag is the 0th pin(RBIF) of INTCON. I've configured MPLAB to provide stimulus to the 5th pin of PORTB at the 20th instruction cycle.
When I run the program, MPLAB provides the stimulus at the 20th instruction cycle and the RBIF flag gets set since there is a change in the 5th pin, but it is not generating an interrupt. That is, the program execution continues with the next statement without jumping to "Program Counter Address" 0x04(Default location for ISR).
Am I making a mistake somewhere?
Thank you.
Code:
processor 16f877a
include <p16f877a.inc>
__config _HS_OSC & _WDT_OFF & _PWRTE_ON
ORG 000H
GOTO MAIN
ORG 004H
GOTO ISR
ORG 200H
NITZ NOP
BANKSEL TRISB
MOVLW 0XFF
MOVWF TRISB
BSF INTCON,3
RETURN
WAIT GOTO $
RETURN
MAIN CALL NITZ
CALL WAIT
ISR NOP
END