??? 10/18/06 12:38 Read: times |
#126646 - it still applies Responding to: ???'s previous message |
I know that everyone says, "Keep your ISRs simple." That is good advice most of the time. In this case, however, you need to step the motor inside the ISR in order to time the motor step pulses precisely.
it still applies. While I totally agree with Russ that you should move the stepping inside the ISR, the rule "short and simple" still applies. Yes, there are exceptions where you need to do more inside an ISR than you "want to" but there the "short and simple" apply even more. When you have no other way than to process something inside an ISR you need to CAREFULLY evaluate EVERY step and evaluate if you can make that step less CPU time consuming. I have seen examples where something that "had to" be moved inside an ISR was done so with floats, long divides and what not. that is NOT the way to do it. When processing inmside an ISR (which should be avoided if possible) the rule changes to "as short and as simple as possible" not just "move the code in". Erik |