Usage example (PWMmode)

Output PWM function with specified cycle and duty.

[Waveform example]

[GUI setting example]

TimerRG

Used

TMRG

Used

Functions

PWM mode

Count source setting

Internal clock

Internal clock setting

Auto

Counter clear

Clear by TRGGRA compare match

Register function setting (TRGGRC)

General register

Register function setting (TRGGRD)

General register

Cycle

100μs (Actual value100)

Duty

50(%) (Actual value50)

Enable TRGGRA compare match interrupt

Used

Enable TRGGRB compare match interrupt

Unused

Enable TRG overflowinterrup

Unused

INTTRG priority

Low/ level3 (low priority level)

[API setting example]

r_cg_main.c

void main(void)

{

R_MAIN_UserInit();

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

/* Start the TMRG module operation */

R_TMRG0_Start();

while (1U)

{

;

}

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

}