
234
CHAPTER 9 TIMEBASE TIMER
MB90560 series
9.7
Sample Program for the Timebase Timer Program
This section contains a sample program for the timebase timer.
I
Sample program for the timebase timer
G
Processing
An interval interrupt of 2
12
/HCLK (HCLK: oscillation clock) is repeatedly generated. The interval
becomes approx. 1.0 ms (during 4 MHz operation).
G
Coding example
ICR12
TBTC
TBOF
;-------Main program------------------------------------------------------------------------------------------------
CODECSEG
START:
;
:
;
; initialized.
AND
CCR,#0BFH
;
MOV
I:ICR12 #00H
;
MOV
I:TBTC,#10010000B
;
;
;
;
MOV
ILM,#07H
;
OR
CCR,#40H
;
LOOP:
MOV
A,#00H
;
MOV
A,#01H
BRA
LOOP
;-------Interrupt program---------------------------------------------------------------------------------------------
WARI:
CLRB
I:TBOF
;
;
:
;
User handling
;
:
RETI
;
;
CODE
ENDS
;-------Vector setting---------------------------------------------------------------------------------------------
VECT
CSEG
ABS=0FFH
ORG
0FF6CH
;
DSL
WARI
ORG
0FFDCH
;
DSL
START
DB
00H
;
VECT
ENDS
END
START
EQU
EQU
EQU
0000BCH
0000A9H
TBTC:3
;
;
;
Timebase timer interrupt control register
Timebase timer control register
Interrupt request flag bit
Assumes that stack pointer (SP) has already been
Disables interrupts.
Interrupt level 0 (highest)
Fixes upper 3 bits.
Enables interrupts and clears TBOF.
Clears counter.
Selects interval 2
12
/HCLK
Sets PS ILM to level 7.
Enables interrupts.
Endless loop
Clears interrupt request flag.
Returns from interrupt.
Sets vector for interrupt #36 (24
H
).
Sets reset vector.
Sets single-chip mode.