Fujitsu MB90420/5 (A) Series Hardware Manual page 268

F2mc-16lx family 16-bit microcontrollers
Table of Contents

Advertisement

MB90420/5 (A) SERIES F
n Program example of event counter mode
• Processing specification
– An interrupt is generated when rising edges of the pulse input to the external event input pin are
counted 10000 times by the 16-bit reload timer/counter.
– Operation is performed by the one-shot mode.
– The rising edge is selected for the external trigger input.
2
– EI
OS is not used.
• Coding example
ICR03
EQU
TMCSR
EQU
TMR
EQU
TMRLR
EQU
DDR1
EQU
UF
EQU
CNTE
EQU
TRG
EQU
;---------- Main program ------------------------------------------------------
CODE
CSEG
START:
;
AND
MOV
MOV
CLRB
MOVW
MOVW
MOV
OR
LOOP:
MOV
MOV
BRA
;---------- Interrupt program ------------------------------------------------------
WARI:
CLRB
;
Processing by user
;
;
RETI
CODE
ENDS
;---------- Vector setting ------------------------------------------------------------
VECT
CSEG
ORG
DSL
ORG
DSL
DB
VECT
END
2
MC-16LX FAMILY 16-BIT MICROCONTROLLERS HARDWARE MANUAL
; Interrupt control register for 16-bit reload timer
0000B3
H
; Timer control status register
000050
H
; 16-bit timer register
000052
H
; 16-bit reload register
000052
H
; Port data register
000011
H
; Interrupt request flag bit
TMCSR:2
; Counter operation enable bit
TMCSR:1
; Software trigger bit
TMCSR:0
; Stack pointer (SP), already initialized
; Interrupts disabled
CCR, #0BF
H
; Interrupt level 0 (highest)
I:ICR09, #00
H
; Set P12/TIN0 pin to input
I:DDR1, #00
H
; Counter suspended
I:CNTE
; Set reload value to 10000 times
I:TMRLR, #2710
H
I:TMCSR, #0000110010001011
; Counter operation, external trigger, rising edge, and external output
; One-shot mode selected, interrupt enabled
; Interrupt flag cleared, counter started
; ILM in PS set to level 7
ILM, #07
H
; Interrupts enabled
CCR, #40
H
; Infinite loop
A, #00
H
A, #01
;
H
LOOP
;
; Interrupt request flag cleared
I:UF
; Return from interrupt
ABS=0FF
H
; Set vector to interrupt #30 (1E
0FF84
H
WARI
; Reset vector setting
0FFDC
H
START
; Set to single-chip mode
00
H
ENDS
START
B
disabled
10-26
)
H

Advertisement

Table of Contents
loading

Table of Contents