Analog Comparator and Voltage Reference Example

This hands-on project demonstrates a simple example of analog comparator and reference voltage:
Bandgap reference as positive input (1.1V) and AIN1 as negative input. By wiring AIN1 (PD7) to Switch (SW0, PB7), which turns on to high (5 V) and off to GND, and wiring ACO (PE0) to PB5 (LED0), the output of the comparator (ACO, PE0) can be observed by checking the LED’s status.

  • Wiring : PD7 (AIN1) | PB7 (SW0; PE0 (ACO) | PB5 (LED0)

Xplained Board:

xplained-board.png

1

New | Atmel Start Project

atmel-start-project.png

2

Create new project

atmel-create-project.png

4

Add Software Components, select AC:

atmel-create-project-3.png

5

Setup AC :

atmel-create-project-4.png

6

Pin Configurator view:

atmel-create-project-5.png

7

Setup Clock Configurator:

atmel-create-project-6.png

8

Generate Project:

atmel-generate-project.png

9

View Project:

atmel-view-project.png

10

In Main.c, add keyboard scan and LED driver:

atmel-scan-led-driver.png

11

Build and run:

atmel-build-run.png

ATMega328PB Analog Comparator Demo Download

© 2017 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.