3.5 SDADC Example

This document is accompanied by the following example firmware.

  • sdadc_conversion_polling: Demonstrates the SDADC conversion in polling mode.
  • sdadc_conversion_interrupt: Demonstrates the SDADC conversion in interrupt mode.

Requirements

Description

The example firmware initializes the SDADC on the SAMC21N Xplained Pro board to use Input Channel one. This is a differential measurement, therefore ensure that both the positive (INP) and negative (INN) pins are connected to a voltage source. The firmware also initializes the USART to communicate with a terminal program through the on-board EDBG Virtual COM port. Settings are 115200, 8, N, 1.

Figure 3-5. SAMC21N Xplained Pro Evaluation Kit

The SDADC is configured to use the internal VREF, and the range is set to 4.096V full scale and the default setting of the OSR is 64.

Pressing the ‘r’ key will read the result and display it in a form scaled to mV.

Figure 3-6. Output Displayed on Terminal Window