nRF51 SDK - S120 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Real-time Clock Example

The Real Time Counter Example enables the RTC with a TICK frequency of 8Hz. It also configures and enables the TICK- and the COMPARE0-interrupts. The compare interrupt handler will be triggered 3 seconds after the RTC starts. The TICK interrupt handler clears the interrupt request and toggles PIN8 (LED 0). The COMPARE0 handler clears the interrupt request an set PIN9 (LED 1) 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 8Hz and COMPARE0 to 3 sec.

Setup

Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).

LED assignments:

  • LED 0 is used to show the 8Hz tick.
  • LED 1 is used to show the COMPARE0 event.

Testing

The Real Time Counter Example Application can be tested as follows:

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