diff --git a/.main-meta/main.json b/.main-meta/main.json index ad405ac..7d5e5cc 100644 --- a/.main-meta/main.json +++ b/.main-meta/main.json @@ -2,29 +2,29 @@ "metaDataVersion": "1.0.0", "category": "com.microchip.ide.project", "content": { - "metaDataVersion": "1.1.0", + "metaDataVersion": "1.3.0", "name": "com.microchip.mcu8.mplabx.project.avr128da48-cnano-adc-temperature-measurement-mplab", - "version": "1.0.1", - "displayName": "ADC Temperature Measurement", + "version": "1.0.2", + "displayName": "Analog-to-Digital Converter (ADC) - Temperature Measurement Using AVR128DA48 Microcontroller", "projectName": "avr128da48-cnano-adc-temperature-measurement-mplab", "shortDescription": "This application showcases a basic example of how to measure the temperature using the ADC on the AVR-DA devices.", "ide": { "name": "MPLAB X", - "semverRange": ">=5.40.0" + "semverRange": ">=6.15.0" }, "compiler": [ { "name": "XC8", - "semverRange": "^2.20.0" + "semverRange": "^2.45.0" } ], "dfp": { "name": "AVR-Dx_DFP", - "semverRange": "^1.4.75" + "semverRange": "^2.3.272" }, "configurator": { "name": "N/A", - "semverRange": "" + "semverRange": " " }, "device": { "metaDataVersion": "1.0.0", @@ -37,18 +37,11 @@ } }, "author": "Microchip", - "subcategories": [ - [ - "Peripherals", - "ADC" - ] - ], "peripherals": [ "ADC" ], "keywords": [ - "Temperature", - "C programming" + "Temperature", "C programming", "ADC", "Getting Started" ], "additionalData": { "longDescription": { diff --git a/README.md b/README.md index 932d5e5..1fd24e1 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,40 @@ -
-

MCHP

+ -# AVR128DA48 ADC Temperature Measurement +MCHP + +# Analog-to-Digital Converter (ADC) - Temperature Measurement Using AVR128DA48 Microcontroller ## Objective -In this application, the ADC will be used to measure the temperature, and the results will be transmitted through USART. -The software diagram of this application is presented in the figure below. -
+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/Asynchronous Receiver/Transmitter (USART). The software's example code diagram is presented in the figure below. ## Related Documentation +More details and code examples on the AVR128DA48 can be found at the following links: + +- [AVR128DA48 Product Page](https://www.microchip.com/wwwproducts/en/AVR128DA48) +- [AVR128DA48 Code Examples on GitHub](https://github.com/microchip-pic-avr-examples?q=avr128da48) - [Using 12-Bit ADC for Conversions, Accumulation, and Triggering Events](https://www.microchip.com/wwwappnotes/appnotes.aspx?appnote=en1001530) -- [AVR128DA48 Product Family Page](https://www.microchip.com/design-centers/8-bit/avr-mcus/device-selection/avr-da) -- [AVR128DA48 Data Sheet](http://ww1.microchip.com/downloads/en/DeviceDoc/40002183A.pdf) ## Software Used -- MPLAB® X IDE 5.40 or newer [(microchip.com/mplab/mplab-x-ide)](http://www.microchip.com/mplab/mplab-x-ide) -- MPLAB® XC8 2.20 or newer compiler [(microchip.com/mplab/compilers)](http://www.microchip.com/mplab/compilers) -- MPLAB® Data Visualizer plugin 1.1 -- AVR-Dx_DFP 1.4.75 +- [MPLAB® X IDE](http://www.microchip.com/mplab/mplab-x-ide) v6.15 or newer +- [MPLAB® XC8](http://www.microchip.com/mplab/compilers) v2.45 or newer +- [AVR-Dx Series Device Pack](https://packs.download.microchip.com/) v2.3.272 or newer +- [MPLAB® Data Visualizer](https://www.microchip.com/en-us/tools-resources/debug/mplab-data-visualizer) ## Hardware Used -- AVR128DA48 Curiosity Nano [(DM164151)](https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/DM164151) -- Curiosity Nano Base for Click boards™ [(AC164162)](https://www.microchip.com/developmenttools/ProductDetails/AC164162) +- [AVR128DA48 Curiosity Nano Development board](https://www.microchip.com/en-us/development-tool/DM164151) is used as a test platform. +
+ +## 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](#how-to-program-the-curiosity-nano-board) chapter.

## Setup -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 AVR128DA48 Curiosity Nano Development Board is used as the test platform. The internal temperature sensor is used for measurements as input of the ADC.
The following configurations must be made: @@ -37,42 +42,84 @@ The AVR128DA48 Curiosity Nano Development Board is used as the test platform. To | :----------: | :----------------: | |PC0 (TX) | Digital Output | -## Operation +## Demo -1. Connect the board to the PC. +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 below picture. Follow the steps in the **[How to use MPLAB Data Visualizer](#how-to-use-mplab-data-visualizer)** section to set up the Data Visualizer so that it can correctly view the plotted values through USART. -2. Open the *avr128da48-cnano-adc-temperature-measurement-mplab.X* project in MPLAB® X IDE. +
Demo -3. Set *avr128da48-cnano-adc-temperature-measurement-mplab.X* project as main project. Right click on the project in the *Projects* tab and click *Set as Main Project*: - -
- -4. 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*: - -
- -5. Program the project to the board: right click on the project and click *Make and Program Device*: - -
- -6. Open the Data Visualizer -
- - From the Curiosity Nano COMn port, open the drop down list: -
- - From the drop down list, select New variable streamer...: -
- - 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: -
- -Result: - -After alternatively cooling and warming up the microcontroller (after starting the application), the ADC result will be plotted on the graph: -
Demo +**Note:** The plotted variable called ```ADC_value``` must be configured as ```int16``` type. ## Summary -This application showcases a basic example of how to measure the temperature using the ADC on the AVR-DA devices. \ No newline at end of file +This application showcases a basic example of how to measure the temperature using the ADC on the AVR-DA devices. + +## How to use 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. + +
+ +2. 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** + +
+ +3. 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 +- [Back to Top](#analog-to-digital-converter-adc---temperature-measurement-using-avr128da48-microcontroller) +- [Back to Related Documentation](#related-documentation) +- [Back to Software Used](#software-used) +- [Back to Hardware Used](#hardware-used) +- [Back to Operation](#operation) +- [Back to Setup](#setup) +- [Back to Demo](#demo) +- [Back to Summary](#summary) \ No newline at end of file diff --git a/avr128da48-cnano-adc-temperature-measurement-mplab.X/main.c b/avr128da48-cnano-adc-temperature-measurement-mplab.X/main.c index 1f278b7..30f2391 100644 --- a/avr128da48-cnano-adc-temperature-measurement-mplab.X/main.c +++ b/avr128da48-cnano-adc-temperature-measurement-mplab.X/main.c @@ -47,8 +47,8 @@ void USART1_Write(const uint8_t data); /* This function initializes the CLKCTRL module */ void CLKCTRL_init(void) { - /* FREQSEL 4M */ - ccp_write_io((void*)&(CLKCTRL.OSCHFCTRLA), (CLKCTRL.OSCHFCTRLA | CLKCTRL_FREQSEL_4M_gc)); + /* FRQSEL 4M */ + ccp_write_io((void*)&(CLKCTRL.OSCHFCTRLA), (CLKCTRL.OSCHFCTRLA | CLKCTRL_FRQSEL_4M_gc)); } /* This function initializes the PORT module */ diff --git a/avr128da48-cnano-adc-temperature-measurement-mplab.X/nbproject/configurations.xml b/avr128da48-cnano-adc-temperature-measurement-mplab.X/nbproject/configurations.xml index 5347a94..44a5265 100644 --- a/avr128da48-cnano-adc-temperature-measurement-mplab.X/nbproject/configurations.xml +++ b/avr128da48-cnano-adc-temperature-measurement-mplab.X/nbproject/configurations.xml @@ -30,11 +30,11 @@ nEdbgTool XC8 - 2.20 + 2.45 3 - + @@ -55,6 +55,7 @@ false + false false @@ -86,9 +87,9 @@ - + @@ -142,34 +143,23 @@ - - - - - - - - - - - - - - - - - - + + + + + + + @@ -201,6 +191,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -211,11 +270,11 @@ nEdbgTool XC8 - 2.20 + 2.45 3 - + @@ -236,6 +295,7 @@ false + false false @@ -267,9 +327,9 @@ - + @@ -323,34 +383,23 @@ - - - - - - - - - - - - - - - - - - + + + + + + + @@ -382,6 +431,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/0_0.png b/images/0_0.png deleted file mode 100644 index 22c64ad..0000000 Binary files a/images/0_0.png and /dev/null differ diff --git a/images/0_1.png b/images/0_1.png deleted file mode 100644 index d0c9835..0000000 Binary files a/images/0_1.png and /dev/null differ diff --git a/images/0_2.png b/images/0_2.png deleted file mode 100644 index 0d4f960..0000000 Binary files a/images/0_2.png and /dev/null differ diff --git a/images/0_3.png b/images/0_3.png deleted file mode 100644 index 01554ac..0000000 Binary files a/images/0_3.png and /dev/null differ diff --git a/images/1.png b/images/1.png deleted file mode 100644 index 0e9ae94..0000000 Binary files a/images/1.png and /dev/null differ diff --git a/images/2.png b/images/2.png deleted file mode 100644 index 5cdbe6d..0000000 Binary files a/images/2.png and /dev/null differ diff --git a/images/3.png b/images/3.png deleted file mode 100644 index e382b4a..0000000 Binary files a/images/3.png and /dev/null differ diff --git a/images/4.png b/images/4.png deleted file mode 100644 index 947c5e9..0000000 Binary files a/images/4.png and /dev/null differ diff --git a/images/5.png b/images/5.png deleted file mode 100644 index c5bf58d..0000000 Binary files a/images/5.png and /dev/null differ diff --git a/images/AVR128DA48_CNANO_instructions.png b/images/AVR128DA48_CNANO_instructions.png new file mode 100644 index 0000000..456af4d Binary files /dev/null and b/images/AVR128DA48_CNANO_instructions.png differ diff --git a/images/data_visualizer_button.png b/images/data_visualizer_button.png new file mode 100644 index 0000000..eaecde1 Binary files /dev/null and b/images/data_visualizer_button.png differ diff --git a/images/data_visualizer_data.png b/images/data_visualizer_data.png new file mode 100644 index 0000000..f1442a4 Binary files /dev/null and b/images/data_visualizer_data.png differ diff --git a/images/data_visualizer_ramp.png b/images/data_visualizer_ramp.png new file mode 100644 index 0000000..bf02764 Binary files /dev/null and b/images/data_visualizer_ramp.png differ diff --git a/images/plot_streaming_data.png b/images/plot_streaming_data.png new file mode 100644 index 0000000..b29a107 Binary files /dev/null and b/images/plot_streaming_data.png differ diff --git a/images/program_clean_and_build.png b/images/program_clean_and_build.png new file mode 100644 index 0000000..dcb6086 Binary files /dev/null and b/images/program_clean_and_build.png differ diff --git a/images/program_make_and_program_device.png b/images/program_make_and_program_device.png new file mode 100644 index 0000000..b271650 Binary files /dev/null and b/images/program_make_and_program_device.png differ diff --git a/images/program_set_as_main_project.png b/images/program_set_as_main_project.png new file mode 100644 index 0000000..067f324 Binary files /dev/null and b/images/program_set_as_main_project.png differ diff --git a/images/program_tool_selection.png b/images/program_tool_selection.png new file mode 100644 index 0000000..fa77134 Binary files /dev/null and b/images/program_tool_selection.png differ