> At 02:44 AM 7/11/2009, Heinz Czychun wrote: > >Hi, > > I'm having a little problem with controlling Timer 0 and Timer 1 > >interrupts separately, on a PIC12F675. > > > > With Timer 1 disabled I'm able to control Timer 0 effectively > >with the INTCON,T0IE bit. Off and on. But when I enable Timer 1, > >Timer 0 also starts up and starts interrupting the processor. > = > I see a couple of things worth looking at: > = > movlw b'10100000' > > ; 1------- (GIE)1=3Dinterrupts enabled > > ; -0------ (PEIE)1=3Denable peripheral interrupts > > ; --1----- (T0IE)0=3Ddisable TMR0 overflow > = > 1) You say in the line above that "0 disables TMR0 overflow" but you = > are setting to be a "1". Check to make sure that it really is a "0". > = > 2) Do NOT check T0IF within your Interrupt Service Routine if you = > aren't using it! Here's why: T0IF will ALWAYS become set each and = > every time TMR0 rolls over from 0xFF to 0x00. However, if T0IE isn't = > set, it won't cause an interrupt. > = > If you check T0IF, you will most likely find that it is = > set. However, that's NOT what caused the interrupt if T0IE has not = > been enabled (=3D1). > = > Hope this helps! > = > dwayne > = On a similar problem I just couldn't figure out why all of a sudden SLEEP w= oke = up at once when it was supposed to be woken up by the WDT after about 18ms.= It = turned out to be that I had enabled timer0 to make interrupts (TOIE=3D1 GIE= =3D1) = and I just cleared GIE when done before going to sleep thinking that since = timer0 isn't running while at sleep anyway I didn't need to care about TOIE= . = However, timer0 did roll over after I cleared GIE but before going into sle= ep. = This didn't generate an interrupt but since the TOIF flag got set, sleep ex= ited = at once. = This was clearly explained in figure 9-10 in the datasheet. = /Ruben =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Ruben J=F6nsson AB Liros Electronic Box 9124, 200 39 Malm=F6, Sweden TEL INT +46 40142078 FAX INT +46 40947388 ruben@pp.sbbs.se =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist