![Cmsemicon BAT32G1 9 Series Скачать руководство пользователя страница 202](http://html1.mh-extra.com/html/cmsemicon/bat32g1-9-series/bat32g1-9-series_user-manual_2627609202.webp)
BAT32G1x9 user manual | Chapter 6 Universal timer unit Timer4/8
202 / 1149
Rev.1.02
6.8.5
Operation as input signal high and low level width measurements
Note: When used as a LIN-bus
support feature,
the bit1
(
ISC1) of
the input switching control register (ISC
) must be
set to
"1", and in the instructions below, use
RxD0 Instead of
TImn.
The signal width (high and low level width) of TImn can be measured by starting counting at one edge of
the input to the TImn pin and capturing the count value at the other edge. The signal width of TImn can be
calculated using the following equation.
Note: Because the TImn pin input is sampled
by
the operating clock selected
by the
CKSmn
bit of
the timer mode register
mn
(TMRmn),
an error of
one
operating clock is generated.
In the Capture & Single Count mode, the timer count register mn (TCRmn) is used as an increment counter. If
the channel start trigger bit (TSm) of the timer channel start register m(TSm) is set to "1", the TEmn bit becomes
"1", and enter the start edge detection wait state of the TImn pin.
If the start edge of the TImn pin input (the rising edge of the TImn pin input when measuring high level width) is
detected, it is synchronized with the counting clock and the count is incremented starting at "0000H". Then, if a valid
capture edge (the falling edge of the TImn pin input when measuring the high level width is measured), the intTMmn
is output at the same time that the count value is passed to the timer data register mn (TDRmn).
。
At this point, if the
counter overflows, the OVF position bit of the timer status register mn (TSRmn) is placed. If the counter does not
overflow, the OVF bit is cleared. The value of the TCRmn register changes to "Value passed to TDRmn re1"
and stops counting, and enters the start edge detection wait state of the TImn pin. After that, the same run continues.
While the count value is captured to the TDRmn register, the OVF bit of the TSRmn register is updated according
to whether there is an overflow during the measurement, and the overflow status of the captured value can be confirmed.
Even if the counter performs a full count of 2 cycles or more, it is considered to have overflowed and the OVF
position of the TSRmn register is considered to be "1". However, when 2 or more overflows occur, the interval value
cannot be measured normally by the OVF bit.
The CISmn1 and CISmn0 bits of the TMRmn registers can be used to determine whether to measure the high
or low level width of the TImn pin. This function is designed to measure the input signal width of the TImn pin, so the
TSmn position "1" cannot be placed during the period when the TEmn bit is "1".
CISmn1, CISmn0=10B of TMRmn registers: Measures the low level width. CISmn1, CISmn0=11B of the
TMRmn register: Measures the high level width.
Signal width of TImn input = period of counting clocks
×
(10000H
×
TSRmn: OVF) + (capture value of
TDRmn +1)).