Usage example (PWM mode (up to 3 PWM outputs))

Output PWM function with specified cycle and duty.

[Waveform example]

[GUI setting example]

Timer

Used

TMRD0

Used

PWM mode (up to 3 PWM outputs)

Used

Count source setting

Internal clock

Internal clock setting

fIH

Counter opeartion

Count continues at TRDGRA0 compare match

Register function setting (TRDGRC0)

General register

Register function setting (TRDGRD0)

General register

PWM period

100 (μs) (Actual value100)

Duty (TRDGRB0)

50(%)(Actual value50)

Output delay time (TRDGRB0)

No delay

Initial output (TRDIOB0pin)

Non-active level

Output level (TRDIOB0 pin)

L active

Enable forced cutoff by ELC event input

Unused

Enable forced cutoff by INTP0 low-level-input

Unused

TRDIOB0 pin output

Forced cutoff disabled

TRDIOC0 pin output

Forced cutoff disabled

TRDIOD0 pin output

Forced cutoff disabled

Enable TRDGRA0 compare match interrupt

Used

Enable TRDGRB0 compare match interrupt

Unused

Enable TRDGRC0 compare match interrupt

Unused

Enable TRDGRD0 compare match interrupt

Unused

Enable TRD0 overflow intrrupt

Unused

Priority

Low

[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 */

}