Sample Programs For The Multi-Functional Timer - Fujitsu MB90460 Series Hardware Manual

F2mc-16lx 16-bit microcontroller
Table of Contents

Advertisement

14.8

Sample Programs for the Multi-functional Timer

This section contains sample programs for the multi-functional timer.
■ Sample Program for 16-bit Free-run Timer
Processing
• A 4 ms compare clear interrupt is generated with 16-bit free-run timer 0.
• The timer is used in up-down mode to repeatedly generate a compare clear interrupt.
2
• EI
OS is not used.
• 16 MHz is used for the machine clock, and 62.5 ns is used for the count clock.
Coding example
ICR11
TCCS
CPCLRB
ICLR
;-------Main program------------------------------------------------------------------------------------------------
CODE
START:
;
LOOP:
;-------Interrupt program--------------------------------------------------------------------------------------------
EQU
0000BBH
EQU
00005EH
EQU
000058H
EQU
TCCS:9
CSEG
:
AND
CCR,#0BFH
MOV
I:ICR11,#00H
MOVW
I:CPCLRB,#0FFFFH ;Set compare clear value to change
MOVW
I:TCCS,#0110H
MOV
ILM,#07H
OR
CCR,#40H
MOV
A,#00H
MOV
A,#01H
BRA
LOOP
CHAPTER 14 MULTI-FUNCTIONAL TIMER
;Interrupt control register for the
16-bit free-run timer
;Timer control status register
;Compare clear buffer register
;Interrupt request flag bit
;Assumes that stack pointer (SP) has already been
initialized
;Interrupt disable
;Interrupt level 0 (strongest)
16-bit free-run timer from up-count to
down-count
;Sets up-down mode, 62.5 ns count clock
;Enables compare clear interrupt
;Disables interrupt mask
;Clears interrupt flag and enable timer
;Sets ILM in PS to level 7
; Interrupt enable
;Endless loop
;
;
351

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mb90465 series

Table of Contents