Operation As Input Pulse Interval Measurement - NEC 78K0R/KE3 User Manual

16-bit single-chip microcontrollers
Table of Contents

Advertisement

6.7.4 Operation as input pulse interval measurement

The count value can be captured at the TI0k valid edge and the interval of the pulse input to TI0k can be measured.
The pulse interval can be calculated by the following expression.
TI0k input pulse interval = Period of count clock × ((10000H × TSR0n: OVF) + (Capture value of TDR0n + 1))
Caution The TI0k pin input is sampled using the operating clock selected with the CKS0n bit of the
TMR0n register, so an error equal to the number of operating clocks occurs.
TCR0n operates as an up counter in the capture mode.
When the channel start trigger (TS0n) is set to 1, TCR0n counts up from 0000H in synchronization with the count
clock.
When the TI0k pin input valid edge is detected, the count value is transferred (captured) to TDR0n and, at the
same time, the counter (TCR0n) is cleared to 0000H, and the INTTM0n is output. If the counter overflows at this time,
the OVF bit of the TSR0n register is set to 1. If the counter does not overflow, the OVF bit is cleared. After that, the
above operation is repeated.
As soon as the count value has been captured to the TDR0n register, the OVF bit of the TSR0n register is updated
depending on whether the counter overflows during the measurement period. Therefore, the overflow status of the
captured value can be checked.
If the counter reaches a full count for two or more periods, it is judged to be an overflow occurrence, and the OVF
bit of the TSR0n register is set to 1. However, the OVF bit is configured as a cumulative flag, the correct interval
value cannot be measured if an overflow occurs more than twice.
Set STS0n2 to STS0n0 of the TMR0n register to 001B to use the valid edges of TI0k as a start trigger and a
capture trigger.
When TE0n = 1, instead of the TI0k pin input, a software operation (TS0n = 1) can be used as a capture trigger.
Figure 6-47. Block Diagram of Operation as Input Pulse Interval Measurement
CK01
Operation clock
CK00
TI0k pin
detection
TS0n
Remark
n = 0 to 7, k = 0 to 6
232
CHAPTER 6 TIMER ARRAY UNIT
Edge
User's Manual U17854EJ9V0UD
Timer counter
(TCR0n)
Data register
(TDR0n)
Interrupt
Interrupt signal
controller
(INTTM0n)

Advertisement

Table of Contents
loading

Table of Contents