nRF51 SDK - S120 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
PWM Analyzer Example

This PWM Analyzer Example uses Timer 1 to read the duty cycle from an input pin and outputs it on the output port 1 with the duty cycle value from 0 to 255. Pin 0 (Button 0) is used as the input pin, and the output value is outputted to the LEDs. It uses the hardware delivered in the nRF51822 Development Kit.

The application starts with configuring the GPIOTE, setting inputs and outputs, enable interrupt on event, and configuring events to the input pin. The PPI peripheral is configured to capture the Timer 1 value into CC[0] and CC[1] registers at high-to-low and low-to-high transitions, respectively. Timer 1 is configured and enabled, and the GPIOTE interrupt is enabled.

Setup

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

LED assignments:

  • LED 0-7 is used to show the 8 bit duty cycle value.

Button assignments:

  • Button 0 is used as input for the duty cycle measurement.

Testing

The PWM Analyzer Example Application can be tested as follows:

  1. Compile and program the application.
  2. Press button 0 and observe that the LEDs output some value.