;********************************************************************* list ; ; FILE: int.inc ; nolist ; ; AUTHOR: kdk ; ; DESCRIPTION: Interrupt Include File ; ; LOG: 07/09/98 Initial Version ; ; ; ;********************************************************************* ifdef MACRO_DEFINITION ; ;--------------------------------------------------------------------- mTypeDeclare fSTATUSTempInt,BYTE,1 ; mTypeDeclare fWTempInt,BYTE,1 ; mTypeDeclare fFSRTemp,BYTE,1 ; mTypeDeclare fWTempTempInt,BYTE,1 ; ;--------------------------------------------------------------------- mIntClear macro f,b if ((f == INTCON) && (b <= 2) && (b >= 0)) ; bc_f f,b ; endif ; if ((f == PIR1) && (b <= 7) && (b >= 0)) ; bc_f f,b ; endif ; if ((f == PIR2) && (b == 0)) ; bc_f f,b ; endif ; endm ; ;--------------------------------------------------------------------- mIntDisable macro f,b local Loop ; if ((f == INTCON) && (b == GIE)) ; Loop bc_f INTCON,GIE ; btsc_f INTCON,GIE ; goto Loop ; endif ; if ((f == INTCON) && (b <= 6) && (b >= 3)) ; bc_f f,b ; endif ; if ((f == PIE1) && (b <= 7) && (b >= 0)) ; bc_f f,b ; endif ; if ((f == PIE2) && (b == 0)) ; bc_f f,b ; endif ; endm ; ;--------------------------------------------------------------------- mIntRisingEdge macro Boolean if (Boolean) ; bc_f OPTION_REG,6 ; else ; bs_f OPTION_REG,6 ; endif ; endm ; ;--------------------------------------------------------------------- mIntEnable macro f,b if ((f == INTCON) && (b <= 7) && (b >= 3)) ; if ((b <= 5) && (b >= 3)) ; bc_f f,(b - 3) ; endif ; bs_f f,b ; endif ; ifdef PIC16C73 ; if ((f == PIE1) && (b <= 6) && (b >= 0)) ; bc_f (f - H'80'),b ; bs_f f,b ; endif ; endif ; PIC16C73 ifdef PIC16C73A ; if ((f == PIE1) && (b <= 6) && (b >= 0)) ; bc_f (f - H'80'),b ; bs_f f,b ; endif ; endif ; PIC16C73A ifdef PIC16C74 ; if ((f == PIE1) && (b <= 7) && (b >= 0)) ; bc_f (f - H'80'),b ; bs_f f,b ; endif ; endif ; PIC16C74 ifdef PIC16C74A ; if ((f == PIE1) && (b <= 7) && (b >= 0)) ; bc_f (f - H'80'),b ; bs_f f,b ; endif ; endif ; PIC16C74A if ((f == PIE2) && (b == 0)) ; bc_f (f - H'80'),b ; bs_f f,b ; endif ; endm ; ;--------------------------------------------------------------------- mIntRestore macro bcf STATUS,RP0 ; bank 0 movfw fWTempTempInt ; restore mnemonic W temp movwf fWTemp ; " movfw fFSRTemp ; restore FSR movwf FSR ; " swapf fSTATUSTempInt,0 ; movwf STATUS ; restore STATUS swapf fWTempInt,1 ; swapf fWTempInt,0 ; restore W endm ; ;--------------------------------------------------------------------- mIntSave macro movwf fWTempInt ; save W swapf STATUS,0 ; bcf STATUS,RP0 ; bank 0 movwf fSTATUSTempInt ; save STATUS movfw FSR ; save FSR movwf fFSRTemp ; " movfw fWTemp ; save mnemonic W temp movwf fWTempTempInt ; " endm ; ;--------------------------------------------------------------------- mIntSetup macro endm ; ;--------------------------------------------------------------------- endif ; MACRO_DEFINITION ;*********************************************************************