User`s manual
RX62N Group, RX621 Group 4. Library Reference
Return value
True if all parameters are valid and exclusive; otherwise false.
Category
Multi-function Timer Pulse Unit
Reference
R_MTU2_Set, R_MTU2_ControlChannel, R_MTU2_ControlUnit
Remarks
•
If an external clock input pin (MTCLKx) or I/O pin (MTIOCnx) is made active, this function will
configure that pin for input or output and disable other functions on that pin.
•
The alternative pins are assigned using function R_MTU2_Set.
•
Either R_MTU2_ControlChannel or R_MTU2_ControlUnit must be used to start the timers.
•
If a callback function is specified, this function will enable the relevant CPU interrupt.
Please see the notes on callback function usage in §6.
•
A callback function is executed by the interrupt processing function. This means that no other
interrupt can be processed until the callback function has completed.
•
If the channel is configured for phase counting mode, the counter clock source setting is ignored.
•
If buffer operation is selected for registers TGRA and TGRC, input capture / output compare is
not valid for register TGRC.
•
If buffer operation is selected for registers TGRB and TGRD, input capture / output compare is
not valid for register TGRD.
•
If synchronous mode is required, at least two channels must be enabled for synchronous
operation.
•
A companion function, R_MTU2_Create_load_defaults, can be used to load the default values
into the structure.
•
If the channel operation mode will be changed, ensure that the timer is stopped (use
R_MTU2_ControlChannel or R_MTU2_ControlUnit).
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_Create_structure ch4_parameters;
/* Load the defaults */
R_MTU2_Create_load_defaults(&ch4_parameters);
/* Set the non-default options for channel 4 */
ch4_parameters.data2 = PDL_MTU2_MODE_NORMAL | PDL_MTU2_SYNC_ENA
BLE |
PDL_MTU2_TGRA_DTC_TRIGGER_ENABLE;
ch4_parameters.data3 = PDL_MTU2_CLK_PCLK_DIV_4;
ch4_parameters.data5 = PDL_MTU2_BUFFER_AC_CM_A;
ch4_parameters.data7 = PDL_MTU2_C_OC_HIGH_CM_LOW;
ch4_parameters.data9 = 0;
ch4_parameters.data10 = 199;
ch4_parameters.data11 = 99;
ch4_parameters.data12 = 50;
ch4_parameters.data13 = 100;
ch4_parameters.data14 = 0;
ch4_parameters.data15 = 0;
R_MTU2_Create(
4,
&ch4_parameters
);
}
R20UT0084EE0112 Rev.1.12 Page 4-100
July. 16, 2014