Hello, I am a first-time caller, long time listener. You folks and this forum have been a wealth of knowledge over the years and I just wanted to say thank you. I currently have a problem that I haven’t been able to crack, I am sure I am missing something but just don’t know what.

I am trying to get a TMR1 overflow interrupt (no vectors, I turned them off, I think) to work on a 18F26K42. I tried using the DT_INTS-18K42b.bas routine by MPGMike but kept getting a compile error, specifically on the SaveFSR (0), (1), and (2) lines. Based on an earlier post I went into the DT_INTS-18K42b.bas file and replaced the “movff”with “movffl” but that didn’t seem to help either. The test code is below:

Code:
#CONFIG
    CONFIG FEXTOSC = OFF             
    CONFIG RSTOSC = HFINTOSC_64MHZ      
    CONFIG CLKOUTEN = OFF              
    CONFIG PR1WAY = OFF                 
    CONFIG CSWEN = ON                    
    CONFIG FCMEN = OFF                    
    CONFIG MCLRE = INTMCLR              
    CONFIG PWRTS = PWRT_OFF             
    CONFIG MVECEN = OFF                        ;disable vector table 
    CONFIG IVT1WAY = OFF               
    CONFIG LPBOREN = OFF               
    CONFIG BOREN = OFF                   
    CONFIG BORV = VBOR_245               
    CONFIG ZCD = OFF                    
    CONFIG PPS1WAY = OFF                
    CONFIG STVREN = OFF                  
    CONFIG DEBUG = OFF                  
    CONFIG XINST = OFF                  
    CONFIG WDTCPS = WDTCPS_31          
    CONFIG WDTE = OFF                    
    CONFIG WDTCWS = WDTCWS_7            
    CONFIG WDTCCS = LFINTOSC           
    CONFIG BBSIZE = BBSIZE_512           
    CONFIG BBEN = OFF                    
    CONFIG SAFEN = OFF                    
    CONFIG WRTAPP = OFF                  
    CONFIG WRTB = OFF                   
    CONFIG WRTC = OFF                   
    CONFIG WRTD = OFF                   
    CONFIG WRTSAF = OFF                   
    CONFIG LVP = OFF                    
    CONFIG CP = OFF                      
#ENDCONFIG
  
'Defines, Includes, and Constants-----------------------------------------------

DEFINE OSC 64                                    ' Calibrate PBP to 64MHz clock
OSCFRQ = 001000                               ' Set system clock to 64MHz internal

INCLUDE "DT_INTS-18_k42b.bas"         ; Base Interrupt System
include "ReEnterPBP.bas" 

ASM 
INT_LIST macro            ; IntSource,      Label,     Type, ResetFlag?
         INT_Handler      TMR1_INT,         _INC_TICK, PBP, YES  
    ENDM
    INT_CREATE
ENDASM  

'Direction----------------------------------------------------------------------

TRISA = 000000   
TRISB = 000000   
TRISC = 000000  

'Alias---------------------------------------------------------------------------

LED   var PORTA.1

'Variables----------------------------------------------------------------------

'Initialize Registers----------------------------------------------------------------------

Initialize:  
    ANSELA   = 000000                      ' Set digital
    ANSELB   = 000000                      ' Set digital
    ANSELC   = 000000                      ' Set digital
    ADCON0   = 000000                     ' Disable ADC  
 
    CM1CON0.7 = 0 : CM2CON0.7 = 0         'Disable comparators
    PMD0=$FF : PMD1=$FF : PMD2=$FF      'Turning off all Peripheral-
    PMD3=$FF : PMD4=$FF : PMD5=$FF      '-Modules, not sure if this is nessesary
    PMD6=$FF : PMD7 = $FF
    PMD1.bit1 = 0                                      'Enable the TMR1 module

    T1CON = 110000                                  'Prescale 1:8; Disable the TMR1
    T1GCON.bit7 = 0                                  'Disable gate, TMR1 always counting
    T1CLK = 000001                                   'Clock Source Fosc/4
    
    TMR1H = $00 : TMR1L = $00
    
@   INT_ENABLE  TMR1_INT
    
    LED = 0   

'Code---------------------------------------------------------------------------  

Main:  
    pause 1 
    Goto Main

'----- INTERRUPT CODE -------------------
INC_TICK:
         toggle LED
         TMR1L = $00 : TMR1H = $00 
         PIR4.bit0 = 0
@ INT_RETURN
'------ END OF INTERRUPTS CODE ----------

Next, I tried the simple old “ON INTERRUPT GOTO” function of PBP3. The code below seems to compile, it just doesn't work. I can confirm that the TMR1H and TMR1L registers increase to 65535 and then wrap around to 0 and increase again, etc. The interrupt just never occurs. I am using an oscilloscope to monitor the LED pin.

Code:
#CONFIG
    CONFIG FEXTOSC = OFF               
    CONFIG RSTOSC = HFINTOSC_64MHZ       
    CONFIG CLKOUTEN = OFF                
    CONFIG PR1WAY = OFF                    
    CONFIG CSWEN = ON                    
    CONFIG FCMEN = OFF                    
    CONFIG MCLRE = INTMCLR               
    CONFIG PWRTS = PWRT_OFF                
    CONFIG MVECEN = OFF                   
    CONFIG IVT1WAY = OFF                
    CONFIG LPBOREN = OFF               
    CONFIG BOREN = OFF                    
    CONFIG BORV = VBOR_245                
    CONFIG ZCD = OFF                    
    CONFIG PPS1WAY = OFF               
    CONFIG STVREN = OFF                    
    CONFIG DEBUG = OFF                  
    CONFIG XINST = OFF                    
    CONFIG WDTCPS = WDTCPS_31            
    CONFIG WDTE = OFF                   
    CONFIG WDTCWS = WDTCWS_7            
    CONFIG WDTCCS = LFINTOSC           
    CONFIG BBSIZE = BBSIZE_512            
    CONFIG BBEN = OFF                    
    CONFIG SAFEN = OFF                    
    CONFIG WRTAPP = OFF                    
    CONFIG WRTB = OFF                   
    CONFIG WRTC = OFF                    
    CONFIG WRTD = OFF                    
    CONFIG WRTSAF = OFF                    
    CONFIG LVP = OFF                    
    CONFIG CP = OFF                        
#ENDCONFIG
  
'Defines, Includes, and Constants-----------------------------------------------

DEFINE OSC 64                                   ' Calibrate PBP to 64MHz clock
OSCFRQ = 001000                              ' Set system clock to 64MHz internal

on interrupt goto INC_TICK

'Direction----------------------------------------------------------------------

TRISA = 000000   
TRISB = 000000   
TRISC = 000000  

'Alias---------------------------------------------------------------------------

LED    VAr PORTA.1

'Variables----------------------------------------------------------------------

'Initialize Registers----------------------------------------------------------------------

Initilize:  
    ANSELA   = 000000                      ' Set digital
    ANSELB   = 000000                      ' Set digital
    ANSELC   = 000000                      ' Set digital
    ADCON0   = 000000                     ' Disable ADC  
 
    CM1CON0.7 = 0 : CM2CON0.7 = 0                  'Disable comparators
    PMD0=$FF : PMD1=$FF : PMD2=$FF 
    PMD3=$FF : PMD4=$FF : PMD5=$FF 
    PMD6=$FF : PMD7 = $FF
    PMD1.bit1 = 0   'Turning on the TMR1 peripheral module

    T1CON = 110000                                          'Prescale 1:8; Disable the TMR1
    T1GCON.bit7 = 0                                          'Disable gate, TMR1 always counting
    T1CLK = 000001                                           'Clock Source Fosc/4
    
    TMR1H = $00 : TMR1L = $00 
    
    PIR4.bit0 = 0                                             'Clear the Int flag
    PIE4.bit0 = 1                                             'Enable timer int
    INTCON0.bit7 = 1                                      'Enable global int
    T1CON.bit0 = 1                                         'Start the timer 
    
    LED = 0

'Code---------------------------------------------------------------------------  

Main:  
    pause 1 
    Goto Main

'----- INTERRUPT CODE -------------------
Disable
INC_TICK:
         toggle LED 
         TMR1L = $00 : TMR1H = $00 
         PIR4.bit0 = 0
         Resume
enable 
'------ END OF INTERRUPTS CODE ----------

I apologize for throwing two sets of code at you. I would be very happy if I could get either method to work. Software particulars: PBP 3.1.1.4; MPASM 5.0.0.5; MPLABX 5.76; Microcode Studio Plus 4.05. I am guessing I missed something or forgot to turn something on. I would love to learn more about "DEFINE INTHAND" but would be very happy to get any timer interrupt to work with any method possible at this point.

Any advice would be appreciated.

-Jon