User`s manual
RX62N Group, RX621 Group 5. Usage Examples
5.4. Voltage Detection Circuit
Figure 5-5 shows an example of Voltage detection circuit usage.
If the supply voltage drops below 3.15V (Vdet2), the callback function is called.
If the supply voltage drops below 2.85V (Vdet1), the MCU is reset.
/* Peripheral driver function prototypes */
#include "r_pdl_lvd.h"
#include "r_pdl_intc.h"
/* PDL device-specific definitions */
#include "r_pdl_definitions.h"
void NMICallBackFunc(void);
void main(void)
{
/* Generate an NMI when Vdet2 is reached; reset if Vdet1 is reached */
R_LVD_Control(
PDL_LVD_VDET2_INTERRUPT_VDET1_RESET
);
/* Configure the NMI */
R_INTC_CreateExtInterrupt(
PDL_INTC_NMI,
PDL_INTC_FALLING | PDL_INTC_LVD_ENABLE,
NMICallBackFunc,
15
);
}
void NMICallBackFunc(void)
{
/* Handle the low voltage detection response here */
}
Figure 5-5: Example of Independent Watchdog Timer use
R20UT0084EE0112 Rev.1.12 Page 5-8
July. 16, 2014