| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
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:

- LED 1 is used to show the 8 Hz tick.
- LED 2 is used to show the COMPARE0 event.

# 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.