jerryd
Member level 2
edaboard,
pic18f2550 MPLAB X IDE XC8
This interrupt code works when PORTB.0 is pulled low with a switch, but if I uncomment either of the lines:
;btfsc RBIE ;is RBIE enabled?
;btfss RBIF ;it is, so check the flag
it complies and loads but the interrupt INTOIE no longer works. I'm not trying to get an IOC interrupt yet.
Checking with a scope PORTB.0,4,5,6,7 are high with the internal pull ups. I have this hardware and all the interrupts working with a C program.
Any suggestions?
jerrd
[ code tags added by moderator]
pic18f2550 MPLAB X IDE XC8
This interrupt code works when PORTB.0 is pulled low with a switch, but if I uncomment either of the lines:
;btfsc RBIE ;is RBIE enabled?
;btfss RBIF ;it is, so check the flag
it complies and loads but the interrupt INTOIE no longer works. I'm not trying to get an IOC interrupt yet.
Checking with a scope PORTB.0,4,5,6,7 are high with the internal pull ups. I have this hardware and all the interrupts working with a C program.
Code:
PSECT textISR,class=CODE,reloc=4
;interrupt function
isr:
;check for PORTB.0 external interrupt
btfsc INT0IE ;is INTO enabled?
btfss INT0IF ;it is, so check the flag
goto notINT0 ;not an external interrupt
bcf INT0IF ;it is, so clear the INT0IF flag
incf _button4,1,0 ;button 4 was pressed
retfie ;now get out
notINT0:
;check for RBIE interrupt on change
;btfsc RBIE ;is RBIE enabled?
;btfss RBIF ;it is, so check the flag
retfie ;not an IOC interrupt
bcf RBIF ;clear the RBIF flag
movlw 1
movwf _button, 0 ;a button on PORTB 4,5,6, or 7 was pressed
retfie ;return from interrupt
Any suggestions?
jerrd
[ code tags added by moderator]
Last edited by a moderator: