nRF51 SDK - S130 SoftDevice
 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

The name of the example is rtc_pca10028. If you are not using the Keil Pack Installer, you can find the source code and 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.