In this application, the ADC will accumulate samples, and then the result will be divided by the number of samples and transmitted through USART.
The software diagram of this application is presented in the figure below.
- Using 12-Bit ADC for Conversions, Accumulation, and Triggering Events
- AVR128DA48 Product Family Page
- AVR128DA48 Data Sheet
- MPLAB® X IDE 5.40 or newer (microchip.com/mplab/mplab-x-ide)
- MPLAB® XC8 2.20 or newer compiler (microchip.com/mplab/compilers)
- MPLAB® Data Visualizer plugin 1.1
- AVR-Dx_DFP 1.4.75
- AVR128DA48 Curiosity Nano (DM164151)
- Curiosity Nano Base for Click boards™ (AC164162)
- One POT click board
The AVR128DA48 Curiosity Nano Development Board is used as the test platform. To integrate the POT Click board, the Curiosity Nano Base for Click boards is used.
The following configurations must be made:
Pin | Configuration |
---|---|
PD3 (AIN3) | Analog Input |
PC0 (TX) | Digital Output |
-
Connect the board to the PC.
-
Open the avr128da48-cnano-adc-sample-accumulator-mplab.X project in MPLAB® X IDE.
-
Set avr128da48-cnano-adc-sample-accumulator-mplab.X project as main project. Right click on the project in the Projects tab and click Set as Main Project:
- Select the AVR128DA48 Curiosity Nano in the Connected Hardware Tool drop down list of the project settings:
- Right click on the project and click Properties;
- Select the AVR128DA48 Curiosity Nano (click on the SN) in the Connected Hardware Tool list and then click OK:
- Program the project to the board: right click on the project and click Make and Program Device:
Result:
Rotating the Potentiometer on the POT click board (after starting the application), the ADC result will be plotted on the graph:
This application showcases the sample accumulator feature of the ADC.