User`s manual
RX62N Group, RX621 Group 4. Library Reference
Remarks
•
Before calling this function, use R_MTU2_Create to configure the channel operation.
•
Either this function or R_MTU2_ControlUnit must be used to start the timers.
•
The Stop operation is executed at the start of this function.
The Start operation is executed at the end.
Therefore, both options can be selected together with other changes in one function call.
•
When generating PWM waveforms in complementary PWM mode 1 to complementary PWM
mode 3, set the timer cycle data registers (TCDR) and timer dead time data registers (TDDR) to
values that satisfy the following condition:
Timer cycle data register value > Timer dead time data register value × 2 + 2
Program example
/* RPDL definitions */
#include "r_pdl_mtu2.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
void func(void)
{
/* Allocate a copy of the structure for the selected channel */
R_MTU2_ControlChannel_structure ch3_parameters;
/* Set the control options for channel 3 */
ch3_parameters.data2 = PDL_MTU2_START;
ch3_parameters.data3 = PDL_MTU2_REGISTER_COUNTER |
PDL_MTU2_REGISTER_TGRB;
ch3_parameters.data4 = 0xFFDD;
ch3_parameters.data6 = 0x0020;
/* Modify the operation of channel 3 */
R_MTU2_ControlChannel(
3,
&ch3_parameters
);
}
R20UT0084EE0112 Rev.1.12 Page 4-104
July. 16, 2014