Try this in the int handler
TC0 += PERIOD ;
and
TC0 = TCNT + PERIOD;
When you init it.
Also, you don't need
TFLG1 = 0x01;
in the hander - writing to TC0 clears and rearms the int.
Try something less than FFFF for the period.
Not sure if that will cause a problem, but it might.
If you need longer periods, use a sub counter like:
int subCntr; // global scope
(in the int handler)
++subCntr;
if( subCntr == 100 ) // pick a number that gives you the desired delay.
{
// write to the leds or what ever.
subCntr = 0;
}
(rest of handler)
Message Edited by JimDon on 2007-02-0608:20 PM
Message Edited by JimDon on 2007-02-0608:22 PM