Thank you guys. Actually the code I posted was some code to illustrate my point. But obviously is had some errors. Please, disregard that code. I'm using PBP 2.60 and a PIC16F1939. My actual code is as follows.

Code:
'****************************************************************
'*         SET UP DT INTERRUPTS                                 *
'****************************************************************
ASM
INT_LIST macro  ; IntSource,    Label,  Type,   ResetFlag?
        INT_Handler     TMR2_INT,     _ClockCounter,   PBP,    yes
        INT_Handler     T1GATE_INT,   _CheckSensors,   PBP,    yes        
    endm
    INT_CREATE          ;Creates the interrupt processor 
ENDASM

'****************************************************************
'*         TMR0 TIME BASE SETUP                                 *
'*         ENABLE TMR0 TIMER INTERRUPTS                         *
'****************************************************************
OPTION_REG = %01000010       'Bit 2-0, 110= prescaler rate 1:8 (TMRO INTERRUPTS EVERY 0.512 mSec)
                             'Bit 7, enable individual pull-ups in port B.
INTCON = %01100000			 'enable TMR0 interrupts. enables all unmasked peripheral interrupts
T1CON = %11000101            'Timer1 initialization
T1GCON = %11100001           'Timer1 gate init /Toggle Mode/TMR0 time base
PIR1.7 = 0                   'Clear Gate Interrupt Flag. Timer1 gate is active (TMR1GIF BIT)
PIE1.7 = 1                   'Enables the Timer1 Gate Acquisition complete interrupt (TMR1GIE BIT)

PIE1.1 = 1                   'Enables the Timer2 to PR2 match interrupt
T2CON = %00000100            'Timer2 is on
                             
TMR0 = 0				     'TMR0 overflows every (256-TMRO)*(Prescaler rate)(4*(1/16)uS)=0.512 mSec.
                            
INTCON = %10100000			 'Enable Interrupts

@ INT_ENABLE    TMR2_INT
@ INT_ENABLE    T1GATE_INT   
 

'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'<                   INTERRUPT ROUTINES                         >
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

CheckSensors: 
   
    T1CON.0 = 0                 'Stop/Clears Timer1 before reading TMR1

   ' DO SOMETHING.......
    
    TMR1L = 0               'Reset Timer1
    TMR1H = 0
    T1CON.0 = 1             'Restart/Enable Timer1 (TMR1ON BIT)
    TMR0 = 0                'RESET TMR0 TO 0 
    INTCON.2 = 0		    'Re-enable TMR0 interrupts. Bit 2, 0= clears overflow, 1= overflow ocurred 
    
@ INT_RETURN


ClockCounter:

TOGGLE PORTC.0  '######## TESTING #########

TMR2 = 0       'Reset TMR2 register back to zero.
PIR1.1 = 0     'A timer2 to PR2 match occurred and it's been cleared in software
@ INT_RETURN



Quote Originally Posted by HenrikOlsson View Post
Hi,

Well, that depends on how you look at it. You can't have interrupts with different priorities. Consider ALL interrupts as high priority.
Well, ideally I would like TMR2 to be of a high priority since it is keeping record of the timming. I would like the handler of TMR2 to interrupt the other handler if posible. I included the line "TOGGLE PORTC.0 '######## TESTING #########" to be able to see in an oscilloscope what is going on. When connecting PORTC.0 to the scope, this is kind of what I saw.

Name:  Interrupts_Question.PNG
Views: 688
Size:  6.6 KB

Obviously, the handler for TMR2 is not been taken care of all the time, which is what I would like it to do. Making the other handler CheckSensors smaller in size is pretty much impossible right now. This is a 15k words program and I would have to rewrite everything again.

Any ideas? Suggestions?

Robert