Chapter 3 Register Setup of Each Function
68
the interval output for the interval timer.
Serial interface transfer clock generation
You can use the ouput signal from a timer to generate a serial transfer clock.
You can use the interval timer and timer output setting to set the timer.
The following timers are available for the serial interface communication.
Timer 2 Timer 3 Timer 4
Serial 0 Available Not available Available
Serial 1 Not available Not available Available
Serial 2 Not available Available Not available
Serial 3 Not available Available Not available
When you use the timer as transfer clock for the serial interface communication, the transfer speed will be
the half of the setting value.
Declare the setting value in advance because it varies depending on the communication transfer speed.
This sample uses the case when the communication transfer speed is 19200 bps.
See the setting value list of the serial interface transfer speed in the LSI User's Manual for the setting
value.
The following section describes a sample program.
/* Control data declaration */
#define
TM2MOD
0x00
/* 0b00000000 Pulse width measurement control (normal timer operation)
*/
#define
TM2PWM
0x00
/* 0b00000000 Timer operation */
#define
TM2EN
0x08
/* 0b00001000 Count operation */
/* Control data declaration */
/* 1200 baud */
#define
S12
0x01
/* 16 divisions */
#define
C12
0x64
#define
CK12
0x01
/* Prescaler input */
/* 2400 baud */
#define
S24
0x00
/* 4 divisions */
#define
C24
0x129
#define
CK24
0x01
/* Prescaler input */
/* 4800 baud */
#define
S48
0x00
/* 4 divisions */
#define
C48
0x64
#define
CK48
0x01
/* Prescaler input */
/* 9600 baud */
#define
S96
0x00
/* 4 divisions */
#define
C96
0x129
#define
CK96
0x00
/* Clock direct input */
/* 19200 baud */
#define
S192
0x00
/* 4 divisions */
#define
C192
0x64
#define
CK192
0x00
/* Clock direct input */
/* Link set values above */
/* For 19200 baud */
#define
TM2CK
CK192
/* */
#define
TM2PSC
S192
/* Clock source */
#define
TIME
C192
/* Timer count value */