I use sdk 15.3.0 / nrf52832 / SD_132.
How to use the prescaler of a timer for an event every 24 hours ?
An example will be very explicit.
Best regards, Jiemde
I use sdk 15.3.0 / nrf52832 / SD_132.
How to use the prescaler of a timer for an event every 24 hours ?
An example will be very explicit.
Best regards, Jiemde
Hi,
Have you seen the Timer documentation regarding prescaler options?
As you see from the prescaler register, you may at most set the timer prescaler to 2^9, which gives you 16M / 512 = 31250 ticks per second.
So, then we need to establish the size of our TIMER. We see that the different BITMODES available ranges from 8 to 32 bit.
Setting it to 32 bit gives us 4294967296 ticks til overflow, which with the 512 prescaler gives us ~36 hours till overflow.
Thus, you may set the timer to compare for the value 2700000000 - which is ticks per second times seconds in 24h.
You will now receive a COMPARE event every 24h. When this happens, you should remember to also CLEAR your timer - to avoid counting all the way to 36h before restarting at 0.
Is this what you were looking for?
Best regards,
Karl
Hi,
Have you seen the Timer documentation regarding prescaler options?
As you see from the prescaler register, you may at most set the timer prescaler to 2^9, which gives you 16M / 512 = 31250 ticks per second.
So, then we need to establish the size of our TIMER. We see that the different BITMODES available ranges from 8 to 32 bit.
Setting it to 32 bit gives us 4294967296 ticks til overflow, which with the 512 prescaler gives us ~36 hours till overflow.
Thus, you may set the timer to compare for the value 2700000000 - which is ticks per second times seconds in 24h.
You will now receive a COMPARE event every 24h. When this happens, you should remember to also CLEAR your timer - to avoid counting all the way to 36h before restarting at 0.
Is this what you were looking for?
Best regards,
Karl