But I was thinking at the end of my timer routine I could set the timer value to 6, so that it would only count 250 times before it overflows (rather than 256), giving an interrupt every 0.0005 seconds.
So, that would certainly help make my maths easier. But is it good practice? Are there any side effects I have not considered.
But I was thinking at the end of my timer routine I could set the timer value to 6, so that it would only count 250 times before it overflows (rather than 256), giving an interrupt every 0.0005 seconds.
So, that would certainly help make my maths easier. But is it good practice? Are there any side effects I have not considered.
You don't say which timer you're using?, but it's common practice to do this. However, if you use a more modern timer, such as timer2, you can set it far more easily anyway (as you can preset it's trigger value). Don't mess with the ancient timer0, where you have to bodge round it!.