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
- MPLAB X IDE version 6.20 or higher
- MPLAB X C32 Compiler v4.35 or higher
- MPLAB Code Configurator Plugin v5.4.1 or higher
- MPLAB Harmony v3 "csp" repo v3.18.2 or higher
- MPLAB Harmony v3 "dev_packs" repo v3.18.1 or higher
- SAMC21N Xplained Pro evaluation
kit
www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATSAMC21N-XPRO
- Stable Voltage Source to INN[1] and INP[1] pins, or PB08 and PB09
- Download the SDADC on SAMC MCU:
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.
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.