Chapter 16

Comparator

Abstract

The comparator peripherals are used to determine which of two input voltages is larger. They can also be used to generate low-resolution analog output voltages. This chapter provides sample code for both of those applications and describes other functions provided by the special function registers (SFRs).

Keywords

Comparator

Analog output

A comparator compares two analog voltages, outputting a digital high signal if input VIN+ is greater than input VIN− and a digital low signal otherwise (Figure 16.1). Each of the two inputs to a comparator can be an external input (e.g., from a sensor) or an internally generated reference. One of these internal references is a low-resolution digital-to-analog converter that ...

Get Embedded Computing and Mechatronics with the PIC32 Microcontroller now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.