If you're trying to use the internal clock (Fosc/4) for the TMR1 clock source, then you'll need T1CON = %00000001 VS T1CON = %00000011.
You'll also want to place DISABLE just prior to entering your int handler.
With ONINT you can do pretty much whatever you like in the int handler.
You can tinker with this code below. It's tested on a 16F627A @20MHz.Code:@ DEVICE HS_OSC,LVP_OFF,WDT_OFF,MCLR_OFF DEFINE OSC 16 ' Tested at 20 include "modedefs.bas" 'include serout defines Loops VAR WORD ' Loops value loops = 0 ' Start clear TRISB = %00000010 'All port b output except pin 1 (RX) is input INTCON = 0 PIR1 = $00 ' clear interupt flags serout 2, T2400, ["starting", 13, 10] ' Before interrupts are enabled TMR1H = $00 ' load timer1 with $00FF TMR1L = $FF T1CON = %00000001 ' TMR1 on, prescaler=1, clock=(Fosc/4) INTCON = $C0 ' Enable global and peripheral interupts PIE1 = $01 ' Enable TMR1 overflow interrupt on interrupt goto inthand loop: ' endless loop with 1 ms pause pause 1 goto loop DISABLE inthand: loops = loops + 1 ' increment counter of interrupts serout 2, T2400, ["loops = ", #loops, 13, 10] TMR1H = $00 ' load timer1 with $00FF TMR1L = $FF PIR1 = $00 ' clear interrupt flags RESUME ENABLE End




Bookmarks