??? 03/04/05 06:44 Read: times |
#89074 - But wait, there's more! Responding to: ???'s previous message |
I read this after I gave my 'one method' response. I normally do downcounters rather than upcounters. At a guess, I dare say you upcounter rolls over to 0 every 256 ticks (if it is an unsigned char) The way I would normally do a timeout counter is: unsigned char timeout; if (timeout) { timeout--; } else { //timed out } This way the timeout can never 'roll over' - it goes to zero and stops. The main reson to count down is that most if not all cpu's can detect 0 very easily. Detecting a certain value requires a compare or subtraction. |
Topic | Author | Date |
Clearing the display... | 01/01/70 00:00 | |
Infinite loops | 01/01/70 00:00 | |
SLOWEST speed ? | 01/01/70 00:00 | |
Andy / Steve.. | 01/01/70 00:00 | |
But wait, there's more! | 01/01/70 00:00 | |
One method.. | 01/01/70 00:00 | |
A way to implement a simple ramp down![]() | 01/01/70 00:00 |