cancel
Showing results for 
Search instead for 
Did you mean: 

What could be an application of COMP1 in STM8L ?

elil
Associate III
Posted on January 14, 2012 at 21:56

Hello,

STM8L has 2 comparators: COMP1and COMP2. COMP2 is very useful as it has an ability to get any desired threshold: either internal or external. The only threshold for COMP1 is internal Vref, so I'm wondering what can be it used for ? I'm aware of window comparator ability with both of them, but can somebody here think about application of only COMP1? What COMP1 can do, can do also a digital port, having also Schmitt trigger option.

Any idea will be highly appreciated,

E.L.

 
4 REPLIES 4
Stm32User
Associate II
Posted on February 17, 2012 at 14:36

I am using this internal comparator for low battery detection and it works very well.  You can use two external high value resistors to set the threshold and connect the other input of the comparator internally to the vref. 

elil
Associate III
Posted on February 25, 2012 at 17:43

Hi Patrick,

IMHO, for battery monitoring it is better to use internal PVD- I/O pin is not required. You have to ''pay'' with current consumption of internal Vref(1.2uA), like in case  of COMP1, and of PVD itself (0.2uA).The only possible disadvantage of the method that you have to chose a hysteresys only from among existing 8, i.e., if you have your own,you can't.

Stm32User
Associate II
Posted on February 27, 2012 at 15:32

Hi

The method you describe monitors the VDD of the micro.  In my system I have a regulator between the battery and the micro so COMP1 monitors the battery voltage. If I use the system you describe the PVD interrupt will occur only when the battery voltage collapses and the regulator comes out of regulation which is not much use in my system.  I need to inform the user to change the batteries when the minimum voltage per cell is reached, but with the system still fully operational.

elil
Associate III
Posted on March 06, 2012 at 19:32

Hi Patric,

I have a similar case. I also need to inform a user about low battery a month before the device dies. I also have regulator, powering necessary components, for example, those consuming too much current, causing to voltage drop across them. Vcc of STM8 is powered by battery. Once a day I load the battery with a small resistor to simulate my real load( I can't do it in real time) and then I test battery. under load, with PVD. You can select PVD threshold so that your regulator will still  have its required voltage.