Quote Originally Posted by mister_e View Post
Code 1 with ON INTERRUPT
Code:
        DEFINE OSC 4   ' select 4 or 20
        PinActivar      VAR portb.0
        
        LoopCount  VAR WORD
        TMR2IF VAR PIR1.1
            
        TRISB = 0
        portb = 0
        INTCON  = %11000000
        PIE1    = %00000010
        PIR1    = %00000000
        OPTION_REG = %00000000 
        PinActivar = 0
        
@   IF (OSC==20)        
@       __config _HS_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
        pr2 = 155 
        T2CON = %00000101   ' TMR2 Prescale 1:4
@       ELSE
@       __config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
        PR2 = 118
        T2CON = %00000100 ' TMR2 prescale 1:1    
@       ENDIF        

        ON INTERRUPT GOTO Sample

MAIN:
        GOTO MAIN

disable   
Sample:
        TOGGLE PinActivar
        tmr2if=0
resume  
enable
Mister_E i am going to test with the ON INTERRUPT way because it might work better here, i am not doing much code between Samples so this could work fine. Thanks for the idea...

The DT option as you can read at Darrels link will not work either.