Skip to content

Latest commit

 

History

History

ADC_HighLevelApp

page_type languages products name urlFragment extendedZipContent description
sample
c
azure
azure-sphere
Azure Sphere – ADC
ADC
path target
HardwareDefinitions
HardwareDefinitions
path target
.clang-format
.clang-format
path target
BUILD_INSTRUCTIONS.md
BUILD_INSTRUCTIONS.md
path target
Samples/SECURITY.md
SECURITY.md
path target
Samples/troubleshooting.md
troubleshooting.md
Demonstrates how to do analog-to-digital conversion on the MT3620 high-level core.

Sample: ADC high-level app

This sample application demonstrates how to do analog-to-digital conversion in a high-level application.

The application samples and displays the output from a simple variable voltage source once per second. It uses the MT3620 analog-to-digital converter (ADC) to sample the voltage.

The sample uses the following Azure Sphere libraries.

Library Purpose
adc Manages the analog-to-digital converters (ADCs).
eventloop Invokes handlers for timer events.
log Displays messages in the Device Output window during debugging.

Contents

File/folder Description
app_manifest.json Application manifest file, which describes the resources.
CMakeLists.txt CMake configuration file, which Contains the project information and is required for all builds.
CMakePresets.json CMake presets file, which contains the information to configure the CMake project.
launch.vs.json JSON file that tells Visual Studio how to deploy and debug the application.
LICENSE.txt The license for this sample application.
main.c Main C source code file.
README.md This README file.
.vscode Folder containing the JSON files that configure Visual Studio Code for deploying and debugging the application.
HardwareDefinitions Folder containing the hardware definition files for various Azure Sphere boards.

Prerequisites

The sample requires the following hardware:

Setup

  1. Ensure that your Azure Sphere device is connected to your computer, and your computer is connected to the internet.
  2. Ensure that you have Azure Sphere SDK version 24.03 or above. At the command prompt, run az sphere show-sdk-version to check. Upgrade the Azure Sphere SDK for Windows or Linux as needed.
  3. Ensure that the Azure CLI is installed. At a minimum, the Azure CLI version must be 2.45.0 or later.
  4. Install the Azure Sphere extension.
  5. Enable application development, if you have not already done so, by entering the az sphere device enable-development command at the command prompt.
  6. Clone the Azure Sphere samples repository and find the ADC_HighLevelApp sample in the ADC folder or download the zip file from the Microsoft samples browser.

Set up the ADC connections

  1. Connect MT3620 dev board pin H2.2 (GND) to an outer terminal of the potentiometer.
  2. Connect both pin 1 and pin 2 of jumper J1 to the other outer terminal of the potentiometer. This connects the MT3620 2.5 V output to the ADC VREF pin and to the potentiometer.
  3. Connect MT3620 dev board pin H2.11 (GPIO41 / ADC0) to the center terminal of the potentiometer.

ADC connections

Build and run the sample

To build and run this sample, follow the instructions in Build a sample application.

Test the sample

The ADC output is displayed in the output terminal or Device Output window during debugging. Adjust the potentiometer and observe that the displayed value changes, as shown in the following example output.

Show output from: Device Output
The out sample value is 2.500 V
The out sample value is 2.483 V
The out sample value is 2.337 V
The out sample value is 2.055 V

Next steps