Figure 8.6C Measuring Long Pulse Widths - Fujitsu F2MC-8L MB89620 Series Hardware Manual

8-bit microcontroller
Table of Contents

Advertisement

n Measuring long pulse widths
To measure pulse widths longer than 2
necessary to either use an external circuit to count the number of inversions of the WTO pin
(PCR2: TO) or to count the number of counter underflows (01
interrupt processing routine. Counting by software requires a buffer in RAM (a software counter)
to hold the number of counter underflows (01
After initializing the software counter and enabling counter operation, the counter starts
counting-down from "FF
PWC pin.
An interrupt request is generated on detection of the measurement completion edge or when
the counter underflows (01
bit (PCR1: IR) and underflow (01
processing routine. If the UF bit is "1", write "0" to the UF bit to clear the interrupt request and
increment the software counter (the PWC counter continues to operate).
When the IR bit is "1", calculate the pulse width (including underflows (01
values of the software counter and PWC reload buffer register (RLBR).
When the RLBR register value is "00
l
Calculating the width of long pulses
Pulse width = [(256 – RLBR register value) + (number of counter underflows (01H → 00H) × 256)] × one-cycle width of
count clock
Calculate the pulse width before the next underflow (01
measurement value may not be able to be calculated after the next underflow (01
occurs.
Figure 8.6c shows the operation when the measured pulse selection bits (PCR2: W1, W0) are
set to "11
Input pulse
(input waveform to the PWC pin)
EN bit
Counter value
Software
counter value
MB89620 series
" when a measurement start edge is detected on the pulse input to the
H
→ 00
H
H
" (falling edge to falling edge).
B
FF
H
0
Set "0"
UF bit
IR bit
BF bit

Figure 8.6c Measuring Long Pulse Widths

8
times the cycle of the selected count clock, it is
→ 00
).
H
H
). Check the measurement completion interrupt request flag
H
→ 00
) interrupt request flag bit (PCR1: UF) in the interrupt
H
", calculate as 256.
H
→ 00
H
One cycle
1
Cleared by the program
Data transferred from down-counter
to RLBR
CHAPTER 8 PULSE WIDTH COUNT TIMER (PWC)
→ 00
) by software in the
H
H
→ 00
)) from the
H
H
) occurs. The correct
H
→ 00
H
3
2
Cleared by the program
RLBR read
)
H
173

Advertisement

Table of Contents
loading

Table of Contents