There's a version of DT_INTS floating around that has support for the K40. Look around for V3.4c.
If you want to use your file and you've changed all the xxx_INT sources, there are two addtl changes to make:
- need to add banksel handling to the INT_Handler macro
Code:
INT_Handler macro IntFlagReg, IntFlagBit, Label, Type, Reset
list
local AfterSave, AfterUser, NoInt
INT_Count += 1
PrList#v(INT_Count)R = IntFlagReg
PrList#v(INT_Count)B = IntFlagBit
PrList#v(INT_Count)Priority = Priority
GetIntInfo IntFlagReg, IntFlagBit
if (Found == YES)
CHK?RP INT_Enable_Reg ;<<<<<<<<ADD THIS
btfss INT_Enable_Reg, INT_Enable_Bit ; if INT is enabled
goto NoInt
CHK?RP INT_Flag_Reg ;<<<<<<<<ADD THIS
btfss INT_Flag_Reg, INT_Flag_Bit ; and the Flag set?
goto NoInt
- the interrupt priority bit has moved in the K40... it's no longer in RCON.
Code:
INT_EXIT_L
PREV_BANK = 0
RestFSR 0, L ; Restore saved vars
RestFSR 1, L
RestFSR 2, L
movff psaveUL, PCLATU
movff psaveL, PCLATH
movff bsave, BSR ; BSR
movff wsave, WREG ; WREG
movff ssave, STATUS ; STATUS
retfie ; Return from Interrupt
OverCREATE
bsf INTCON,IPEN, 0 ; Enable Interrupt Priorities <<<<<<<<CHANGE THIS
bsf INTCON,GIEL, 0 ; Enable Low Priority Interrupts
Bookmarks