Datasheet

FS98O22
Rev. 1.6 60/146
z Pulse Width Measurement mode:
Programmable Counter could be used to measure the time when a signal holds its voltage level in high or
low.
Operation:
1. Clear FQTMB and clear MUXSEL[2] register flags to make the Programmable Counter work as Pulse
Width Measurement.
2. Setup MUXSEL[1:0] to decide the input clock signal.
3. PFI is the signal which is ready to measure the pulse width. Users could set TE to invert the PFI voltage
level.
4. Clear OVAB register flag to set the CTA as the working counter. When CTA counter overflows, the
interrupt (CTIE) will be triggered.
5. Clear CTIF and set the CTIE and GIE register flags to enable the Programmable Counter interrupt.
6. Setup CTB[15:0]. CTA[15:0] will be filled with the same value as CTB[15:0]. When CTA[15:0] overflows, it
will be filled with the same value again. User could decide CTA timeout by setting up CTB[15:0] register.
7. Set TON to start the Pulse Width Measurement.
8. When PFI signal is from high to low, CTA counter will stop counting and clear TON register flag. Interrupt
will be triggered at the same time. Users could read the CTA counter value to know the pulse width of
PFI.
9. If CTA counter overflows, and the PFI signal is still high, the interrupt will be triggered, but CTA will count
again.
CLK
TON
CTA_CLK
CTA 0000
PFII
XXXX
INT
0001 0002 0003 0004 0005
X1
CTIF
0006 0007 0008 0009
Software Write into CTB (CTA same as CTB)
Software Set
When CTIE=1
Figure 6-5 Programmable Counter Pulse Width Measurement mode
FORTUNE'
Properties
For Reference Only