RX − 8564 LC
6) Example of timer interrupt function setting
Cancel timer interrupt | function |
i. |
|
timer interrupt | function |
ii. Set |
|
Set timer interrupt
function
TE ← | " 0 " |
| • | |
|
|
| ||
|
|
| • | |
|
|
| ||
TF ← | " 0 " |
| ||
|
| (/IRQ output). | ||
TIE ← | " 0 " |
|
| |
|
|
| ||
|
|
| ∗ | 1 |
| ∗ | 1 | ||
| ||||
Set TI / TP bit |
| • Select the operation mode | ||
|
| interrupts). | ||
|
|
|
| |
|
|
|
| 1) When repeated continuous interrupts are selected |
|
|
|
| Write "1" to the TI / TP bits. |
|
|
|
| 2) When |
|
|
|
| Write "0" to the TI / TP bits. |
| ∗ | 2 | ∗ | 2 |
Set TIE bit |
| • | Select | |
|
|
|
| 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. |
|
|
| • | Set the timer's countdown period (= source clock). |
Set TD1, TD0 bit |
| |||
| • | Select using a combination of TD1 and TD0 bit values. | ||
|
|
|
|
|
iii. Start timer interrupt function
| ∗ 3 | ∗ | 3 |
Initialize counter | • | 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). |
|
|
| |
|
|
|
|
To next process
Page − 31 |