The use of STM32 comparator

Preface

First of all, the chip needs to use a model with a comparator, and some do not have a comparator.

 

surroundings

STM32F071CBT6

STM32CUBEMX

MDK5

step

1. Use Cube to create a new project and select the corresponding chip

2. Set basic settings such as the clock

3. Turn on COMP1 to set the parameters

Parameter explanation

Combine the block diagram to make it easier to understand

Input+: signal input

Input-: compare the signal, compare the input signal with the signal. If it is greater than 1 and less than 0, it can be configured to invert

Speed/Power Mode: Speed, the higher the burr, the greater the impact

Interrupt Trigger Mode: Trigger mode, rising edge and falling edge

Hyseteresis Level: Hysteresis

engineering

github:https://github.com/Shaynerain/STM32-COMP-DEMO

Guess you like

Origin blog.csdn.net/shaynerain/article/details/108051625