I am having trouble keeping an i2c ISR in a separate file in assembly and getting good isr response time. The goal is to keep this file separate from the main file. Anyone know a better way to do this? I am using IAR.
This is what I have tried and did not work out for i2c...
<in main.s43 file>
EXTERN rxifg_isr
EXTERN txifg_isr
COMMON INTVEC
org 0x005a ;ucb1 interrupt vector
dw ucb1_isr ;ucb1 interrupt service routine
org 0x005c ;some other vector
dw other_isr
RSEG MCODE
ucb1_isr: add.w &ucb1iv,pc ; Add offset to PC
reti ; Vector 0: No interrupt
reti ; Vector 2: ALIFG
reti ; Vector 4: NACKIFG
reti ; Vector 6: STTIFG
reti ; Vector 8: STPIFG
bra #rxifg_isr ; Vector 10: RXIFG
bra #txifg_isr ; Vector 12: TXIFG
<in i2c.s43 file>
RSEG MCODE
PUBLIC rxifg_isr
rxifg_isr: stuff bytes into buffer
reti
PUBLIC txifg_isr
txifg_isr: transmit bytes
reti
-----------------------------------------------------------------------------------------------
I have also tried below but didn't work...
<in main.s43 file>
COMMON INTVEC
;org 0x005a ;ucb1 interrupt vector *COMMENTED to use isr in another file
;dw ucb1_isr ;ucb1 interrupt service routine *COMMENTED to use isr in another file
org 0x005c ;some other vector
dw other_isr
<in i2c.s43 file>
COMMON INTVEC
org 0x005a ;ucb1 interrupt vector
dw ucb1_isr ;ucb1 interrupt service routine
RSEG MCODE
ucb1_isr: add.w &ucb1iv,pc ; Add offset to PC
reti ; Vector 0: No interrupt
reti ; Vector 2: ALIFG
reti ; Vector 4: NACKIFG
reti ; Vector 6: STTIFG
reti ; Vector 8: STPIFG
jmp #rxifg_isr ; Vector 10: RXIFG
jmp #txifg_isr ; Vector 12: TXIFG
rxifg_isr: stuff bytes into buffer
reti
txifg_isr: transmit bytes
reti