Could it be as simple as: One timer period on, one period off? That would divide your 15 Hz down to 7.5. And then there is the timer prescaller... Rodrigo Valladares P wrote: >Hi all. > >i have a little circuit that i expect a 15 hz cycle, but it oscillate at >about 3hz (eye-measured) > >fosc = 4MHz (internal oscillator) so, >fosc / 4 = 1MHz >1MHz / 65536 = 15hz > >what is wrong?, this is my first interrup circuit :( is fosc really 4 >MHz / 4 / 4 ?? > >thanks in advance > >RVP > >this is a mikrobasic code > >dim counter as byte > >sub procedure interrupt > if PIR1.TMR1IF <> 0 then > inc(counter) > PIR1.TMR1IF = 0 > end if >end sub > >main: > > while TRUE ' Endless loop > TRISB = 0 ' Configure pins of PORTB as output > counter = 0 ' > > INTCON = 0 > > T1CON.T1CKPS1 = 0 > T1CON.T1CKPS0 = 0 ' preescaler 1:1 > > T1CON.T1OSCEN = 0 ' osc shut down > T1CON.NOT_T1SYNC = 1 ' not needed? > > T1CON.TMR1CS = 0 ' internal clock fosc/4 > T1CON.TMR1ON = 1 ' enable timer > > PIE1.TMR1IE = 1 ' enable overflow interrupt > > INTCON.PEIE = 1 ' enable peripheral interrupt > INTCON.GIE = 1 ' enable global interrupt > > while true > > PORTB = counter > > wend > wend > > > > > > > -- * | __O Thomas C. Sefranek WA1RHP@ARRL.net |_-\<,_ Amateur Radio Operator: WA1RHP (*)/ (*) Bicycle mobile on 145.41, 448.625 MHz http://hamradio.cmcorp.com/inventory/Inventory.html http://www.harvardrepeater.org -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist