nRF5 SDK v17.1.0
Real Time Counter Example

The Real Time Counter Example enables the real-time clock (RTC) with a TICK frequency of 8 Hz. It also configures and enables the TICK- and the COMPARE0-interrupts. The compare interrupt handler is triggered three seconds after the RTC starts. The TICK interrupt handler clears the interrupt request and toggles PIN8 (LED 1). The COMPARE0 handler clears the interrupt request and sets PIN9 (LED 2) to 1.

The application starts with configuring the GPIO and starting the internal low frequency clock oscillator (LFCLK XTAL oscillator). The RTC is configured with TICK for 8 Hz and COMPARE0 to 3 seconds.

Setup

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\peripheral\rtc

LED assignments:

Testing

Test the Real Time Counter Example application by performing the following steps:

  1. Compile and program the application.
  2. Observe that LED 1 toggles at the rate of 8 Hz.
  3. After 3 seconds, LED 2 turns on.

Documentation feedback | Developer Zone | Subscribe | Updated