Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Per Westermark
03/24/09 02:35
Read: 1192 times
Sweden


 
#163815 - You do not
Responding to: ???'s previous message
You do not "calculate" any loop lengths. You make use of a timer. A timer will - besides running at a fixed and known speed - also take into account any time spent in interrupt handlers. A busy loop (C or assembler) will not know if any ISR has been active.

A timer can also allow longer delays to be handled while the processor spends time doing real work, such as processing received data on the serial port.

For short loops, you can do a busy-loop in assembler. But the busy loop will only guarantee a "minimum" delay, unless you run it with interrupts disabled.

List of 5 messages in thread
TopicAuthorDate
Delay loop in C Programming      Harrison Cheung      02/18/09 09:54      
   you can't        Erik Malund      02/18/09 09:59      
      Timer ticks        Per Westermark      02/18/09 10:28      
      It's IMPOSSIBLE - but here's how...      Andy Neil      02/18/09 10:30      
   You do not      Per Westermark      03/24/09 02:35      

Back to Subject List