Analog-to-Digital Converter (ADC) - Temperature Measurement Using AVR128DA48 Microcontroller
 
 
Go to file
Teodor-Emilian Petre 7171f8cbef MPAE-16532: Small fix in readme 2023-09-12 15:29:21 +03:00
.citd MCU8QA-467 added new CICD files 2021-03-31 12:51:43 +05:30
.main-meta MPAE-16532: Code and readme updates 2023-09-11 16:42:21 +03:00
avr128da48-cnano-adc-temperature-measurement-mplab.X MPAE-16532: Code and readme updates 2023-09-11 16:42:21 +03:00
images MPAE-16532: Code and readme updates 2023-09-11 16:46:37 +03:00
.gitignore MCU8QA-162 added new CICD files 2020-07-21 13:01:09 +05:30
README.md MPAE-16532: Small fix in readme 2023-09-12 15:29:21 +03:00

README.md

MCHP

Analog-to-Digital Converter (ADC) - Temperature Measurement Using AVR128DA48 Microcontroller

In this application, the ADC will be used to measure the temperature using the on-board specific sensor, and the results will be transmitted through Universal Synchronous and Asynchronous Receiver and Transmitter (USART). The software's example code diagram is presented in the figure below.

More details and code examples on the AVR128DA48 can be found at the following links:

Software Used

Hardware Used

Operation

To program the Curiosity Nano board with this MPLAB X project, follow the steps provided in the How to Program the Curiosity Nano Board chapter.

Setup

As an input of the ADC, the internal temperature sensor is used for measurements.
The following pin configuration must be made for this project:

Pin Configuration
PC0 (TX) Digital Output

Demo

After alternatively cooling and warming up the microcontroller, the converted sensor's temperature from the ADC result will be plotted on the graph from Data Visualizer plugin, as in picture below. Follow the steps in the How to Use the MPLAB Data Visualizer section to set up the Data Visualizer, so that it can accurately view the plotted values through USART.


Demo

Note: The plotted variable called ADC_result on the Data Visualiser plugin must be configured as int16 type.

Summary

This application showcases how the AVR-DA devices measure the temperature using the ADC.

How to Use the MPLAB Data Visualizer

This section illustrates how to use the MPLAB X Data Visualizer to send commands and receive information, but prior to programming the AVR128DA48 Curiosity Nano Board. This can be applied to any other projects.

  1. Open the software terminal in MPLAB X IDE. Click on the Data Visualizer button.


  1. Prepare the settings in Data Visualizer.
  • Click on the specific serial port communication COMx
  • Set the correct Baud Rate
  • In the Connections tab, at the COMx option, press New variable streamer...
  • Type a specific Variable Streamer Name
  • Choose Ones' Complement from the Framing Mode dropdown menu
  • Type a specific value from the Start of Frame, press Add a variable
  • Type a specific name for the variable name in Variable Name
  • Press Next, after that press Next again
  • Optional: Save these settings as a json file by pressing Save as


  1. See the expected result on Data Visualizer.
  • Select Source from Time Plot window
  • Click Start Streaming COMx the communication serial port
  • Click Scroll axis automatically.


How to Program the Curiosity Nano board

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 the Example_Project.X project and select Clean and Build.
  • Select the 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 (click on the SN), click Apply and then click OK:
  • Program the project to the board.

    • Right click on the project and click Make and Program Device.


Menu