Usage example (Output compare mode)
Perform toggle operation at fixed intervals and output a suquare wave with a duty factor of 50%.
[Waveform example]
[GUI setting example]
TimerRG |
Used | |||
TMRG |
Used | |||
Functions |
Output compare function | |||
Count source setting |
Internal clock | |||
Internal clock setting |
Auto | |||
TRG counter setting (Counter clear) |
Clear by TRGGRA compare match | |||
Register function setting (TRGGRC) |
General register | |||
Register function setting (TRGGRD) |
General register | |||
Compare value setting (TRGGRA) |
100μs (Actual value:100) | |||
Output setting (TRGIOA pin) |
Toggle output | |||
Enable TRGGRA compare match interrupt |
Used | |||
Enable TRGoverflowinterrupt |
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 */
}