Program Example Of Multifunctional Timer - Fujitsu MB91260B Series Hardware Manual

32-bit microcontroller
Table of Contents

Advertisement

CHAPTER 11 MULTIFUNCTIONAL TIMER
11.8

Program Example of Multifunctional Timer

Below is a sample multifunctional timer program.
■ Program Example of 16-bit Free-run Timer
Processing contents
• When the 16-bit free-run timer is 4 ms, generate a compare-clear interrupt.
• This timer is used to re-generate a compare-clear timer during up count mode.
• 16 MHz is for the machine clock, and 62.5 ns is for the count clock.
Coding example
ICR32
TCCSH
CPCLRBH.EQU
; --------------- Main Program ----------------------------------------------
START:
;
;
LOOP
; --------------- Interrupt Program ----------------------------------------------
WARI
;
;
;
294
.EQU
000460H
.EQU
0000A8H
0000A4H
ORG
C0000H
:
:
ANDCCR #0EFH
LDI
#ICR32,r0
LDI
#00H,r1
STB
r1,@r0
LDI
#CPCLRBH,r0
LDI
#0FA00H,r1
STH
r1,@r0
LDI
#TCCSH,r3
LDI
#0110H,r1
STH
r1,@r3
STILM
#14H
ORCCR
#10H
LDI
#00H,r0
LDI
#01H,r1
BRA
LOOP
LDI
#0100H,r1
ANDH
r1,@r3
:
User processing
:
; 16-bit free-run timer compare-clear interrupt control register
; Timer control status register
; Compare-clear buffer register
; Assumes that the stack pointer (SP) has already been
; initialized.
; Disables the interrupt.
; Interrupt levels 16 (strength)
; Set a value in the compare-clear buffer register to
; generate a compare-clear interrupt at 4 ms when the
; 16-bit free-run timer is in up count mode.
; Up count down mode,
; 62.5 ns count clock setting,
; Compare-clear interrupt enable,
; Clear the interrupt flag bit for compare clearing.
; Disable interrupt masking,
; Clear timer and enable operation.
; ILM in PS is set to level 20
; Interruption permission
; Infinite loop
;
; Clear interrupt request flag.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fr60lite

Table of Contents