Usage example
Stop the comparator after the valid edge of comparison result.
[GUI setting example]
Comparator |
Used | |||
Comparator |
Used | |||
Comparator input |
IVCMP00 | |||
Reference voltage |
IVREF0 | |||
Enable digital filter |
Unused | |||
Output setting (VCOUT0) |
Used | |||
Internal output polarity setting |
Normal | |||
STOP mode release setting |
Used | |||
When detecting the valid edge of the comparator output, generate an interrupt (INTCMP0) |
Used | |||
Valid edge detection |
Both edges | |||
Priority |
Low |
[API setting example]
r_main.c
void main(void)
{
R_MAIN_UserInit();
/* Start user code. Do not edit comment generated here */
/* Start the comparator 0 */
R_COMP0_Start();
while (1U)
{
;
}
/* End user code. Do not edit comment generated here */
}
r_cg_comp_user.c
static void __near r_comp0_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
/* Stop the comparator 0 */
R_COMP0_Stop();
/* End user code. Do not edit comment generated here */
}