Usage example (External event counter)

Count up to 100 falling edges.

[Waveform example]

[GUI setting example]

Timer

Used

TAU0

Used

Channel0

channel 0

External event counter

TI00 muximum frequency

16000000 (Hz)

Enable using noise filter of TI00 pin input signal

Unused

External event select

TI00 falling edge

Count value

100

End of timer channel 0 count, generate an interrupt (INTTM00)

Used

Priority

Low

[API setting example]

r_main.c

void main(void)

{

R_MAIN_UserInit();

/* Start user code. Do not edit comment generated here */

/* Start TAU0 channel 0 counter */

R_TAU0_Channel0_Start();

while (1U)

{

;

}

/* End user code. Do not edit comment generated here */

}

r_cg_timer_user.c

/* Start user code for global. Do not edit comment generated here */

volatile uint8_t g_cnt = 0U;

/* End user code. Do not edit comment generated here */

static void __near r_tau0_channel0_interrupt(void)

{

/* Start user code. Do not edit comment generated here */

/* Count INTTM00 */

g_cnt++;

/* End user code. Do not edit comment generated here */

}