User`s manual

RX62N Group, RX621 Group 5. Usage Examples
/* PDL functions */
#include "r_pdl_lpc.h"
#include "r_pdl_intc.h"
/* PDL device-specific definitions */
#include "r_pdl_definitions.h"
void NMI_handler_lpc(void);
void main(void)
{
const uint8_t data_to_save[] = "Hello_World_1234567890_abcdefghi";
uint8_t data_to_restore[R_PDL_LPC_BACKUP_AREA_SIZE];
uint16_t status_flags;
/* Check if recover from deep software standby & what caused the exit */
R_LPC_GetStatus(
&status_flags
);
/* restore data if recover from deep software standby */
if( (status_flags & 0x8000) != 0)
{
/* Read data from the backup registers */
R_LPC_ReadBackup(
data_to_restore,
R_PDL_LPC_BACKUP_AREA_SIZE
);
}
/* Configure the NMI pin (P35) */
R_INTC_CreateExtInterrupt(
PDL_INTC_NMI, PDL_INTC_FALLING,
NMI_handler_lpc,
7
);
/* Allow a falling edge on NMI to cancel deep software standby */
R_LPC_Create(
PDL_LPC_CANCEL_NMI_FALLING,
PDL_NO_DATA
);
/* Write data into the backup registers */
R_LPC_WriteBackup(
data_to_save,
R_PDL_LPC_BACKUP_AREA_SIZE
);
/* Enter deep software standby mode */
R_LPC_Control(
PDL_LPC_MODE_DEEP_SOFTWARE_STANDBY
);
/* An internal reset will occur when exit from deep software standby */
/* Program Counter will not return to here */
while(1);
}
void NMI_handler_lpc(void)
{
nop();
}
Figure 5-4: Example of Deep Software Standby Mode
R20UT0084EE0112 Rev.1.12 Page 5-7
July. 16, 2014