![Toshiba TMPM3V4 Manual Download Page 204](http://html.mh-extra.com/html/toshiba/tmpm3v4/tmpm3v4_manual_428626204.webp)
10.7.2 Frequency measurement
The frequency of an external clock can be measured by using the capture function.
To measure frequency, another 16-bit timer is used in combination with the 16-bit event counter mode. As
an example, we explain with TMRB0 and TMRB7. TB7OUT of the 16-bit timer TMRB7 is used to specify
the measurement time.
TMRB0 count clock selects TB0IN input and performs count operation by using external clock input. If
TB0MOD<TBCPM[1:0]> is set "11", TMRB0 count clock takes the counter value into the TB0CP0 at the ris-
ing edge of TB7OUT and takes the counter value into TB0CP1 at the falling edge of TB7OUT.
This setting allows a count value of the 16-bit up-counter UC to be taken into the capture register
(TB0CP0) upon rising of a timer flip-flop output (TB7OUT) of the 16-bit timer (TMRB7), and an UC coun-
ter value to be taken into the capture register (TB0CP1) upon falling of TB7OUT of the 16-bit timer (TMRB7).
A frequency is then obtained from the difference between TB0CP0 and TB0CP1 based on the measure-
ment, by generating the INTTB7 16-bit timer interrupt.
For example, if the difference between TB0CP0 and TB0CP1 is 100 and the level width setting value of
TB
7
OUT is 0.5 s, the frequency is 200 Hz (100 ÷ 0.5 s = 200 Hz).
Count clock
(TB0IN pin input)
Taking data into
TB0CP1
TB7OUT
Taking data into
TB0CP0
C1
C1
C1
C2
C2
C2
INTTB70
INTTB71
Figure 10-8 Frequency Measurement
10.7.3 Pulse width measurement
By using the capture function, the "High" level width of an external pulse can be measured. Specifically,
by putting it in a free-running state using the prescaler output clock, an external pulse is input through the
TBxIN pin and the up-counter (UC) is made to count up. A trigger is generated at each rising and falling
edge of the external pulse by using the capture function and the value of the up-counter is taken into the cap-
ture registers (TBxCP0, TBxCP1). The CPU must be programmed so that INTCAPx1 is generated at the fall-
ing edge of an external pulse input through the TBxIN pin.
The "High" level pulse width can be calculated by multiplying the difference between TBxCP0 and
TBxCP1 by the clock cycle of an internal clock.
For example, if the difference between TBxCP0 and TBxCP1 is 100 and the cycle of the prescaler output
clock is 0.5 μs, the pulse width is 100 × 0.5 μs = 50 μs.
Caution must be exercised when measuring pulse width exceeding the UC maximum count time which is
dependent upon the source clock used. The measurement of such pulse widths must be made using software.
TMPM3V6/M3V4
10. 16-bit Timer / Event Counters (TMRB)
10.7 Applications using the Capture Function
Page 182
2019-02-06
Summary of Contents for TMPM3V4
Page 1: ...32 Bit RISC Microcontroller TX03 Series TMPM3V6 M3V4 ...
Page 2: ... 2019 Toshiba Electronic Devices Storage Corporation ...
Page 7: ...Revision History Date Revision Comment 2019 02 06 1 First Release ...
Page 8: ......
Page 22: ...xiv ...
Page 52: ...TMPM3V6 M3V4 3 Processor Core 3 6 Exclusive access Page 30 2019 02 06 ...
Page 148: ...TMPM3V6 M3V4 7 Exceptions 7 6 Exception Interrupt Related Registers Page 126 2019 02 06 ...
Page 178: ...TMPM3V6 M3V4 9 Input Output port 9 2 Block Diagrams of Ports Page 156 2019 02 06 ...
Page 354: ...TMPM3V6 M3V4 14 Synchronous Serial Port SSP 14 6 Frame Format Page 332 2019 02 06 ...
Page 419: ...TMPM3V6 M3V4 Page 397 2019 02 06 ...
Page 462: ...TMPM3V6 M3V4 21 Watchdog Timer WDT 21 5 Control register Page 440 2019 02 06 ...
Page 544: ......