In this application, the ADC will accumulate samples, 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.
- AVR128DA48 Data Sheet
- AVR128DA48 Product Family Page
- Using 12-Bit ADC for Conversions, Accumulation, and Triggering Events
- MPLAB® X IDE v6.15 or newer
- MPLAB® XC8 v2.45 or newer
- MPLAB® Data Visualizer v1.3.1332 or newer
- AVR-Dx Device Family Pack v2.3.272 or newer
-
AVR128DA48 Curiosity Nano Development Board is used as test platform:
-
POT CLICK board (mikroBUS socket 1):
The AVR128DA48 Curiosity Nano Development Board is used as a test platform. The Curiosity Nano Base for Click boards is used to integrate the POT Click board.
The following configurations must be made:
Pin | Configuration |
---|---|
PD3 (AIN3) | Analog Input |
PC0 (TX) | Digital Output |
To observe the results plotted on a graph, follow the steps provided in the How to Use the Data Visualizer chapter.
Rotate the Potentiometer on the POT Click board after starting the application, so that the ADC result will be plotted on the graph, as in the image below:
This application showcases the sample accumulator feature of the ADC.
This chapter shows how to use the MPLAB® X IDE to program an AVR® device with an Example_Project.X
. This can be applied for any other projects.
-
Connect the board to the PC.
-
Open the
Example_Project.X
project in MPLAB X IDE. -
Set the
Example_Project.X
project as main project:
Right click on the project in the Projects tab and click Set as Main Project. -
Clean and build the
Example_Project.X
project:
Right click on theExample_Project.X
project and select Clean and Build. -
Select AVRxxxxx Curiosity Nano in the Connected Hardware Tool section of the project settings:
Right click on the project and click Properties.
Click on the arrow under the Connected Hardware Tool.
Select the AVRxxxxx Curiosity Nano by clicking on the SN.
Click Apply and then OK. -
Program the project to the board:
Right click on the project and then Make and Program Device.
-
In the Curiosity Nano COMn tab, click the Source options button and set the Baud Rate:
-
Configure the Variable Streamer Name and add the desired variable, then click Next:
-
Select all the variables to plot, select New axis per data type, and click Finish: