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

delay by timer

i want make delay funtion by timer?

in the other MCU like PIC, AVR, stm. i find register that hold value counter and i cant set this value for example: timer 8 bit will count to 256 and i set value =100 to every tick it increased to 256 overflow and make a period delay.

thanks.

Parents
  • Hello phanhust

    On the nRF51822 you have 3 timer modules which run on the HFCLK, and the RTC (real time counter) which runs on the LFCLK.

    When using the SoftDevice the first timer module, TIMER0 is controlled by the SoftDevice and is off limits for the application. Due to the timer modules using the HFCLK the current consumption while using them is considerable, and they should only be used for cases where high timing accuracy is needed. For use-cases with lower accuracy requirements, you can use the RTC which has much lower current consumption. Most examples in the SDK uses the timer library, which employs the RTC.

    You can read more about the Timer modules on page 33 and 62 of the nRF51822 product specification, and page 99 of the nRF51 series Reference manual.

    You can read about the RTC on page 33 and 62 of the product specification and page 103 of the reference manual.

    You can read about the timer library here.

    You can find examples for both the RTC and the timer modules in the examples\peripheral folder in the SDK, and you can find documentation for the examples on the infocenter (The provided link is for SDK12.3).

    Best regards

    Jørn Frøysa

  • The SoftDevice uses the LFCLK in its timings, so the it will already be initialized if you have enabled the SoftDevice which will lead to an error in the APP_ERROR_CHECK() macro.

Reply Children
No Data
Related