![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_298.png)
274
CHAPTER 11 16-BIT RELOAD TIMER
MB90560 series
CODEENDS
;-------Vector setting------------------------------------------------------------------------------------------------
VECT
CSEG
ABS=0FFH
ORG
0FF84H
;
DSL
WARI
ORG
0FFDCH
;
DSL
START
DB
00H
;
VECT
ENDS
END
START
Sets vector for interrupt #29 (1DH).
Sets reset vector
Sets single-chip mode.
I
Sample program in event count mode
G
Processing
When the rising edge of the pulse input to the external event input pin is counted 10,000
times with 16-bit reload timer/counter 0, an interrupt is generated.
The timer operates in single-shot mode.
External trigger input selects the rising edge.
EI
2
OS is not used.
G
Coding example
ICR09
TMCSR
TMR
TMRLR
DDR2
UF
CNTE
TRG
;-------Main program------------------------------------------------------------------------------------------------
CODE
CSEG
START:
;
:
;
;
AND
CCR,#0BFH
;
MOV
I:ICR09,#00H
;
MOV
I:DDR2,#00H
;
CLRB
I:CNTE
;
MOVW
I:TMRLR0,#2710H
;
MOVW
I:TMCSR0,#0000110010001011B
;
;
;
;
MOV
ILM,#07H
;
OR
CCR,#40H
;
LOOP:
MOV
A,#00H
;
MOV
A,#01H
;
BRA
LOOP
;
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
0000B9H
000082H
000084H
000084H
000012H
TMCSR0:2
TMCSR0:1
TMCSR0:0
;
;
;
;
;
;
;
;
Interrupt control register for the 16-bit reload timer
Timer control status register
16-bit timer register
16-bit reload register
Port data register
Interrupt request flag bit
Counter operation enable bit
Software trigger bit
Assumes that stack pointer (SP) has already been
initialized.
Interrupt disable
Interrupt level 0 (strongest)
Sets P20/TIN0 pin to input.
Temporary stopping of counter
Sets reload value to 10,000.
Counter operation, external trigger, rising
Disables edge and external output.
Selects single-shot mode and enables interrupts.
Clears interrupt flag, starts counter.
Sets ILM in PS to level 7.
Interrupt enable
Endless loop