??? 06/16/09 21:30 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#166162 - Timers usable without start/stop too Responding to: ???'s previous message |
It isn't just changes of optimization levels that are dangerous.
It is enough that the compiler decides to change the allocation of register variables and local variables. On another note. You don't have to start/stop a timer to use it for timing. I often use a free-running timer. It may have an interrupt handler ticking every 1ms or 10ms or whatever. But I can also let a software delay read out the current value and then wait until it has ticked a specific number of steps or a specific number of turn-arounds or whatever is applicable. Quite often, you can make a single timer do a lot of things, if you just plan ahead. And all software development is about planning ahead. What hardware you have. What problems you need to solve. What possible mappings you can do between hardware and problems. For a beginner, it may be better to get a library function that creates a variable ticked every 10ms for all the possibly hundreds of actions the main loop has to keep track of. |