Usage example (Interval timer)
Enter the interrupt function at fixed intervals and count the number of interrupt occurrence.
[Waveform example]
[GUI setting example]
Timer |
Used | |||
TAU0 |
Used | |||
Channel0 |
||||
Channel 0 |
Interval timer | |||
Intervalvalue (16 bits) |
100μs (Actual value:100) | |||
Generates INTTM00 when counting is started |
Unused | |||
End of timer channel0 count, generate an interrupt (INTTM00) |
Used | |||
Priority (INTTM00) |
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 */
}