??? 07/21/05 06:25 Modified: 07/21/05 06:51 Read: times |
#97707 - Or simpler ... Responding to: ???'s previous message |
You need not enable Timer interrupt, only enable the Timer and check the Timer Interrupt Flag once in the loop:
Main(){ Initialize Start Timer, etc while (1){ if (TF0) { Clear TF0 Reload Timer register Call WalkFunctions() } Other things } }If you need a variable delay, then you take the reloading value as a variable. Remember that the delay is proportional to: 256 - reload value, or 65536 - value, if 2 byte timer is used. You can also express this as a negative char or integer, because for a char 256=0, and for integer 65536=0, did you know that ? As the timer counters are counting up, then it's clear why they should be reloaded this way. Slobodan |