Announcement

Collapse
No announcement yet.

18FxxQ43 support

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #91
    yes thanks tubbleweed , that now allows for a compile ,

    the include is too big to show all here so

    Code:
    '****************************************************************
    '* Name : DT_INTS-18.bas *
    '* Author : Darrel Taylor *
    '* Notice : Copyright (c) 2003 *
    '* Version : 3.3 MAR 24, 2008 *
    '* Date : JUL 11, 2006 *
    '****************************************************************
    '* Versions: *
    '* 3.42 : May 3 ,2022 *
    '* - testing modifed low priorty interupts section *
    '* - remove saved/ restored Varables ,add RETFIE fast *
    '* to restore all registers from HW shadow stack *
    '* = change bsf RCON,IPEN, 0 cos compile error *
    '* to bsf INTCON0, IPEN_INTCON0, 0 *
    '* *
    '* 3.41 : January 31, 2022 *
    '* Fixed BANK5 as ACCESS BANK, Changed movffl Back to *
    '* movff, PREV_BANK = 5 *
    '* 3.4 : January 16, 2022 *
    '* Special Version for PIC18FxxQ43 *
    '* 3.3 : MAR 24, 2008 *
    '* Corrects an initialization problem affecting the *
    '* first pass if CLEAR is not used *
    '* 3.2 : Aug 26, 2007 *
    '* Update for PBP 2.50 using LONG's with PBPL *
    '* Added many new INT sources *
    '* 3.1 : JUL 18, 2006 *
    '* Modified to handle smaller BANKA in the newer chips*
    '****************************************************************
    Code:
    ;---[Create the Low Priority Interrupt Processor]-----------------------------
    ASM
    INT_CREATE_L macro
    local OverCREATE
    goto OverCREATE
    ifdef USE_LOWPRIORITY
    if (USE_LOWPRIORITY != 1)
    error "'DEFINE USE_LOWPRIORITY 1' required for Low Priority Interrupts"
    endif
    else
    error "'DEFINE USE_LOWPRIORITY 1' required for Low Priority Interrupts"
    endif
    Priority = L
    INT_ENTRY_L
    ; movff WREG, wsave ; Wreg
    ; movff STATUS, ssave ; STATUS
    ; movff BSR, bsave ; BSR
    ; movff PCLATU, psaveUL
    ; movff PCLATH, psaveL
    ; SaveFSR 0, L ; FSR0
    ; SaveFSR 1, L ; FSR1
    ; SaveFSR 2, L ; FSR2
    bcf _InHPint, 0
    List_Start_L
    clrf BSR
    PREV_BANK = 5
    RETFIE 1
    bcf _Serviced_L, 0
    ifdef INT_LIST_L
    INT_LIST_L ; Expand the users list of HP INT handlers
    else
    error "INT_CREATE_L - INT_LIST_L not defined, can not create"
    endif
    btfsc _Serviced_L, 0 ; if anything was serviced
    goto List_Start_L ; go around, and check again
    
    ifdef ReEnterLPused ; was ReEnterPBP-18LP.bas included
    GetAddress21 INT_EXIT_L, RetAddrL
    L?GOTO _RestorePBP_L ; Restore PBP system Vars
    endif
    
    INT_EXIT_L
    PREV_BANK = 5
    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 FAST ; Return from Interrupt
    OverCREATE
    bsf INTCON0, IPEN_INTCON0, 0 ; Enable Interrupt Priorities
    ; bsf RCON,IPEN, 0 ; Enable Interrupt Priorities
    bsf INTCON0,GIEL, 0 ; Enable Low Priority Interrupts
    endm
    ENDASM

    Comment


    • #92
      mike can you review / change and do a formal release for version change 3.42

      Comment


      • #93
        Since you're remove the low context save you can remove the low context restore...
        Code:
        INT_EXIT_L
        PREV_BANK = 5
        ;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 FAST ; Return from Interrupt
        If you do the same with the high context save/restore, then you could remove the variables since they're no longer required

        Code:
        ;wsave var byte BANKA SYSTEM ' location for WREG
        ;ssave var byte BANK5 SYSTEM ' location for STATUS register
        ;bsave var byte BANK5 SYSTEM ' location for BSR register
        ;psaveUH VAR BYTE BANK5 SYSTEM ' PCLATU Hi Pri.
        ;psaveUL VAR BYTE BANK5 SYSTEM ' Lo Pri.
        ;psaveH VAR BYTE BANK5 SYSTEM ' PCLATH Hi Pri.
        ;psaveL VAR BYTE BANK5 SYSTEM ' Lo Pri.
        ;fsave0H var WORD BANK5 SYSTEM ' locations for FSR registers
        ;fsave1H var WORD BANK5 SYSTEM
        ;fsave2H var WORD BANK5 SYSTEM
        ;fsave0L var WORD BANK5 SYSTEM ' low priority FSR locations
        ;fsave1L var WORD BANK5 SYSTEM
        ;fsave2L var WORD BANK5 SYSTEM

        Comment


        • #94
          cant remove those variables as errors result
          more code uses those varables such as this


          Code:
          ;---[Create the High Priority Interrupt Processor]----------------------------
          ASM
          INT_CREATE_H macro
          local OverCREATE
          goto OverCREATE
          Priority = H
          INT_ENTRY_H
          movff PCLATU, psaveUH
          movff PCLATH, psaveH
          SaveFSR 0, H
          SaveFSR 1, H
          SaveFSR 2, H
          bsf _InHPint, 0
          List_Start_H
          bcf _Serviced_H, 0 ; Clear Serviced flag
          clrf BSR
          PREV_BANK = 5
          ifdef INT_LIST_H
          INT_LIST_H ; Expand the users list of HP INT handlers
          else
          ifdef INT_LIST
          INT_LIST ; Expand the 16F Compatible List
          else
          error "INT_CREATE_H - INT_LIST or INT_LIST_H not found"
          endif
          endif
          btfsc _Serviced_H,0 ; if anything was serviced
          goto List_Start_H ; go around, and check again
          
          ifdef ReEnterHPused ; was ReEnterPBP-18.bas included
          GetAddress21 INT_EXIT_H, RetAddrH
          L?GOTO _RestorePBP_H ; Restore PBP system Vars
          endif
          Last edited by longpole001; 05-03-2022, 06:53 AM.

          Comment


          • #95
            As I said, you have to comment out ALL references, in both high and low entry and exit points.
            Code:
            INT_ENTRY_H
            ;movff PCLATU, psaveUH
            ;movff PCLATH, psaveH
            ;SaveFSR 0, H
            ;SaveFSR 1, H
            ;SaveFSR 2, H
            None of this code does anything but waste time and space since RETFIE 1 (FAST) negates all of it.

            Comment


            • #96
              ok compiles with the bits removed

              cant post the result here cos of site limits 10000chrs or 19k attachments

              Comment


              • #97
                Code:
                ****************************************************************
                '* Name : DT_INTS-18.bas *
                '* Author : Darrel Taylor *
                '* Notice : Copyright (c) 2003 *
                '* Version : 3.3 MAR 24, 2008 *
                '* Date : JUL 11, 2006 *
                '****************************************************************
                '* Versions: *
                '* 3.42 : May 3 ,2022 *
                '* - testing modifed low priorty interupts section *
                '* - remove saved/ restored Varables ,add RETFIE fast *
                '* to restore all registers from HW shadow stack *
                '* - change bsf RCON,IPEN, 0 cos compile error *
                '* to bsf INTCON0, IPEN_INTCON0, 0 *
                '* *
                '* 3.41 : January 31, 2022 *
                '* Fixed BANK5 as ACCESS BANK, Changed movffl Back to *
                '* movff, PREV_BANK = 5 *
                '* 3.4 : January 16, 2022 *
                '* Special Version for PIC18FxxQ43 *
                '* 3.3 : MAR 24, 2008 *
                '* Corrects an initialization problem affecting the *
                '* first pass if CLEAR is not used *
                '* 3.2 : Aug 26, 2007 *
                '* Update for PBP 2.50 using LONG's with PBPL *
                '* Added many new INT sources *
                '* 3.1 : JUL 18, 2006 *
                '* Modified to handle smaller BANKA in the newer chips*
                '****************************************************************
                DISABLE DEBUG
                
                DEFINE INTHAND INT_ENTRY_H ' Context saving for High Priority Ints
                DEFINE INTLHAND INT_ENTRY_L ' Context saving for Low Priority Ints
                
                ; ===note required for q43 chips =====
                ;wsave var byte BANKA SYSTEM ' location for WREG
                ;ssave var byte BANK5 SYSTEM ' location for STATUS register
                ;bsave var byte BANK5 SYSTEM ' location for BSR register
                ;psaveUH VAR BYTE BANK5 SYSTEM ' PCLATU Hi Pri.
                ;psaveUL VAR BYTE BANK5 SYSTEM ' Lo Pri.
                ;psaveH VAR BYTE BANK5 SYSTEM ' PCLATH Hi Pri.
                ;psaveL VAR BYTE BANK5 SYSTEM ' Lo Pri.
                ;fsave0H var WORD BANK5 SYSTEM ' locations for FSR registers
                ;fsave1H var WORD BANK5 SYSTEM
                ;fsave2H var WORD BANK5 SYSTEM
                ;fsave0L var WORD BANK5 SYSTEM ' low priority FSR locations
                ;fsave1L var WORD BANK5 SYSTEM
                ;fsave2L var WORD BANK5 SYSTEM
                ;=====================================
                RetAddrH VAR BYTE[3] BANKA SYSTEM ' 21-bit return address Hi Pri.
                RetAddrL VAR BYTE[3] BANKA SYSTEM ' Lo Pri.
                INT_Flags VAR BYTE BANKA SYSTEM
                Serviced_H VAR INT_Flags.0
                Serviced_L VAR INT_Flags.1
                InHPint VAR INT_Flags.2
                NoPriority VAR INT_Flags.3
                
                INT_Flags = 0
                
                goto OVER_DT_INTS_18
                
                ASM
                ;____ Check for PBPL (PBP ver. 2.50 and above only)__________________________
                PBPLongs_Used = 0
                if (R1 - R0 == 4)
                PBPLongs_Used = 1
                ; messg PBPL Used = 1
                endif
                
                nolist
                ;____ DEFINE available interrupt sources_____________________________________
                ; -=- PIR0 Interrupts: -=-
                #define IOC_INT PIR0,7 ;-- IOC INT Port Change
                #define CLC1_INT PIR0,5 ;-- Configurable Logic Cell 1
                #define CSW_INT PIR0,3 ;-- Clock Switch Interrupt
                #define OSF_INT PIR0,2 ;-- Oscillator Fail
                #define HLVD_INT PIR0,1 ;-- High/Low Voltage Detect
                #define SW_INT PIR0,0 ;-- Software Interrupt
                ; -=- PIR1 Interrupts: -=-
                #define SMT1PWA_INT PIR1,7 ;-- SMT1 Pulse-Width Acquisition
                #define SMT1PRA_INT PIR1,6 ;-- SMT1 Period Acquisition
                #define SMT1_INT PIR1,5 ;-- Signal Measurement Timer 1 Interrupt
                #define CM1_INT PIR1,4 ;-- Comparator1
                #define ACT_INT PIR1,3 ;-- Active Clock Tuning Interrupt
                #define AD_INT PIR1,2 ;-- A/D Converter
                #define ZCD_INT PIR1,1 ;-- Zero Cross Detect
                #define INT0_INT PIR1,0 ;-- INT0 External
                ; -=- PIR2 Interrupts: -=-
                #define DMA1A_INT PIR2,7 ;-- DMA1 Abort
                #define DMA1OR_INT PIR2,6 ;-- DMA1 Overrun
                #define DMA1DCNT_INT PIR2,5 ;-- DMA1 Destination Count
                #define DMA1SCNT_INT PIR2,4 ;-- DMA1 Source Count
                #define ADT_INT PIR2,0 ;-- ADC Threshold
                ; -=- PIR3 Interrupts: -=-
                #define TMR0_INT PIR3,7 ;-- TMR0 Overflow
                #define CCP1_INT PIR3,6 ;-- CCP1
                #define TMR1G_INT PIR3,5 ;-- TMR1 Gate
                #define TMR1_INT PIR3,4 ;-- TMR1 Overflow
                #define TMR2_INT PIR3,3 ;-- TMR2 to T2PR Match
                #define SPI1_INT PIR3,2 ;-- Serial Peripherial Interface 1
                #define SPI1TX_INT PIR3,1 ;-- Serial Peripherial Interface 1 TX
                #define SPI1RX_INT PIR3,0 ;-- Serial Peripherial Interface 1 RX
                ; -=- PIR4 Interrupts: -=-
                #define PWM1_INT PIR4,7 ;-- PWM1 Parameter Interrupt
                #define PWM1P_INT PIR4,6 ;-- PWM1 Period Interrupt
                #define U1_INT PIR4,3 ;-- USART1
                #define U1E_INT PIR4,2 ;-- USART1 Framing Error
                #define U1TX_INT PIR4,1 ;-- USART1 Transmit
                #define U1RX_INT PIR4,0 ;-- USART1 Receive
                ; -=- PIR5 Interrupts: -=-
                #define PWM2_INT PIR5,7 ;-- PWM2 Parameter Interrupt
                #define PWM2P_INT PIR5,6 ;-- PWM2 Period Interrupt
                #define TMR3G_INT PIR5,5 ;-- TMR3 Gate
                #define TMR3_INT PIR5,4 ;-- TMR3 Overflow
                #define SPI2_INT PIR5,2 ;-- Serial Peripherial Interface 2
                #define SPI2TX_INT PIR5,1 ;-- Serial Peripherial Interface 2 TX
                #define SPI2RX_INT PIR5,0 ;-- Serial Peripherial Interface 2 RX
                ; -=- PIR6 Interrupts: -=-
                #define DMA2A_INT PIR6,7 ;-- DMA2 Abort
                #define DMA2OR_INT PIR6,6 ;-- DMA2 Overrun
                #define DMA2DCNT_INT PIR6,5 ;-- DMA2 Destination Count
                #define DMA2SCNT_INT PIR6,4 ;-- DMA2 Source Count
                #define NCO1_INT PIR6,3 ;-- NCO1 Interrupt
                #define CWG1_INT PIR6,2 ;-- Configurable Wave Generator 1
                #define CLC2_INT PIR6,1 ;-- Configurable Logic Cell 2
                #define INT1_INT PIR6,0 ;-- INT1 External
                ; -=- PIR7 Interrupts: -=-
                #define PWM3_INT PIR7,7 ;-- PWM3 Parameter Interrupt
                #define PWM3P_INT PIR7,6 ;-- PWM3 Period Interrupt
                #define CLC3_INT PIR7,5 ;-- Configurable Logic Cell 3
                #define I2C1E_INT PIR7,3 ;-- I2C1 Error
                #define I2C1_INT PIR7,2 ;-- I2C1 Interrupt
                #define I2C1TX_INT PIR7,1 ;-- I2C1 Transmit
                #define I2C1RX_INT PIR7,0 ;-- I2C1 Receive
                ; -=- PIR8 Interrupts: -=-
                #define SCAN_INT PIR8,7 ;-- Memory Scanner Interrupt
                #define CCP2_INT PIR8,6 ;-- CCP2
                #define TMR5G_INT PIR8,5 ;-- TMR5 Gate
                #define TMR5_INT PIR8,4 ;-- TMR5 Overflow
                #define U2_INT PIR8,3 ;-- USART2
                #define U2E_INT PIR8,2 ;-- USART2 Framing Error
                #define U2TX_INT PIR8,1 ;-- USART2 Transmit
                #define U2RX_INT PIR8,0 ;-- USART2 Receive
                ; -=- PIR9 Interrupts: -=-
                #define CLC4_INT PIR9,5 ;-- Configurable Logic Cell 4
                #define U3_INT PIR9,3 ;-- USART3
                #define U3E_INT PIR9,2 ;-- USART3 Framing Error
                #define U3TX_INT PIR9,1 ;-- USART3 Transmit
                #define U3RX_INT PIR9,0 ;-- USART3 Receive
                ; -=- PIR10 Interrupts: -=-
                #define DMA3A_INT PIR10,7 ;-- DMA3 Abort
                #define DMA3OR_INT PIR10,6 ;-- DMA3 Overrun
                #define DMA3DCNT_INT PIR10,5 ;-- DMA3 Destination Count
                #define DMA3SCNT_INT PIR10,4 ;-- DMA3 Source Count
                #define NCO2_INT PIR10,3 ;-- NCO2 Interrupt
                #define CWG2_INT PIR10,2 ;-- Configurable Wave Generator 2
                #define CLC5_INT PIR10,1 ;-- Configurable Logic Cell 5
                #define INT2_INT PIR10,0 ;-- INT2 External
                ; -=- PIR11 Interrupts: -=-
                #define DMA4A_INT PIR11,7 ;-- DMA4 Abort
                #define DMA4OR_INT PIR11,6 ;-- DMA4 Overrun
                #define DMA4DCNT_INT PIR11,5 ;-- DMA4 Destination Count
                #define DMA4SCNT_INT PIR11,4 ;-- DMA4 Source Count
                #define TMR4_INT PIR11,3 ;-- TMR4 TMR4-T4PR Match
                #define CWG3_INT PIR11,2 ;-- Configurable Wave Generator 3
                #define CLC6_INT PIR11,1 ;-- Configurable Logic Cell 6
                #define CCP3_INT PIR11,0 ;-- CCP3
                ; -=- PIR12 Interrupts: -=-
                #define DMA5A_INT PIR12,7 ;-- DMA5 Abort
                #define DMA5OR_INT PIR12,6 ;-- DMA5 Overrun
                #define DMA5DCNT_INT PIR12,5 ;-- DMA5 Destination Count
                #define DMA5SCNT_INT PIR12,4 ;-- DMA5 Source Count
                #define U4_INT PIR12,3 ;-- USART4
                #define U4E_INT PIR12,2 ;-- USART4 Framing Error
                #define U4TX_INT PIR12,1 ;-- USART4 Transmit
                #define U4RX_INT PIR12,0 ;-- USART4 Receive
                ; -=- PIR13 Interrupts: -=-
                #define DMA6A_INT PIR13,7 ;-- DMA6 Abort
                #define DMA6OR_INT PIR13,6 ;-- DMA6 Overrun
                #define DMA6DCNT_INT PIR13,5 ;-- DMA6 Destination Count
                #define DMA6SCNT_INT PIR13,4 ;-- DMA6 Source Count
                #define U5_INT PIR13,3 ;-- USART5
                #define U5E_INT PIR13,2 ;-- USART5 Framing Error
                #define U5TX_INT PIR13,1 ;-- USART5 Transmit
                #define U5RX_INT PIR13,0 ;-- USART5 Receive
                ; -=- PIR14 Interrupts: -=-
                #define NCO3_INT PIR14,3 ;-- NCO3 Interrupt
                #define CM2_INT PIR14,2 ;-- Comparator2
                #define CLC7_INT PIR14,1 ;-- Configurable Logic Cell 7
                ; -=- PIR15 Interrupts: -=-
                #define TMR6_INT PIR15,3 ;-- TMR6 TMR6-T6PR Match
                #define CRC_INT PIR15,2 ;-- Cyclic Redundancy Check
                #define CLC8_INT PIR15,1 ;-- Configurable Logic Cell 8
                #define NVM_INT PIR15,0 ;-- EEPROM/FLASH Write Operation
                ENDASM

                Comment


                • #98
                  Code:
                  asm
                  ; -- macro --
                  INT_Source macro IFR, IFB, IER, IEB, IPR, IPB
                  if (IflagReg == IFR) && (IflagBit == IFB)
                  list
                  INT_Flag_Reg = IFR
                  INT_Flag_Bit = IFB
                  INT_Enable_Reg = IER
                  INT_Enable_Bit = IEB
                  INT_Priority_Reg = IPR
                  INT_Priority_Bit = IPB
                  Found = 1
                  endif
                  nolist
                  endm
                  endasm
                  
                  
                  asm
                  ;____________________________________________________________________________
                  GetIntInfo macro IflagReg, IflagBit
                  nolist
                  INT_Flag_Reg = -1
                  INT_Flag_Bit = -1
                  INT_Enable_Reg = -1
                  INT_Enable_Bit = -1
                  ifdef IPR1
                  INT_Priority_Reg = -1
                  INT_Priority_Bit = -1
                  endif
                  Found = 0
                  
                  ; -=- PIR0 Interrupts: -=-
                  ifdef IOCIF ;----{ IOC External Interrupt }----------[PIR0, IOCIF]---
                  INT_Source PIR0,7, PIE0,7, IPR0,7
                  endif
                  ifdef CLC1IF ;----{ CLC1 Configurable Logic Cell 1 }----------[PIR0, CLC1IF]---
                  INT_Source PIR0,5, PIE0,5, IPR0,5
                  endif
                  ifdef CSWIF ;----{ CSW Clock Switch }----------[PIR0, CSWIF]---
                  INT_Source PIR0,3, PIE0,3, IPR0,3
                  endif
                  ifdef OSFIF ;----{ OSF Oscillator Fail }----------[PIR0, OSFIF]---
                  INT_Source PIR0,2, PIE0,2, IPR0,2
                  endif
                  ifdef HLVDIF ;----{ HLVD High/Low Voltage Detect }----------[PIR0, HLVDIF]---
                  INT_Source PIR0,1, PIE0,1, IPR0,1
                  endif
                  ifdef SWIF ;----{ SW Software Interrupt }----------[PIR0, SWIF]---
                  INT_Source PIR0,0, PIE0,0, IPR0,0
                  endif
                  ; -=- PIR1 Interrupts: -=-
                  ifdef SMT1PWAIF ;----{ SMT1PWA SMT1 Pulse-Width Acquisition }----------[PIR1, SMT1PWAIF]---
                  INT_Source PIR1,7, PIE1,7, IPR1,7
                  endif
                  ifdef SMT1PRAIF ;----{ SMT1PRA SMT1 Period Acquisition }----------[PIR1, SMT1PRAIF]---
                  INT_Source PIR1,6, PIE1,6, IPR1,6
                  endif
                  ifdef SMT1IF ;----{ SMT1 Signal Measurement Timer 1 }----------[PIR1, SMT1IF]---
                  INT_Source PIR1,5, PIE1,5, IPR1,5
                  endif
                  ifdef CM1IF ;----{ CM1 Comparator 1}----------[PIR1, CM1IF]---
                  INT_Source PIR1,4, PIE1,4, IPR1,4
                  endif
                  ifdef ACTIF ;----{ ACT Active Clock Tuning}----------[PIR1, ACTIF]---
                  INT_Source PIR1,3, PIE1,3, IPR1,3
                  endif
                  ifdef ADIF ;----{ AD A/D Converter }----------[PIR1, ADIF]---
                  INT_Source PIR1,2, PIE1,2, IPR1,2
                  endif
                  ifdef ZCDIF ;----{ ZCD Zero Cross Detect }----------[PIR1, ZCDIF]---
                  INT_Source PIR1,1, PIE1,1, IPR1,1
                  endif
                  ifdef INT0IF ;----{ INT0 INT0 External }----------[PIR1, INT0IF]---
                  INT_Source PIR1,0, PIE1,0, IPR1,0
                  endif
                  ; -=- PIR2 Interrupts: -=-
                  ifdef DMA1AIF ;----{ DMA1A DMA1 Abort }----------[PIR2, DMA1AIF]---
                  INT_Source PIR2,7, PIE2,7, IPR2,7
                  endif
                  ifdef DMA1ORIF ;----{ DMA1OR DMA1 Overrun }----------[PIR2, DMA1ORIF]---
                  INT_Source PIR2,6, PIE2,6, IPR2,6
                  endif
                  ifdef DMA1DCNTIF ;----{ DMA1DCNT DMA1 Destination Count }----------[PIR2, DMA1DCNTIF]---
                  INT_Source PIR2,5, PIE2,5, IPR2,5
                  endif
                  ifdef DMA1SCNTIF ;----{ DMA1SCNT DMA1 Source Count }----------[PIR2, DMA1SCNTIF]---
                  INT_Source PIR2,4, PIE2,4, IPR2,4
                  endif
                  ifdef ADTIF ;----{ ADT ADC Threshold }----------[PIR2, ADTIF]---
                  INT_Source PIR2,0, PIE2,0, IPR2, 0
                  endif
                  ; -=- PIR3 Interrupts: -=-
                  ifdef TMR0IF ;----{ TMR0 TMR0 Overflow }----------[PIR3, TMR0IF]---
                  INT_Source PIR3,7, PIE3,7, IPR3,7
                  endif
                  ifdef CCP1IF ;----{ CCP1 CCP1 }----------[PIR3, CCP1IF]---
                  INT_Source PIR3,6, PIE3,6, IPR3,6
                  endif
                  ifdef TMR1GIF ;----{ TMR1G TMR1 Gate }----------[PIR3, TMR1GIF]---
                  INT_Source PIR3,5, PIE3,5, IPR3,5
                  endif
                  ifdef TMR1IF ;----{ TMR1 TMR1 Overflow }----------[PIR3, TMR1IF]---
                  INT_Source PIR3,4, PIE3,4, IPR3,4
                  endif
                  ifdef TMR2IF ;----{ TMR2 TMR2 to T2PR Match }----------[PIR3, TMR2IF]---
                  INT_Source PIR3,3, PIE3,3, IPR3,3
                  endif
                  ifdef SPI1IF ;----{ SPI1 Serial Peripherial Interface 1 }----------[PIR3, SPI1IF]---
                  INT_Source PIR3,2, PIE3,2, IPR3,2
                  endif
                  ifdef SPI1TXIF ;----{ SPI1TX Serial Peripherial Interface 1 TX }----------[PIR3, SPI1TXIF]---
                  INT_Source PIR3,1, PIE3,1, IPR3,1
                  endif
                  ifdef SPI1RXIF ;----{ SPI1RX Serial Peripherial Interface 1 RX }----------[PIR3, SPI1RXIF]---
                  INT_Source PIR3,0, PIE3,0, IPR3,0
                  endif
                  ; -=- PIR4 Interrupts: -=-
                  ifdef PWM1IF ;----{ PWM1 PWM1 Parameter Interrupt }----------[PIR4, PWM1IF]---
                  INT_Source PIR4,7, PIE4,7, IPR4,7
                  endif
                  ifdef PWM1PIF ;----{ PWM1P PWM1 Period Interrupt }----------[PIR4, PWM1PIF]---
                  INT_Source PIR4,6, PIE4,6, IPR4,6
                  endif
                  ifdef U1IF ;----{ U1 USART1 }----------[PIR4, U1IF]---
                  INT_Source PIR4,3, PIE4,3, IPR4,3
                  endif
                  ifdef U1EIF ;----{ U1 USART1 Framing Error }----------[PIR4, U1EIF]---
                  INT_Source PIR4,2, PIE4,2, IPR4,2
                  endif
                  ifdef U1TXIF ;----{ U1TX USART1 Transmit }----------[PIR4, U1TXIF]---
                  INT_Source PIR4,1, PIE4,1, IPR4,1
                  endif
                  ifdef U1RXIF ;----{ U1RX USART1 Receive }----------[PIR4, U1RXIF]---
                  INT_Source PIR4,0, PIE4,0, IPR4,0
                  endif

                  Comment


                  • #99
                    Code:
                    ; -=- PIR5 Interrupts: -=-
                    ifdef PWM2IF ;----{ PWM2 PWM2 Parameter Interrupt }----------[PIR5, PWM2IF]---
                    INT_Source PIR5,7, PIE5,7, IPR5,7
                    endif
                    ifdef PWM2PIF ;----{ PWM2P PWM2 Period Interrupt }----------[PIR5, PWM2PIF]---
                    INT_Source PIR5,6, PIE5,6, IPR5,6
                    endif
                    ifdef TMR3GIF ;----{ TMR3G TMR3 Gate }----------[PIR5, TMR3GIF]---
                    INT_Source PIR5,5, PIE5,5, IPR5,5
                    endif
                    ifdef TMR3IF ;----{ TMR3 TMR3 Overflow }----------[PIR5, TMR3IF]---
                    INT_Source PIR5,4, PIE5,4, IPR5,4
                    endif
                    ifdef SPI2IF ;----{ SPI2 Serial Peripherial Interface 2 }----------[PIR5, SPI2IF]---
                    INT_Source PIR5,2, PIE5,2, IPR5,2
                    endif
                    ifdef SPI2TXIF ;----{ SPI2TX Serial Peripherial Interface 2 TX }----------[PIR5, SPI2TXIF]---
                    INT_Source PIR5,1, PIE5,1, IPR5,1
                    endif
                    ifdef SPI2RXIF ;----{ SPI2RX Serial Peripherial Interface 2 RX }----------[PIR5, SPI2RXIF]---
                    INT_Source PIR5,0, PIE5,0, IPR5,0
                    endif
                    ; -=- PIR6 Interrupts: -=-
                    ifdef DMA2AIF ;----{ DMA2A DMA2 Abort }----------[PIR6, DMA2AIF]---
                    INT_Source PIR6,7, PIE6,7, IPR6,7
                    endif
                    ifdef DMA2ORIF ;----{ DMA2OR DMA2 Overrun }----------[PIR6, DMA2ORIF]---
                    INT_Source PIR6,6, PIE6,6, IPR6,6
                    endif
                    ifdef DMA2DCNTIF ;----{ DMA2DCNT DMA2 Destination Count }----------[PIR6, DMA2DCNTIF]---
                    INT_Source PIR6,5, PIE6,5, IPR6,5
                    endif
                    ifdef DMA2SCNTIF ;----{ DMA2SCNT Source Count }----------[PIR6, DMA2SCNTIF]---
                    INT_Source PIR6,4, PIE6,4, IPR6,4
                    endif
                    ifdef NCO1IF ;----{ NCO1 NCO1 Interrupt }----------[PIR6, NCO1IF]---
                    INT_Source PIR6,3, PIE6,3, IPR6,3
                    endif
                    ifdef CWG1IF ;----{ CWG1 Configurable Wave Generator 1 }----------[PIR6, CWG1IF]---
                    INT_Source PIR6,2, PIE6,2, IPR6,2
                    endif
                    ifdef CLC2IF ;----{ CLC2 Configurable Logic Cell 2 }----------[PIR6, CLC2IF]---
                    INT_Source PIR6,1, PIE6,1, IPR6,1
                    endif
                    ifdef INT1IF ;----{ INT1 INT1 External }----------[PIR6, INT1IF]---
                    INT_Source PIR6,0, PIE6,0, IPR6,0
                    endif
                    ; -=- PIR7 Interrupts: -=-
                    ifdef PWM3IF ;----{ PWM3 PWM3 Parameter Interrupt }----------[PIR7, PWM3IF]---
                    INT_Source PIR7,7, PIE7,7, IPR7,7
                    endif
                    ifdef PWM3PIF ;----{ PWM3P PWM3 Period Interrupt }----------[PIR7, PWM3PIF]---
                    INT_Source PIR7,6, PIE7,6, IPR7,6
                    endif
                    ifdef CLC3IF ;----{ CLC3 Configurable Logic Cell 3 }----------[PIR7, CLC3IF]---
                    INT_Source PIR7,5, PIE7,5, IPR7,5
                    endif
                    ifdef I2C1EIF ;----{ I2C1E I2C1 Error }----------[PIR7, I2C1EIF]---
                    INT_Source PIR7,3, PIE7,3, IPR7,3
                    endif
                    ifdef I2C1IF ;----{ I2C1 I2C1 Interrupt }----------[PIR7, I2C1IF]---
                    INT_Source PIR7,2, PIE7,2, IPR7,2
                    endif
                    ifdef I2C1TXIF ;----{ I2C1TX I2C1 Transmit }----------[PIR7, I2C1TXIF]---
                    INT_Source PIR7,1, PIE7,1, IPR7,1
                    endif
                    ifdef I2C1RXIF ;----{ I2C1RX I2C1 Receive }----------[PIR7, I2C1RXIF]---
                    INT_Source PIR7,0, PIE7,0, IPR7,0
                    endif
                    ; -=- PIR8 Interrupts: -=-
                    ifdef SCANIF ;----{ SCAN Memory Scanner Interrupt }----------[PIR8, SCANIF]---
                    INT_Source PIR8,7, PIE8,7, IPR8,7
                    endif
                    ifdef CCP2IF ;----{ CCP2 CCP2 Interrupt }----------[PIR8, CCP2IF]---
                    INT_Source PIR8,6, PIE8,6, IPR8,6
                    endif
                    ifdef TMR5GIF ;----{ TMR5G TMR5 Gate }----------[PIR8, TMR5GIF]---
                    INT_Source PIR8,5, PIE8,5, IPR8,5
                    endif
                    ifdef TMR5IF ;----{ TMR5 TMR5 Overflow }----------[PIR8, TMR5IF]---
                    INT_Source PIR8,4, PIE8,4, IPR8,4
                    endif
                    ifdef U2IF ;----{ U2 USART2 Interrupt }----------[PIR8, U2IF]---
                    INT_Source PIR8,3, PIE8,3, IPR8,3
                    endif
                    ifdef U2EIF ;----{ U2E USART2 Framing Error }----------[PIR8, U2EIF]---
                    INT_Source PIR8,2, PIE8,2, IPR8,2
                    endif
                    ifdef U2TXIF ;----{ U2TX USART2 Transmit }----------[PIR8, U2TXIF]---
                    INT_Source PIR8,1, PIE8,1, IPR8,1
                    endif
                    ifdef U2RXIF ;----{ U2RX USART2 Receive }----------[PIR8, U2RXIF]---
                    INT_Source PIR8,0, PIE8,0, IPR8,0
                    endif
                    ; -=- PIR9 Interrupts: -=-
                    ifdef CLC4IF ;----{ CLC4 Configurable Logic Cell 4 }----------[PIR9, CLC4IF]---
                    INT_Source PIR9,5, PIE9,5, IPR9,5
                    endif
                    ifdef U3IF ;----{ U3 USART3 Interrupt }----------[PIR9, U3IF]---
                    INT_Source PIR9,3, PIE9,3, IPR9,3
                    endif
                    ifdef U3EIF ;----{ U3E USART3 Framing Error }----------[PIR9, U3EIF]---
                    INT_Source PIR9,2, PIE9,2, IPR9,2
                    endif
                    ifdef U3TXIF ;----{ U3TX USART3 Transmit }----------[PIR9, U3TXIF]---
                    INT_Source PIR9,1, PIE9,1, IPR9,1
                    endif
                    ifdef U3RXIF ;----{ U3RX USART3 Receive }----------[PIR9, U3RXIF]---
                    INT_Source PIR9,0, PIE9,0, IPR9,0
                    endif
                    ; -=- PIR10 Interrupts: -=-
                    ifdef DMA3AIF ;----{ DMA3A DMA3 Abort }----------[PIR10, DMA3AIF]---
                    INT_Source PIR10,7, PIE10,7, IPR10,7
                    endif
                    ifdef DMA3ORIF ;----{ DMA3OR DMA3 Overrun }----------[PIR10, DMA3ORIF]---
                    INT_Source PIR10,6, PIE10,6, IPR10,6
                    endif
                    ifdef DMA3DCNTIF ;----{ DMA3DCNT DMA3 Destination Count }----------[PIR10, DMA3DCNTIF]---
                    INT_Source PIR10,5, PIE10,5, IPR10,5
                    endif
                    ifdef DMA3SCNTIF ;----{ DMA3SCNT DMA3 Source Count }----------[PIR10, DMA3SCNTIF]---
                    INT_Source PIR10,4, PIE10,4, IPR10,4
                    endif
                    ifdef NCO2IF ;----{ NCO2 NCO2 Interrupt }----------[PIR10, NCO2IF]---
                    INT_Source PIR10,3, PIE10,3, IPR10,3
                    endif
                    ifdef CWG2IF ;----{ CWG2 Configurable Wave Generator 2 }----------[PIR10, CWG2IF]---
                    INT_Source PIR10,2, PIE10,2, IPR10,2
                    endif
                    ifdef CLC5IF ;----{ CLC5 Configurable Logic Cell 5 }----------[PIR10, CLC5IF]---
                    INT_Source PIR10,1, PIE10,1, IPR10,1
                    endif
                    ifdef INT2IF ;----{ INT2 INT2 External }----------[PIR10, INT2IF]---
                    INT_Source PIR10,0, PIE10,0, IPR10,0
                    endif
                    ; -=- PIR11 Interrupts: -=-
                    ifdef DMA4AIF ;----{ DMA4A DMA4 Abort }----------[PIR11, DMA4AIF]---
                    INT_Source PIR11,7, PIE11,7, IPR11,7
                    endif
                    ifdef DMA4ORIF ;----{ DMA4OR DMA4 Overrun }----------[PIR11, DMA4ORIF]---
                    INT_Source PIR11,6, PIE11,6, IPR11,6
                    endif
                    ifdef DMA4DCNTIF ;----{ DMA4DCNT DMA4 Destination Count }----------[PIR11, DMA4DCNTIF]---
                    INT_Source PIR11,5, PIE11,5, IPR11,5
                    endif
                    ifdef DMA4SCNTIF ;----{ DMA4SCNT DMA4 Source Count }----------[PIR11, DMA4SCNTIF]---
                    INT_Source PIR11,4, PIE11,4, IPR11,4
                    endif
                    ifdef TMR4IF ;----{ TMR4 TMR4-T4PR Match }----------[PIR11, TMR4IF]---
                    INT_Source PIR11,3, PIE11,3, IPR11,3
                    endif
                    ifdef CWG3IF ;----{ CWG3 Configurable Wave Generator 3 }----------[PIR11, CWG3IF]---
                    INT_Source PIR11,2, PIE11,2, IPR11,2
                    endif
                    ifdef CLC6IF ;----{ CLC6 Configurable Logic Cell 6 }----------[PIR11, CLC6IF]---
                    INT_Source PIR11,1, PIE11,1, IPR11,1
                    endif
                    ifdef CCP3IF ;----{ CCP3 CCP3 }----------[PIR11, CCP3IF]---
                    INT_Source PIR11,0, PIE11,0, IPR11,0
                    endif
                    ; -=- PIR12 Interrupts: -=-
                    ifdef DMA5AIF ;----{ DMA5A DMA5 Abort }----------[PIR12, DMA5AIF]---
                    INT_Source PIR12,7, PIE12,7, IPR12,7
                    endif
                    ifdef DMA5ORIF ;----{ DMA5OR DMA5 Overrun }----------[PIR12, DMA5ORIF]---
                    INT_Source PIR12,6, PIE12,6, IPR12,6
                    endif
                    ifdef DMA5DCNTIF ;----{ DMA5DCNT DMA5 Destination Count }----------[PIR12, DMA5DCNTIF]---
                    INT_Source PIR12,5, PIE12,5, IPR12,5
                    endif
                    ifdef DMA5SCNTIF ;----{ DMA5SCNT DMA5 Source Count }----------[PIR12, DMA5SCNTIF]---
                    INT_Source PIR12,4, PIE12,4, IPR12,4
                    endif
                    ifdef U4IF ;----{ U4 USART4 Interrupt }----------[PIR12, U4IF]---
                    INT_Source PIR12,3, PIE12,3, IPR12,3
                    endif
                    ifdef U4EIF ;----{ U4E USART4 Framing Error }----------[PIR12, U4EIF]---
                    INT_Source PIR12,2, PIE12,2, IPR12,2
                    endif
                    ifdef U4TXIF ;----{ U4TX USART4 Transmit }----------[PIR12, U4TXIF]---
                    INT_Source PIR12,1, PIE12,1, IPR12,1
                    endif
                    ifdef U4RXIF ;----{ U4RX USART4 Receive }----------[PIR12, U4RXIF]---
                    INT_Source PIR12,0, PIE12,0, IPR12,0
                    endif
                    ; -=- PIR13 Interrupts: -=-
                    ifdef DMA6AIF ;----{ DMA6A DMA6 Abort }----------[PIR13, DMA6AIF]---
                    INT_Source PIR13,7, PIE13,7, IPR13,7
                    endif
                    ifdef DMA6ORIF ;----{ DMA6OR DMA6 Overrun }----------[PIR13, DMA6ORIF]---
                    INT_Source PIR13,6, PIE13,6, IPR13,6
                    endif
                    ifdef DMA6DCNTIF ;----{ DMA6DCNT DMA6 Destination Count }----------[PIR13, DMA6DCNTIF]---
                    INT_Source PIR13,5, PIE13,5, IPR13,5
                    endif
                    ifdef DMA6SCNTIF ;----{ DMA6SCNT DMA6 Source Count }----------[PIR13, DMA6SCNTIF]---
                    INT_Source PIR13,4, PIE13,4, IPR13,4
                    endif
                    ifdef U5IF ;----{ U5 USART5 Interrupt }----------[PIR13, U5IF]---
                    INT_Source PIR13,3, PIE13,3, IPR13,3
                    endif
                    ifdef U5EIF ;----{ U5E USART5 Framing Error }----------[PIR13, U5EIF]---
                    INT_Source PIR13,2, PIE13,2, IPR13,2
                    endif
                    ifdef U5TXIF ;----{ U5TX USART5 Transmit }----------[PIR13, U5TXIF]---
                    INT_Source PIR13,1, PIE13,1, IPR13,1
                    endif
                    ifdef U5RXIF ;----{ U5RX USART5 Receive }----------[PIR13, U5RXIF]---
                    INT_Source PIR13,0, PIE13,0, IPR13,0
                    endif
                    ; -=- PIR14 Interrupts: -=-
                    ifdef NCO3IF ;----{ NCO3 NCO3 Interrupt }----------[PIR14, NCO3IF]---
                    INT_Source PIR14,3, PIE14,3, IPR14,3
                    endif
                    ifdef CM2IF ;----{ CM2 Comparator2 Interrupt }----------[PIR14, CM2IF]---
                    INT_Source PIR14,2, PIE14,2, IPR14,2
                    endif
                    ifdef CLC7IF ;----{ CLC7 Configurable Logic Cell 7 }----------[PIR14, CLC7IF]---
                    INT_Source PIR14,1, PIE14,1, IPR14,1
                    endif
                    ; -=- PIR15 Interrupts: -=-
                    ifdef TMR6IF ;----{ TMR6 TMR6-T6PR Match }----------[PIR15, TMR6IF]---
                    INT_Source PIR15,3, PIE15,3, IPR15,3
                    endif
                    ifdef CRCIF ;----{ CRC Cyclic Redundancy Check }----------[PIR15, CRCIF]---
                    INT_Source PIR15,2, PIE15,2, IPR15,2
                    endif
                    ifdef CLC8IF ;----{ CLC8 Configurable Logic Cell 8 }----------[PIR15, CLC8IF]---
                    INT_Source PIR15,1, PIE15,1, IPR15,1
                    endif
                    ifdef NVMIF ;----{ NVM EEPROM/FLASH Write Operation }----------[PIR15, NVMIF]---
                    INT_Source PIR15,0, PIE15,0, IPR15,0
                    endif
                    list
                    endm
                    list
                    ENDASM

                    Comment


                    • Code:
                      ____[ if not using Low Priority INTS, create a dummy handler ]_______________
                      ASM
                      ifndef USE_LOWPRIORITY
                      INT_ENTRY_L
                      retfie FAST
                      else
                      if (USE_LOWPRIORITY != 1)
                      INT_ENTRY_L
                      retfie FAST
                      endif
                      endif
                      ENDASM
                      
                      ;_____________________________________________________________________________
                      Asm
                      asm = 0 ; Assembly language Interrupts
                      ASM = 0
                      Asm = 0
                      pbp = 1 ; Basic language interrupts
                      PBP = 1
                      Pbp = 1
                      YES = 1
                      yes = 1
                      Yes = 1
                      NO = 0
                      no = 0
                      No = 0
                      H equ 'H' ; High Priority
                      h equ 'H'
                      L equ 'L' ; Low Priority
                      l equ 'L'
                      
                      nolist
                      
                      ;_____________________________________________________________________________
                      SaveFSR macro F, Pr
                      list
                      if (F >= 0) && (F <= 2)
                      if (Pr == H) || (Pr == L)
                      movff FSR#v(F)L, fsave#v(F)Pr
                      movff FSR#v(F)H, fsave#v(F)Pr + 1
                      nolist
                      else
                      ERROR "SaveFSR - Invalid Priority"
                      endif
                      else
                      ERROR "SaveFSR - Invalid FSR number"
                      endif
                      list
                      endm
                      ENDASM
                      
                      ;_____________________________________________________________________________
                      Asm
                      RestFSR macro F, Pr
                      list
                      if (F >= 0) && (F <= 2)
                      if (Pr == H) || (Pr == L)
                      movff fsave#v(F)Pr , FSR#v(F)L
                      movff fsave#v(F)Pr + 1 , FSR#v(F)H
                      nolist
                      else
                      ERROR "RestFSR - Invalid Priority"
                      endif
                      else
                      ERROR "RestFSR - Invalid FSR number"
                      endif
                      list
                      endm
                      ENDASM
                      
                      ;---[Stay compatible with the 14-bit version]---------------------------------
                      Asm
                      INT_FINISH_H macro
                      endm
                      EndAsm
                      
                      ;---[Create the High Priority Interrupt Processor]----------------------------
                      ASM
                      INT_CREATE_H macro
                      local OverCREATE
                      goto OverCREATE
                      Priority = H
                      INT_ENTRY_H
                      ;==== revoved q43 chip ====
                      ; movff PCLATU, psaveUH
                      ; movff PCLATH, psaveH
                      ; SaveFSR 0, H
                      ; SaveFSR 1, H
                      ; SaveFSR 2, H
                      ;==========================
                      bsf _InHPint, 0
                      List_Start_H
                      bcf _Serviced_H, 0 ; Clear Serviced flag
                      clrf BSR
                      PREV_BANK = 5
                      ifdef INT_LIST_H
                      INT_LIST_H ; Expand the users list of HP INT handlers
                      else
                      ifdef INT_LIST
                      INT_LIST ; Expand the 16F Compatible List
                      else
                      error "INT_CREATE_H - INT_LIST or INT_LIST_H not found"
                      endif
                      endif
                      btfsc _Serviced_H,0 ; if anything was serviced
                      goto List_Start_H ; go around, and check again
                      
                      ifdef ReEnterHPused ; was ReEnterPBP-18.bas included
                      GetAddress21 INT_EXIT_H, RetAddrH
                      L?GOTO _RestorePBP_H ; Restore PBP system Vars
                      endif
                      
                      INT_EXIT_H
                      PREV_BANK = 5
                      bcf _InHPint, 0
                      ; === removed q43 chip ============
                      ; RestFSR 0, H ; Restore FSR0, if it was saved?
                      ; RestFSR 1, H ; Restore FSR1, if it was saved?
                      ; RestFSR 2, H ; Restore FSR2, if it was saved?
                      ; movff psaveH, PCLATH
                      ; movff psaveUH, PCLATU
                      ; ==========================
                      
                      retfie FAST ; Return from Interrupt
                      OverCREATE
                      bsf INTCON0,GIE, 0 ; Enable High Priority Interrupts
                      ; bsf INTCON0,PEIE, 0 ; Enable Peripheral Interrupts
                      endm
                      
                      ;---[Stay compatible with the 14-bit version]---------------------------------
                      INT_CREATE macro
                      INT_CREATE_H
                      endm
                      ENDASM
                      
                      ;---[Create the Low Priority Interrupt Processor]-----------------------------
                      ASM
                      INT_CREATE_L macro
                      local OverCREATE
                      goto OverCREATE
                      ifdef USE_LOWPRIORITY
                      if (USE_LOWPRIORITY != 1)
                      error "'DEFINE USE_LOWPRIORITY 1' required for Low Priority Interrupts"
                      endif
                      else
                      error "'DEFINE USE_LOWPRIORITY 1' required for Low Priority Interrupts"
                      endif
                      Priority = L
                      INT_ENTRY_L
                      ; ==== removed q43 chip ==============
                      ; movff WREG, wsave ; Wreg
                      ; movff STATUS, ssave ; STATUS
                      ; movff BSR, bsave ; BSR
                      ; movff PCLATU, psaveUL
                      ; movff PCLATH, psaveL
                      ; SaveFSR 0, L ; FSR0
                      ; SaveFSR 1, L ; FSR1
                      ; SaveFSR 2, L ; FSR2
                      ; ===================================
                      bcf _InHPint, 0
                      List_Start_L
                      clrf BSR
                      PREV_BANK = 5
                      RETFIE 1
                      bcf _Serviced_L, 0
                      ifdef INT_LIST_L
                      INT_LIST_L ; Expand the users list of HP INT handlers
                      else
                      error "INT_CREATE_L - INT_LIST_L not defined, can not create"
                      endif
                      btfsc _Serviced_L, 0 ; if anything was serviced
                      goto List_Start_L ; go around, and check again
                      
                      ifdef ReEnterLPused ; was ReEnterPBP-18LP.bas included
                      GetAddress21 INT_EXIT_L, RetAddrL
                      L?GOTO _RestorePBP_L ; Restore PBP system Vars
                      endif
                      
                      INT_EXIT_L
                      PREV_BANK = 5
                      ; ======== removed q43 chip ========
                      ; 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 FAST ; Return from Interrupt
                      OverCREATE
                      bsf INTCON0, IPEN_INTCON0, 0 ; Enable Interrupt Priorities
                      ; bsf RCON,IPEN, 0 ; Enable Interrupt Priorities - removed for q43 chip
                      bsf INTCON0,GIEL, 0 ; Enable Low Priority Interrupts
                      endm
                      ENDASM

                      Comment


                      • Code:
                        ASM
                        ;---[Returns the Address of a Label as a Word]--(under 64K)------------------
                        GetAddress macro Label, Wout
                        CHK?RP Wout
                        movlw low Label ; get low byte
                        movwf Wout
                        movlw High Label ; get high byte
                        movwf Wout + 1
                        endm
                        
                        ;---[Returns the Address of a Label as a 3 byte array]---(under/over 64k)-----
                        GetAddress21 macro Label, Aout
                        CHK?RP Aout
                        movlw low Label ; get low byte
                        movwf Aout
                        movlw high Label ; get high byte
                        movwf Aout + 1
                        movlw upper Label ; get upper byte
                        movwf Aout + 2
                        endm
                        
                        ;---[find correct bank for a PBP BIT variable]-------------------------------
                        CHKRP?T macro reg, bit
                        CHK?RP reg
                        endm
                        
                        ;---[find Assigned Priority for specified INT Source]------------------------
                        INT_Count = 0
                        
                        FindIntPriority macro IntFlagReg, IntFlagBit
                        local LoopCount
                        nolist
                        Pfound = 0
                        LoopCount = 1
                        while LoopCount <= INT_Count
                        if (IntFlagReg == PrList#v(LoopCount)R)
                        if (IntFlagBit == PrList#v(LoopCount)B)
                        list
                        Priority = PrList#v(LoopCount)Priority
                        Pfound = 1
                        endif
                        endif
                        LoopCount += 1
                        endw
                        endm
                        ENDASM
                        
                        ASM
                        
                        ;---[Add an Interrupt Source to the user's list of INT Handlers]--------------
                        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)
                        btfss INT_Enable_Reg, INT_Enable_Bit, 0 ; if INT is enabled
                        goto NoInt
                        btfss INT_Flag_Reg, INT_Flag_Bit, 0 ; and the Flag set?
                        goto NoInt
                        if (Priority == H)
                        bsf _Serviced_H, 0
                        else
                        bsf _Serviced_L, 0
                        endif
                        ifdef NO_CLRWDT
                        if (NO_CLRWDT != 1)
                        CLRWDT
                        endif
                        else
                        CLRWDT
                        endif
                        
                        if (Type == PBP) ; If INT handler is PBP
                        if (Priority == H)
                        ifdef ReEnterHPused
                        GetAddress21 AfterSave, RetAddrH
                        L?GOTO _SavePBP_H ; Save PBP system Vars in HP INT
                        else
                        error "ReEnterPBP-18 must be INCLUDEd to use High Priority PBP interrupts"
                        endif
                        else ; Priority = L
                        ifdef ReEnterLPused
                        GetAddress21 AfterSave, RetAddrL
                        L?GOTO _SavePBP_L ; Save PBP system Vars in LP INT
                        else
                        error "ReEnterPBP-18LP must be INCLUDEd to use Low Priority PBP interrupts"
                        endif
                        endif
                        endif
                        AfterSave
                        PREV_BANK = 5
                        if (Priority == H)
                        GetAddress21 AfterUser, RetAddrH
                        else ; Priority = L
                        GetAddress21 AfterUser, RetAddrL
                        endif
                        L?GOTO Label ; goto the users INT handler
                        
                        AfterUser
                        PREV_BANK = 5
                        if (Reset == YES) ; reset flag (if specified)
                        bcf INT_Flag_Reg, INT_Flag_Bit, 0
                        endif
                        else
                        error Interrupt Source (IntFlagReg,IntFlagBit) not found
                        endif
                        NoInt
                        clrf BSR
                        PREV_BANK = 5
                        endm
                        ENDASM
                        
                        asm
                        ;---[Returns from a "goto" subroutine]--(21-bit RetAddr? must be set first)---
                        INT_RETURN macro
                        local Ret2LP, Ret2HP
                        btfsc _InHPint, 0
                        goto Ret2HP
                        Ret2LP
                        movff RetAddrL + 2, PCLATU ; Load PC buffers with return address
                        movff RetAddrL + 1, PCLATH
                        movf RetAddrL, W, 0
                        clrf BSR ; Set to BANK5 before returning
                        PREV_BANK = 5 ; Tell PBP about the BANK change
                        movwf PCL, 0 ; Go back to where we were
                        
                        Ret2HP
                        movff RetAddrH + 2, PCLATU ; Load PC buffers with return address
                        movff RetAddrH + 1, PCLATH
                        movf RetAddrH, W, 0
                        clrf BSR ; Set to BANK5 before returning
                        PREV_BANK = 5 ; Tell PBP about the BANK change
                        movwf PCL, 0 ; Go back to where we were
                        endm
                        
                        ;---[Enable an interrupt source]----------------------------------------------
                        INT_ENABLE macro IntFlagReg, IntFlagBit
                        GetIntInfo IntFlagReg, IntFlagBit
                        if (Found == YES)
                        FindIntPriority IntFlagReg, IntFlagBit
                        if (Pfound == 1)
                        if (INT_Priority_Reg != -1)
                        if (Priority == H)
                        bsf INT_Priority_Reg, INT_Priority_Bit, 0
                        else
                        if (Priority == L)
                        bcf INT_Priority_Reg, INT_Priority_Bit, 0
                        else
                        error "INT_ENABLE - Invalid Priority Specified"
                        endif
                        endif
                        else
                        if (Priority == L)
                        error "INT0_INT can NOT be assigned to Low Priority"
                        endif
                        endif
                        else
                        error "INT_ENABLE - Priority State Not Found"
                        endif
                        ; bcf INT_Flag_Reg, INT_Flag_Bit, 0 ; clear the flag first
                        bsf INT_Enable_Reg, INT_Enable_Bit, 0 ; enable the INT source
                        else
                        error "INT_ENABLE - Interrupt Source not found!"
                        endif
                        endm
                        
                        ;---[Disable an interrupt source]---------------------------------------------
                        INT_DISABLE macro IntFlagReg, IntFlagBit
                        GetIntInfo IntFlagReg, IntFlagBit
                        if (Found == YES)
                        bcf INT_Enable_Reg, INT_Enable_Bit, 0 ; disable the INT source
                        else
                        error "INT_DISABLE - Interrupt Source not found!"
                        endif
                        endm
                        
                        ;---[Clear an interrupt Flag]-------------------------------------------------
                        INT_CLEAR macro IntFlagReg, IntFlagBit
                        GetIntInfo IntFlagReg, IntFlagBit
                        if (Found == YES)
                        bcf INT_Flag_Reg, INT_Flag_Bit, 0 ; clear the INT flag
                        else
                        error "INT_CLEAR - Interrupt Source not found!"
                        endif
                        endm
                        
                        ENDASM
                        
                        ; ---[See if we need to save TBLPTR]------------------------------------------
                        ASM
                        Save_TBLPTR = 0
                        
                        ifdef SIN_USED
                        Save_TBLPTR = 1
                        endif
                        ifdef DTMFOUT_USED
                        Save_TBLPTR = 1
                        endif
                        ifdef SERDELAY_USED
                        Save_TBLPTR = 1
                        endif
                        ifdef CONVBIT_USED
                        Save_TBLPTR = 1
                        endif
                        ifdef ERASECODE_USED
                        Save_TBLPTR = 1
                        endif
                        ifdef READCODE_USED
                        Save_TBLPTR = 1
                        endif
                        ifdef WRITECODE_USED
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?BCLB
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?BCLT
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?BCLW
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?CCLB
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?CCLT
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?CCLW
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?WCLB
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?WCLT
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKDOWN?WCLW
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOK2_USED
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?BCLB
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?BCLT
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?BCLW
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?CCLB
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?CCLT
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?CCLW
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?TCLB
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?TCLT
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?TCLW
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?WCLB
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?WCLT
                        Save_TBLPTR = 1
                        endif
                        ifdef LOOKUP?WCLW
                        Save_TBLPTR = 1
                        endif
                        endasm
                        
                        OVER_DT_INTS_18:
                        
                        ENABLE DEBUG

                        Comment


                        • complete listing as is stands now - please review

                          Comment


                          • In all honesty, you guys are doing a better job than I would, and getting to it quicker. It looks like you don't need me here. Well done!
                            We can crack this cotton PIC'n thang!

                            Comment


                            • hi mike be nice if you review / update/ release as the " official ver" remove what is not required and post to the other forham

                              Comment


                              • I've had this window open for 2 days thinking about an appropriate response. I think you short-change yourself by thinking only some recognized guru has the authority to contribute hard-earned efforts to the community. First, YOU did the work, therefore YOU should get the credit. If it isn't perfect (like my version wasn't), the community can contribute to polish up the minor flaws -- as you have done.

                                With that said, I encourage YOU to submit YOUR hard work to the community under YOUR own name. Be proud and stand tall!
                                We can crack this cotton PIC'n thang!

                                Comment

                                Working...
                                X