
μ
PD17016, 17017
150
13.6 Power Failure Detection
Power failure detection is used to judge whether power-ON reset by application of supply voltage V
DD
, or CE
reset has been effected when the device is reset, as shown in Figure 13-9.
Because the contents of the data memory and ports are “undefined” on power application, these contents
are initialized by means of power failure detection.
A power failure can be detected in two ways: by using the power failure detection circuit to detect the BTM0CY
flag, and by detecting the contents of the data memory (RAM judgement).
13.6.1 and 13.6.2 explain how a power failure is detected by using the power failure detection circuit and
BTM0CY flag.
13.6.3 and 13.6.4 explain how a power failure is detected by RAM judgement method.
Figure 13-9. Power Failure Detection Flow Chart
Program starts
Power
failure detection
Power failure
Not power
failure
Initializes data
memory and
output ports
13.6.1 Power failure detection circuit
The power failure detection circuit consists of a voltage detection circuit, a timer carry disable flip-flop that
is set by the output (power-ON clear signal) of the voltage detection circuit, and a timer carry, as shown in Figure
13-1.
The timer carry disable FF is set to “1” by the power-ON clear signal, and is reset to “0” when an instruction
that reads the BTM0CY flag is executed.
When the timer carry disable FF is set to “1”, the BTM0CY flag is not set to “1”.
When the power-ON clear signal is output (at power-ON reset), the program is started with the BTM0CY flag
reset, and the BTM0CY flag is disabled from being set until an instruction that reads the BTM0CY flag is
executed.
Once the instruction that reads the BTM0CY flag has been executed, the BTM0CY flag is set each time the
timer carry FF setting pulses has risen. It can be judged whether power-ON reset (power failure) or CE reset
(not power failure) has been effected by detecting the contents of the BTM0CY flag when the device is reset.
Power-ON reset has been effected if the BTM0CY flag is reset to “0”; CE reset has been effected if it is set to
“1”.
The voltage at which a power failure can be detected is the same as the voltage at which power-ON reset
is effected, or V
DD
= 3.5 V during crystal oscillation, or V
DD
= 2.2 V in the clock stop status.
Figure 13-10 shows the transition of the status of the BTM0CY flag.
Figures 13-11 and 13-10 show the timing chart and the operation of the BTM0CY flag.