In example of peripheral RTC,
It compares time of 3UL.
BUT I've never heard about any measurement of UL... How can i transform it to second???
In example of peripheral RTC,
It compares time of 3UL.
BUT I've never heard about any measurement of UL... How can i transform it to second???
Hi Daniel,
The ending UL is a way to specify that a constant in C is of type Unsigned Long. The conversion to seconds will depend on the RTC settings. In the RTC example in the SDK, the prescaler is set to 4095. The frequency of the RTC is given by the function:
f_RTC [kHz] = 32.768 / (PRESCALER + 1 )
This gives a frequency of 8 Hz with a prescaler of 4095. If you look in the RTC example, the interrupt trigger is set (using the function nrf_drv_rtc_cc_set()
) on the compare event given by COMPARE_COUNTERTIME * 8
. This indicated that COMPARE_COUNTERTIME
is actually given in seconds, so you can simply change 3 into whatever amount of seconds you want to use.
Best regars,
Jørgen