STC8A8K64D4 Series Manual
-
6.6 Power-down wake-up timer
The internal power-down wake-up timer is a 15-bit counter (composed of {WKTCH[6:0],WKTCL[7:0]}), which is
used to wake up an MCU in power off mode.
6.6.1 Power-down wake-up timer count register (WKTCL,WKTCH)
WKTEN: wake-up timer enable bit
0: No operation
1: WKT is started.
If the built-in power-down wake-up dedicated timer of STC8 series microcontrollers is enabled (set the WKTEN bit in
the WKTCH register to 1 through software), when the MCU enters the power-down mode/stop mode, the power-down
wake-up dedicated timer starts counting, when the count value is equal to When the values set by the user are equal, the
power-down wake-up dedicated timer will wake up the MCU. After the MCU wakes up, the program executes from the
statement next to the statement that set the MCU to enter the power-down mode last time. After waking up from power
down, the sleep time of the MCU in power down mode can be obtained by reading the contents of WKTCH and WKTCL.
Please note here: The value written by the user in the register {WKTCH[6:0], WKTCL[7:0]} must be one less than the
actual count value. If the user needs to count 10 times, write 9 into the register {WKTCH[6:0], WKTCL[7:0]}. Similarly, if
the user needs to count 32767 times, he should write 7FFEH (ie 32766) in {WKTCH[6:0], WKTCL[7:0]}. (Count value 0
and count value 32767 are internal reserved values and cannot be used by users). The internal power-down wake-up timer
has its own internal clock, and the time for the power-down wake-up timer to count once is determined by this clock. The
clock frequency of the internal power-down wake-up timer is about 32KHz, and the error is relatively large. Users can read
the contents of RAM area F8H and F9H (F8H stores the high byte of frequency, F9H stores the low byte) to obtain the clock
frequency recorded by the internal power-down wake-up dedicated timer when it leaves the factory.
The formula for calculating the counting time of the dedicated timer for power-down wake-up is as follows: (Fwt is the
clock frequency of the dedicated timer for internal power-down wake-up we obtained from RAM area F8H and F9H):
Power down wakeup timer timing time =
106 × 16 × count times
Fwt
(us)
Assuming Fwt=32KHz, there are:
Counting time of dedicated timer for wake-up after power failure
10
6
÷32K×16×(1+999) ≈ 0.5s
10
6
÷32K×16×(1+32767) ≈ 16s