Program Example Of 16-Bit Input/Output Timer - Fujitsu MB90895 Series Hardware Manual

16 bit, controller manual
Table of Contents

Advertisement

7.8

Program Example of 16-bit Input/Output Timer

This section gives a program example of the 16-bit input/output timer.
I Processing of Program for Measuring Cycle Using Input Capture
• The cycle of a signal input to the IN0 pin is measured.
• The 16-bit free-run timer and input capture 0 are used.
• The rising edge is selected as the edge to be detected.
• The machine clock ( φ ) is 16 MHz and the count clock is φ /4 (0.25 µs).
• The overflow interrupt and input capture interrupt of input capture 0 are used.
• The overflow interrupt of the 16-bit free-run timer is counted beforehand and used for the cycle
calculation.
• The cycle can be determined from the following equation:
Cycle = (overflow count x "10000
= (overflow count x 10000
G
Coding example
DDR1
EQU
TCCS
EQU
TCDT
EQU
ICS01
EQU
IPCP0
EQU
IVFE
EQU
ICP0
EQU
ICR04
EQU
ICR06
EQU
DATA
DSEG
ORG
OV_CNT RW
DATA
ENDS
;---------Main program-------------------------------------
CODE
CSEG
START:
:
" + nth IPCP0 value - (n-1)th IPCP0 value) x count clock cycle
H
+ nth IPCP0 value - (n-1)th IPCP0 value) x 0.25 µs
H
000011H
000058H
000056H
000054H
000050H
TCCS:5
ICS01:6
0000B4H
0000B6H
ABS=00H
0100H
1
ABS=0FFH
;Port direction register
;Timer counter control
;Status register
;Timer counter data register
;Input capture control
;Status register 01
;Input capture data register 0
;Over flow interrupt enable bit
;Input capture 0 interrupt request
;Flag bit
;Interrupt cotrol register
16-bit free-run timer
;Interrupt control register
16-bit inpu capture
;Over flow counter
;Stack pointer (SP),
;already initialized
CHAPTER 7 16-bit I/O timer
243

Advertisement

Table of Contents
loading

This manual is also suitable for:

F2mc-16lx

Table of Contents