7 program example for timebase timer, Program example for timebase timer – FUJITSU Semiconductor Controller MB89950/950A User Manual

Page 124

Advertising
background image

110

CHAPTER 5 TIMEBASE TIMER

5.7

Program Example for Timebase Timer

This section gives a program example for the timebase timer.

Program example for timebase timer

Processing description

Generates repeated interval timer interrupts at 2

19

/F

CH

(F

CH

: Main clock oscillation frequency)

intervals. At this time, the interval time is approximately 104.86 ms (at 5 MHz operation).

Coding example

TBTC EQU 0000AH ; Address of the timebase timer control register

TBIF EQU TBTC:3 ; Define the interrupt request flag bit.

ILR2 EQU 007DH ; Address of the interrupt level setting register 2

INT_V DSEG ABS ; [DATA SEGMENT]

ORG 0FFEEH

IRQ6 DW WARI ; Set interrupt vector.

INT_V ENDS

;-----Main program---------------------------------------------------------------

CSEG ; [CODE SEGMENT]

; Stack pointer (SP) etc. are already initialized.

:

CLRI ; Disable interrupts.

MOV ILR2,#11011111B ; Set interrupt level (level 1).

MOV TBTC,#00010010B ; Clear interrupt request flag, enable interrupt

request output, select 2

19

/F

CH

, and clear timebase

timer.

SETI ; Enable interrupts.

:

;-----Interrupt program----------------------------------------------------------

WARI CLRB TBOF ; Clear interrupt request flag.

PUSHW A

XCHW A,T

PUSHW A

:

User processing

:

POPW A

XCHW A,T

POPW A

RETI

ENDS

;--------------------------------------------------------------------------------

END

Advertising