This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to generate delay in CPU?

Hello,

I am trying to generate delay in CPU. For instance after writing a register, I want to read it again after 1000ns. What should be the C code or the assembly code for the same?

Thank you

Nishank Bansal

Parents
  • Hello,

    For short delays (on the order of microseconds), you can use some Keil extensions to insert NOP instructions into your code.

    For slightly longer delays, you'll probably want to use a timer to measure the delay.

    For even longer delays, where you don't want to tie up the processor while waiting myaarpmedicare, you'll need a timer tick interrupt and some sort of software timer queue structure. The timer interrupt will signal the occurrence of an event (however that is to be done in your system) and set up the timer for the next event.

Reply
  • Hello,

    For short delays (on the order of microseconds), you can use some Keil extensions to insert NOP instructions into your code.

    For slightly longer delays, you'll probably want to use a timer to measure the delay.

    For even longer delays, where you don't want to tie up the processor while waiting myaarpmedicare, you'll need a timer tick interrupt and some sort of software timer queue structure. The timer interrupt will signal the occurrence of an event (however that is to be done in your system) and set up the timer for the next event.

Children
No data