User manual

V850E2/MN4 Timer Array Unit Control
R01AN0922EJ0100 Rev.1.00 Page 10 of 54
Jan 13, 2012
4.4 Register Setup
This section explains how to set up the relevant registers according to the flow charts shown in section 4.1. The
registers described below must be configured to control the timer I/O.
4.4.1 Port Setup
In this sample program, the pin P3_1, which is used to generate the PWM signal in the TAUA, is used as
TAUA1TTOUT1. The pin P2_1, which is used to measure the input signal width in the TAUJ, is used as TAUJ0TTIN0.
The pertinent control registers must be set up as shown in the table below.
Macro Pin PMC PFCE PFC PM Corresponding Function
TAUA1TTOUT1 P3_1 1 0 1 0 Alternative mode 2, output
TAUJ0TTIN0 P2_1 1 1 0 1 Alternative mode 3, input
Setting examples
/* P3_1: TAUA1TTOUT1; alternative mode 2; output */
PFCE3 |= 0x0000;
PFC3 |= 0x0002;
PMC3 |= 0x0002;
PM3 &= 0xfffd;
/* P2_1: TAUJ0TTIN1; alternative mode 3; input */
PFCE2 |= 0x0002;
PFC2 |= 0x0000;
PMC2 |= 0x0002;
PM2 |= 0x0002;