Enter the interrupt function at fixed intervals and count the number of interrupt occurrence.
[Waveform example]
[GUI setting example]
Timer |
Used | |||
TMRJ0 |
Used | |||
Functions |
Timer mode | |||
Count source setting |
Auto | |||
Timer value |
100μs (Actual value:100) | |||
When the counter underflows, generate an interrupt (INTTRJ0) |
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 TMRJ0 counter */
R_TMR_RJ0_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_tmr_rj0_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
/* Count INTTRJ0 */
g_cnt++;
/* End user code. Do not edit comment generated here */
}