8. Voltage Detection Circuit (LVD)
8.6
Interrupt and Reset from Voltage Monitor 2
Table 8.5 shows the procedures for setting bits related to the voltage monitor 2 interrupt and voltage monitor 2 reset.
Figure 8.6 shows an example of operations for a voltage monitor 2 interrupt.
Furthermore, set the LVD2CR0.LVD2DFDIS bit to 1 (disabling the digital filter) if you intend to use the voltage monitor
2 interrupt to initiate release from software standby mode or deep software standby mode.
Note 1. When the value of the LVD2CR0.LVD2RIE bit is 0, steps 2, 3 and 4 can be executed at the same time (by using a single
command).
Note 2. If VCC
Vdet2 (or VCC Vdet2) is detected so that the LVD2SR.LVD2DET flag becomes 1 before the voltage monitor 2
interrupt is enabled, an interrupt request will not be generated.
Table 8.5
Procedures for Setting Bits Related to the Voltage Monitor 2 Interrupt and Voltage Monitor 2 Reset
Step
When the Digital Filter is in Use
When the Digital Filter is Not in Use
Voltage Monitor 2 Interrupt
Voltage Monitor 2 Reset
Voltage Monitor 2 Interrupt
Voltage Monitor 2 Reset
1
Select the detection voltage for voltage detection 2 by setting the LVDLVLR.LVD2LVL[3:0] bits.
2
Set the LVCMPCR.EXVREFINP2 bit to 0 (internal reference voltage).
Clear the LVCMPCR.EXVCCINP2 bit (selecting the VCC voltage) or set it to 1 (selecting the input voltage on the CMPA2 pin).
Set the LVCMPCR.LVD2E bit to 1 (enabling the circuit for voltage detection 2).
5
After waiting for td(E–A), set the LVD2CR0.LVD2CMPE bit to 1 (permitting output of the results of comparison by the voltage
monitor 2 circuit).
6
Select the type of interrupt by
setting the
LVD2CR1.LVD2IRQSEL bit.
—
Select the type of interrupt by
setting the
LVD2CR1.LVD2IRQSEL bit.
—
7
Select the sampling clock for the digital filter by setting the
LVD2CR0.LVD2FSAMP[1:0] bits.
—
8
Wait for at least one cycle of the LOCO.
—
Clear the LVD2CR0.LVD2DFDIS bit (enabling the digital filter). Set the LVD2CR0.LVD2DFDIS bit to 1 (disabling the digital
filter).
10
Clear the LVD2CR0.LVD2RI
bit (to select the voltage
monitor 2 interrupt).
Set the LVD2CR0.LVD2RI bit
to 1 (to select the voltage
monitor 2 reset).
Clear the LVD2CR0.LVD2RI
bit (to select the voltage
monitor 2 interrupt).
Set the LVD2CR0.LVD2RI bit
to 1 (to select the voltage
monitor 2 reset).
11
Select the timing of interrupt
requests by setting the
LVD2CR1.LVD2IDTSEL[1:0]
bits.
—
Select the timing of interrupt
requests by setting the
LVD2CR1.LVD2IDTSEL[1:0]
bits.
—
12
Clear the LVD2SR.LVD2DET
flag.
—
Clear the LVD2SR.LVD2DET
flag.
—
13
Wait for at least 2n + 3 cycles of the LOCO (where n = 1, 2, 4,
8, and the sampling clock for the digital filter is the LOCO
frequency-divided by n).
— (No waiting is required.)
Set the LVD2CR0.LVD2RIE bit to 1 (enabling the voltage monitor 2 interrupt or reset).