This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Delay Generation Using timer interrupt

Hi All,

   Currently in  my project i'm using hard core delay and delay is custom i.e some places i have used millisecond and in some places used microsecond and in sec.But i wanted to generate delay using timer interrupt.Can anyone tell me how to generate delay?

Thanks in Advance

  • Hi, 

    I am not sure that I understand your question.

    You will either have to use nrf_delay.h by using nrf_delay_us(), which will work as long as you don't need exact timing and the code is not interrupted (in which case it will be that that much longer).

    You can use an RTC for this, but one is taken by the softdevice and the other by the app_timer module, so that might not work for you.

    Then the last option is to use a TIMER, for instance look a the \examples\peripheral\timer\ in the SDK, then you can use the nrf_drv_timer_us_to_ticks() to set the time until expire.

    Best regards,

    Amanda

Related