How accurate you want it?
Skimask changed the reload value... hence why you have higher value.
try...
Code:
@ __CONFIG _HS_OSC & _WDT_OFF & _LVP_OFF & _PWRTE_ON & _BODEN_ON
define OSC 20
INT VAR PIR1.0 ' OVERFLOW flag
START VAR T1CON.0 ' START TMR1
LOAD VAR word
'------- Configurações iniciais --------------------
TRISA = %00000000 ' PORTA
TRISB = %00000000 ' PORTB
TRISC = %00000000 ' PORTC
TRISD = %00000000 ' PORTD
TRISE = %00000000 ' PORTE
OPTION_REG = %00000000
ADCON1 = %10001111 ' all digital
T1CON = %00000000 ' TMR1 1:1 prescaler
PIE1 = %00000001 ' Henable TMR1 INT
START = 0
INT = 0
LOAD = 65404 ' INT. 36KHz
@TIMER1=TMR1L
TIMER1 var word EXT
'---------------------------------------------------
ON INTERRUPT GOTO SINUS
TIMER1=LOAD
INTCON = %11000000 ' enable global interrupt
START = 1
PORTB.0 = 1
MAIN:
GOTO MAIN
DISABLE
SINUS:
@ MOVE?CT 0, T1CON, TMR1ON
TIMER1=TIMER1+LOAD
@ MOVE?CT 1, T1CON, TMR1ON
toggle PORTB.0
INT = 0
RESUME
ENABLE
end
you should have something like 18KHz signal.. so yeah, your interrupt is still 36Khz... i just toggle the pin..
I tend to stay away of ON INTERRUPT when i need accuracy. ASM is the best while DT INST with PBP is still good enough for many purpose.
Bookmarks