nRF5 SDK v16.0.0
SAADC Example

The SAADC Example demonstrates the use of the analog-to-digital converter (SAADC) peripheral. It uses the SAADC driver.

The example initializes the TIMER driver to generate regular compare events. Also, it initializes the PPI driver and allocates one channel to propagate compare events from the TIMER to sample events of the SAADC.

The example initializes the SAADC driver and configures one channel to sample analog input 0 (GPIO pin 2). Once initialization is done, the example provides input buffers for converted samples to the driver and enables the PPI channel. When a buffer is filled, a driver callback is called, and the samples are printed on the console.

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

Testing

Test the SAADC Example application by performing the following steps:

  1. Compile and program the application.
  2. Start a terminal emulator like PuTTY and connect to the used COM port with the following UART settings:
    • Baud rate: 115.200
    • 8 data bits
    • 1 stop bit
    • No parity
    • HW flow control: None
  3. Check the output and observe that:
    1. After reset, basic information about the example is output on UART.
    2. When the example is running, the SAADC samples analog input 0 and outputs the result values on UART in groups of five. Shorten GPIO pin 2 with VCC or GND to see the changes in the results.

Documentation feedback | Developer Zone | Subscribe | Updated