|
4524_M Datasheet, PDF (207/310 Pages) Renesas Technology Corp – 4-BIT CISC SINGLE-CHIP MICROCOMPUTER 720 FAMILY / 4500 SERIES | |||
|
◁ |
4524 Group
APPLICATION
2.3 Timers
â Disable Interrupts
Timer 2 interrupt is temporarily disabled.
Interrupt enable flag INTE
Interrupt control register V1
0
b3
b0
0 âââ
All interrupts disabled [DI]
b3: Timer 2 interrupt occurrence disabled [TV1A]
â
â Stop Timer and Prescaler Operation
Timer 2 and prescaler are temporarily stopped.
Timer 2 count source and CNTR0 output are selected.
b3
b0
Timer control register W2 1 0 0 1
b0
Timer control register PA
0
[TW2A]
b3: Timer 2 underflow signal divided by 2 selected for
CNTR0 output
b2: Timer 2 stop
b1, b0: Prescaler output (ORCLK) selected for
Timer 2 count source
Prescaler stop [TPAA]
â
â Set CNTR0 Output
The output structure of the CNTR0 pin is set to N-channel open-drain output.
Port output structure control register FR2
b3
b0
0 â â â b3: N-channel open-drain output selected [TFR2A]
Timer control register W6
b3
b0
â â â 1 b0: CNTR0 output port set [TW6A]
â
â Set Timer Value and Prescaler Value
Timer 2 and prescaler count times are set. (The formula is shown *A below.)
Timer 2 reload register R2 â2916â
Timer count value 41 set [T2AB]
Prescaler reload register RPS â0316â
Prescaler count value 3 set [TPSAB]
â
â Clear Interrupt Request
Timer 2 interrupt activated condition is cleared.
Timer 2 interrupt request flag T2F 0
Timer 2 interrupt activated condition cleared [SNZT2]
â
( ) Note when the interrupt request is cleared
When â is executed, considering the skip of the next instruction according to the interrupt request flag T2F,
insert the NOP instruction after the SNZT2 instruction.
â
â
Start Timer Operation and Prescaler Operation
Timer 2 and prescaler temporarily stopped are restarted.
b3
b0
Timer control register W2 1 1 0 1
b0
Timer control register PA
1
b2: Timer 2 operation start [TW2A]
Prescaler start [TPAA]
â
~ Enable Interrupts
The Timer 2 interrupt which is temporarily disabled is enabled.
Interrupt control register V1
b3
b0
1 â â â b3: Timer 2 interrupt occurrence enabled [TV1A]
Interrupt enable flag INTE 1
All interrupts enabled [EI]
â
Buzzer ou...tput start
â
â Stop CNTR0 Output
CNTR0 I/O port is set to CNTR0 input port and is set to be high-impedance state.
b3
b0
Register Y 0 1 1 1 Specify bit position of port D [TYA]
Port D7 output latch 1
Set to input [SD]
Timer control register W6
b3
b0
â â â 0 b0: Set to CNTR0 input port [TW6A]
*A: The prescaler count value and timer 2 count value to make the underflow occur every 125 µs are set as follows.
125 µs â
(4.0 MHz)-1 â 3 â (3 +1) â (41 +1)
System clock Instruction Presclaer
Timer 2 count value
clock
count value
âââ: it can be â0â or â1.â
â[ ]â: instruction
Fig. 2.3.5 CNTR0 output setting example
Rev.2.00 Aug, 06 2004
REJ09B0107-0200Z
2-43
|
▷ |