> What I'm trying to do is creating 1s interrupt on the background > with Timer0, I have set Timer0 to B2 and I need a counter for it First you need to do some maths ....... 20MHz crystal =3D 5MHz execution frequency Therefore you need to have a counter for 5,000,000 cycles for 1s or 5000 cycles for 1ms Assuming you don't use a 1:64 scaler - The interrupt can include a conditional, so that it processes Timer0 IRQs as well as does what you want after 1s For example, a 1ms interrupt counter done 1000 times 5000/256 =3D 19.53125, ie 19 counts of 0-255 and 1 of 136 Load Timer0 with 120 (ie -136) Load counter1 with 20 Load counter2 with 0x18 (low byte of -1000) Load counter3 with 0xfc (high byte of -1000) Enable Timer0 interrupts Start Timer0 In the ISR, something like this (untested) Note that loading Timer0 whilst it is running introduces jitter. That is, I think, you may need to reload with 122 rather than 120 because the decfsz has taken 2 cycles (it's late and I've done enough thinking today ;-)) ) decfsz counter1 ;count Timer0 interrupts goto exit ;not finished movlw .120 ;reload Timer0 movwf timer0 clrf counter1 ;reset rollover counter ;count from -1000 to 0 incfsz counter2 ;increment low counter goto exit ;<> 0 incfsz counter3 ;increment high counter goto exit ;<> 0 ;both counter2 and counter3 are 00 movlw 0x18 ;reload 1000 counter movwf counter2 movlw 0xfc movwf counter3 do the 1s thing exit retfie The first time through, the 136 is taken care of, then another 19 counts of 256, until counter1 =3D 0, looped 1000 times until counters 2 and 3 are 0, the 1s thing is done and the whole loop starts again Substitute -100 or -10 for 100ms and 10ms etc If you use a 19.660800MHz crystal then you can simply let Timer0 run without reloading, because 19660800 is divisible evenly by 256 and more 19.660800/4 =3D 4.915200MHz execution frequency 4915200 / 256 =3D 19200, 19200 / 64 =3D 300 4915200 / 65536 =3D 75 Joe --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .