Usage example (Output compare function)

Perform toggle operation at fixed intervals and output a suquare wave with a duty factor of 50%.

[Waveform example]

[GUI setting example]

Timer

Used

TMRD0

Used

Output compare function

Used

Count source setting

Internal clock

Internal clock setting

fIH

Counter operation

Count continues at TRDGRA0 comparematch

Counter clear

Clear by TRDGRA0 compare match

Regiaster function setting(TRDGRC0)

General register

Regiaster function setting (TRDGRD0)

General register

Compare value setting TRDGRA0

100(μs)(Actual value100)

Output setting TRDIOA0 pin

Initial output L Compare match Toggle output

Enable TRDGRA0 compare match interrupt

Used

[API setting example]

r_main.c

void main(void)

{

R_MAIN_UserInit();

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

/* Start TMRD0 counter */

R_TMR_RD0_Start();

while (1U)

{

;

}

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

}