Never used interupts...but its time. Similar to another post of using TMR= 0, where he wants to use a 4MHz clock (giving a 1MHz or 1uS state time) and = time for 1 second, I need to do a similar thing. But I think the math is off,= because if you use a /256 on the prescaler thats 256uS per tic for TMR0, = and you can only have a max of 256 tic for TMR0 before it rolls over thats 65,536us (a bit short of 1000000us for 1 second). Now the purpose of my application is to generate a 1 second rate for several timers. I could d= o a simple loop where I just delay and the decrement the count for the other timers, but I need to have several timers running in parallel. Since I can't generate a 1 second interupt (could change the clock but th= en we get into custom crystals as well) I figure that I set TMR0 to a value of = 159 (decimal) and the prescale to 256. This would give me pretty close to a quarter second for the interupt. Thus when vectoring to the interupt, it= would reload the value to TMR0, decrement a QTRCNT value, check for zero.= If zero, that means 4 quarter seconds passed and thus one second....THEN....= I can decrement all my other timers...sounds simple? Not sure..how the interupt= s need to be set up and all that. My init code has this: ; set up TIMER0 for interupt vector for every quarter second movlw 0x07 movwf OPTION_REG movlw 0xA0 movwf INTCON ; set interupt for TMR0 movlw 0x9E ; intial set for overflow value movwf TMR0 ; to be reloaded on each interupt movlw 0x04 ; for 4 quarter seconds movwf QTRCNT = Then...for the interupt.... org 0x004 ; interupt vector movlw 0x9E ; intial set for overflow value movwf TMR0 ; to be reloaded on each interupt decfsz QTRCNT,1 goto NOTZ movlw 0x04 movwf QTRCNT ; we reached the count so reload < decrement all the counters etc> bsf INTCON, GIE ; enable interupts again retfie NOTZ: = ; bsf PORTC,0 bsf INTCON, GIE ; enable interupts again retfie Comments? Again, thanks for all the help on this list. = ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=3D= 1 -- http://www.piclist.com hint: PICList Posts must start with ONE topic: "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads