Fujitsu F2MCTM-16LX Computer Hardware User Manual


 
278
CHAPTER 15 WATCH TIMER
15.6 Program Example of Watch Timer
This section gives a program example of the watch timer.
Program Example of Watch Timer
Processing specifications
An interval interrupt at 2
13
/SCLK (SCLK: subclock) is generated repeatedly. The internal time is
approximately 1.0 s (when subclock operates at 8.192 kHz).
Coding example
ICR08 EQU 0000B8H ;Interrupt control register
WTC EQU 0000AAH ;Watch timer control register
WTOF EQU WTC:4 ;Overflow flag bit
;
;---------Main program-------------------------------------
CODE CSEG
START:
; ;Stack pointer (SP) already
;initialized
AND CCR,#0BFH ;Interrupt disabled
MOV I:ICR07,#00H ;Interrupt level 0 (highest)
MOV I:WTC,#10100101B ;Interrupt enabled
;Overflow flag cleared
;Watch timer counter cleared,
;2
13
/SCLK(approx. 1.0 s)
MOV ILM,#07H ;Set ILM in PS to level 7
OR CCR,#40H ;Interrupt enabled
LOOP:
Processing by user
BRA LOOP
;---------Interrupt program--------------------------------------
WARI:
CLRB I:WTOF ;Overflow flag cleared
Processing by user
RETI ;Return from interrupt processing
CODE ENDS
;---------Vector setting------------------------------------------
VECT CSEG ABS=0FFH
ORG 00FF90H ;Reset vector set #27 (1B
H
)
DSL WARI