EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Comparator Is Used to Detect the Operation Voltage (Battery Voltage)

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 443 -
15.4.4 Comparator is Used to Detect the Operation Voltage (Battery
Voltage)
47u C?
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
P5.4
Vcc
P5.5
Gnd
P1.1
P1.0
CMP+/P3.7
CMP-/P3.6
P3.5
P3.4
P3.3
P3.2
P3.1
P3.0
1
2
3
4
5
6
7
8
9
10
20
19
18
17
16
15
14
13
12
11
STC8xx
Vcc
103K (about 2.5V)
74.3K (about 3.0V)
58.2K (about 3.5V)
47.9K (about 4.0V)
40.6K (about 4.5V)
35.3K (about 5.0V)
R6
R5
R4
R3
R2
R1
R0
100K
C?
System clock<=10MHz System clock>10MHz
104(0.1uF) 103(0.01uF)
In the figure above, the working voltage of the MCU can be approximately measured using the principle of
resistance voltage division. The I/O port of selected channel outputs low level, which is close to GND, and the I/O port
of unselected channel working in open-drain mode outputs high. Other channels are not affected.
The negative terminal of the comparator selects the internal reference voltage 1.19V, and the positive terminal
selects the voltage value got from the voltage divided by a resistor as the input to the CMP+ pin.
In initialization, P1.5 ~ P1.0 are set to open-drain mode and output high. Firstly, P1.0 outputs a low level. At this
time, if the VCC voltage is lower than 2.5V, the comparison value of the comparator is 0. Otherwise, if the VCC voltage
is higher than 2.5V, the comparison value of the comparator is 1.
If you make sure that VCC is higher than 2.5V, then make the output of P1.0 high and the output of P1.1 low. At
this time, if the VCC voltage is lower than 3.0V, the comparison value of the comparator is 0. Otherwise, if the VCC
voltage is higher than 3.0V, the comparison value of the comparator is 1.
If you make sure that VCC is higher than 3.0V, then make the output of P1.1 high and the output of P1.2 low. At
this time, if the VCC voltage is lower than 3.5V, the comparison value of the comparator is 0. Otherwise, if the VCC
voltage is higher than 3.5V, the comparison value of the comparator is 1.
If you make sure that VCC is higher than 3.5V, then make the output of P1.2 high and the output of P1.3 low. At
this time, if the VCC voltage is lower than 4.0V, the comparison value of the comparator is 0. Otherwise, if the VCC
voltage is higher than 4.0V, the comparison value of the comparator is 1.
If you make sure that VCC is higher than 4.0V, then make the output of P1.3 high and the output of P1.4 low. At
this time, if the VCC voltage is lower than 4.5V, the comparison value of the comparator is 0. Otherwise, if the VCC
voltage is higher than 4.5V, the comparison value of the comparator is 1.
If you make sure that VCC is higher than 4.5V, then make the output of P1.4 high and the output of P1.5 low. At
this time, if the VCC voltage is lower than 5.0V, the comparison value of the comparator is 0. Otherwise, if the VCC
voltage is higher than 5.0V, the comparison value of the comparator is 1.
C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"

Table of Contents

Related product manuals