Count up to 100 falling edges.
[Waveform example]
[GUI setting example]
Timer |
Used | |||
TMRJ0 |
Used | |||
Funcitons |
Event counter mode | |||
Count value |
100 | |||
TRJIO0 input filter used |
Unused | |||
TRJIO0 event input |
Always enable | |||
TRJIO0 input polarity setting |
One edge | |||
TRJIO polarity switch setting |
Starts counting at falling edge of the TRJIO0 input and TRJO0 starts output at H. | |||
Enable output (TRJO0) |
Unused | |||
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 */
}