Fig. 2.2.8 Timer 4 Constant Period Interrupt Setting Example - Renesas 4513 User Manual

4500 series 4-bit single-chip microcomputer
Table of Contents

Advertisement

APPLICATION
2.2 Interrupts
Disable Interrupts
Timer 4 interrupt is temporarily disabled.
Stop Timer Operation
Timer 4, timer 3 and prescaler are temporarily stopped.
Dividing ratio of prescaler is selected.
Set Timer Value
Timer 3 and timer 4 count times are set. (The formula is shown
Clear Interrupt Request
Timer 4 interrupt activated condition is cleared.
Timer 4 interrupt request flag T4F "0"
Note when the interrupt request is cleared
When
interrupt request flag T4F, insert the NOP instruction after the SNZT4 instruction.
Start Timer 4 Operation
Timer 4, timer 3 and prescaler temporarily stopped are restarted.
Enable Interrupts
The timer 4 interrupt which is temporarily disabled is enabled.
A The prescaler dividing ratio, time 3 count value and timer 4 count value to make the interrupt occur
every 250 ms are set as follows.
250 ms
" ": it can be "0" or "1."

Fig. 2.2.8 Timer 4 constant period interrupt setting example

2-24
Interrupt enable flag INTE
Interrupt control register V2
Timer control register W1
Timer control register W3
Timer control register W4
Timer 3 reload register R3
Timer 4 reload register R4
is executed, considering the skip of the next instruction according to the
b3
1
Timer control register W4
b3
Timer control register W3
1
b3
Timer control register W1
1 1
Interrupt control register V2
Interrupt enable flag INTE
Constant period interrupt execution start
–1
(4.0 MHz)
3
System clock Instruction
Prescaler
clock
dividing
ratio
4513/4514 Group User's Manual
"0"
All interrupts disabled (DI instruction)
b3
b0
Timer 4 interrupt occurrence disabled
0
(TV2A instruction)
b3
b0
Prescaler stop (TW1A instruction)
0 1
Prescaler divided by 16 selected
b3
b0
Timer 3 stop (TW3A instruction)
0
0
1
Prescaler selected for count source
b3
b0
Timer 4 stop (TW4A instruction)
0
0
0
Timer 3 underflow signal selected for count source
"52
"
16
Timer count value 82 set (T3AB instruction)
"F9
"
16
Timer count value 249 set (T4AB instruction)
Timer 4 interrupt activated condition cleared
(SNZT4 instruction)
b0
0
0
Timer 4 operation start (TW4A instruction)
b0
0
1
Timer 3 operation start (TW3A instruction)
b0
Prescaler operation start (TW1A instruction)
b3
b0
Timer 4 interrupt occurrence enabled
1
(TV2A instruction)
"1"
All interrupts enabled (EI instruction)
16
(82+1)
(249+1)
Timer 3
Timer 4
count
count
value
value
A below.)

Advertisement

Table of Contents
loading

This manual is also suitable for:

4514

Table of Contents