RX − 8564 LC
Page − 31
ETM12E-01
6) Example of timer interrupt function setting
To next process
Set timer interrupt
function
TE
←
"
0
"
•
Zero-clear the TE bit to stop the timer interrupt function.
TF ← " 0 "
TIE
←
"
0
"
•
Zero-clear the TF bit and TIE bit to cancel the previous timer interrupt output
(/IRQ output).
Initialize counter
∗
3
• Set down counter's initial value. (Reg − 0F[h])
(Note)
Be sure to set or reset the down counter's initial value each time.
TE
←
"
1
"
• Write "1" to the TE bit to start the timer interrupt function.
(Note)
Before starting the timer interrupt function, be sure to set or reset the
down counter's initial value (see ∗3 above).
Set TI
/
TP bit
∗
1
• Select the operation mode (one-shot interrupt or repeated continuous
interrupts).
1) When repeated continuous interrupts are selected
Write "1" to the TI
/
TP bits.
2)
When one-shot interrupt is selected
Write "0" to the TI / TP bits.
∗
1
Set TIE bit
∗ 2
• Select event-triggered /INT output (output/do not output interrupt when at
low level).
1) Output interrupt when at low level
Write "1" to the TIE bit.
2)
Do not output interrupt when at low level
Write "0" to the TIE bit.
∗ 2
Set TD1, TD0 bit
•
Set the timer's countdown period (= source clock).
• Select using a combination of TD1 and TD0 bit values.
i. Cancel timer interrupt
function
ii. Set timer interrupt
function
iii.
Start timer interrupt function
∗
3