Sample Program Of 16-Bit Reload Timer; Program Example In Internal Clock Mode - Fujitsu F2MCTM-16LX Hardware Manual

16-bit microcontroller
Table of Contents

Advertisement

14.7

Sample Program of 16-bit Reload Timer

This section gives a program example of the 16-bit reload timer operated in the internal
clock mode and the event count mode:

Program Example in Internal Clock Mode

Processing specification
• The 24 ms interval timer interrupt is generated by the 16-bit reload timer 2.
• The repeated interrupts are generated in the reload mode.
• The timer is started using the software trigger instead of the external trigger input.
2
• EI
OS is not used.
• The machine clock is 24 MHz; the count clock is 1.33 µs.
Coding example
ICR04
TMCSR2 EQU
TMR2
TMRLR2 EQU
UF2
CNTE2
TRG2
;--------Main program------------------------------------
CODE
;
LOOP:
EQU
0000B4H
000064H
EQU
00794CH
00794CH
EQU
TMCSR2:2
EQU
TMCSR2:1
EQU
TMCSR2:0
CSEG
:
AND
CCR,#0BFH
MOV
I:ICR04,#00H
CLRB I:CNTE2
MOVW I:TMRLR2,#4650H ;Set data for 24 ms timer
MOVW I:TMCSR2,#0000100000011011B
MOV
ILM,#07H
OR
CCR,#40H
:
Processing by user
:
CHAPTER 14 16-BIT RELOAD TIMER
;Interrupt control register for 16-bit
;reload timer
;Timer control status register
;16-bit timer register
;16-bit reload register
;Interrupt request flag bit
;Counter operation enable bit
;Software trigger bit
;Stack pointer (SP), already initialized
;Interrupts disabled
;Interrupt level 0 (highest)
;Counter suspended
;Operation of interval timer,
clock = 1.33 µs
;External trigger disabled, external
output disabled
;Reload mode selected, interrupt enabled
;Interrupt flag cleared, count started
;ILM in PS set to level 7
;Interrupts enabled
263

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mb90360 series

Table of Contents