Skip to content

microchip-pic-avr-examples/atmega4809-adc-basics-mplab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microchip Technologies Inc.

ATmega4809 Xplained Pro ADC Basics

MegaAVR® 0-series devices feature a 10-bit Successive Approximation Register (SAR) Analog-to-Digital Converter (ADC) capable of conversion rates up to 115 ksps. It features a flexible multiplexer, which allows the ADC to measure the voltage at multiple single-ended input pins.

There are four modes we will explore in this example:

  • ADC Free-Running mode
  • ADC Single Conversion mode
  • ADC Window Comparator mode
  • ADC Sample Accumulator mode

This is an example of how to get started with the ADC on the ATmega4809. This is based on the application note AN2573.

Related Documentation

Software Used

Hardware Used

Setup

  • Port PD6 is the ADC channel input. Connect a cable here to interact with the ADC.


Operation

  1. Download the zip file or clone the example to get the source code.
  2. Open atmega4809-adc-basics-mplab.X in MPLAB.
  3. Connect the ATmega4809 Xplained Pro to the computer with a micro USB cable.
  4. Make sure the kit is selected as the tool to be programmed under project settings.
  5. Press the Make and Program button to program the device.
  6. Open the desired terminal application or Data Visualizer and access the serial port associated with the Xplained Pro.

The AN2573 application note shows how to adjust the voltage level of the ADC input port, and the corresponding approximated value will be displayed via UART using the Data Visualizer.

Conclusion

We have here shown how to set up and get started with the ADC basics project. For further information about this example and the functionality of the ADC, refer to the AN2573 application note.