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
feature.
Do I just click on [code] and then paste the code as a post?
jerryd
It's rather self-explanatory. There is no dedicated help, because one usually does not need it.Do I just click onCode:and then paste the code as a post?
Hmm .... but you see the icons at the top of the editor window?I didn't know about the
BTFSS INTCON, INT0IE
....
Not really surprising if 'button' is itself a variable as the instruction expects an address. I'm not able to access the help or user guide at the moment but there is information in them about how to access variables between asm and .c code.I tried adding the line "bsf button,0" but it doesn't get set. These variables are defined in the .c module as "volatile unsigned int" and in the asm.s as "GLOBAL".
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?