English
Language : 

PD17012_15 Datasheet, PDF (287/320 Pages) Renesas Technology Corp – 4-BIT SINGLE-CHIP MICROCONTROLLERS WITH DIGITAL TUNING SYSTEM HARDWARE
µPD17012, 17P012
22.6.2 Notes on detecting power failure by BTM0CY flag
The following points must be noted when using the BTM0CY flag for watch counting.
(1) Updating watch
When developing a watch program by using the basic timer 0 carry, the watch must be updated after a
power failure has been detected.
This is because counting of the watch is skipped once because the BTM0CY flag is reset to 0 when the
BTM0CY flag is read on detection of a power failure.
(2) Watch updating processing time
The processing to update the watch must be completed before the next basic timer 0 carry FF setting
pulse rises.
This is because, if the CE pin goes high during the watch updating processing, CE reset is effected without
the watch updating processing completed.
For further information on (1) and (2) above, refer to 12.2.6 (3) Correction of basic timer 0 carry on
CE reset.
When detecting a power failure, the following points must be noted.
(3) Timing of power failure detection
To count the watch by using the BTM0CY flag, the BTM0CY flag must be read to detect a power failure
within the time since the program has started from address 0000H until the next basic timer 0 carry FF
setting pulse rises.
For example if the basic timer 0 carry FF setting time is set to 5 ms, and a power failure is detected 6
ms after the program has been started, the BTM0CY flag is overlooked once.
For details, refer to 12.2.6 (3) Correction of basic timer 0 carry on CE reset.
Power failure detection and initial processing must be completed within the basic timer 0 carry FF setting
time as shown in the following example.
This is because, if the CE pin goes high and CE reset is effected during power failure detection processing
and initial processing, these processing may be stopped in midway, and thus problems may occur.
To change the basic timer 0 carry FF setting time by the initial processing, the instruction that changes
the time must be executed at the end of the initial processing, and the instruction must be one instruction.
This is because the initial processing may not be completely executed because of CE reset if the basic
timer 0 carry FF setting time is changed before the initial processing is executed, as shown in the following
example.
Data Sheet U10101EJ4V0DS
285