![](http://datasheet.mmic.net.cn/120000/R5F21388SDFP_datasheet_3573603/R5F21388SDFP_642.png)
R01UH0241EJ0010 Rev.0.10
Page 611 of 730
Aug 05, 2011
R8C/38T-A Group
25. Touch Sensor Control Unit
Under development Preliminary document
Specifications in this document are tentative and subject to change.
25.3.1.5
Counter Operation
The primary counter is a 16-bit up counter and the secondary counter is a 16-bit up/down counter.
The primary counter increments when a high level is detected at the CMOS input to CHxA while each channel
is measured.
Two types of measurement data, the primary counter value when a low level is detected at CHxA for the first
time (data 1 hereafter) and the primary counter value when the secondary counter value reaches 0 (data 2
hereafter), are stored in the register.
This secondary counter is activated in measurement STEP 2, and decrements the value set by bits SCS0 to
SCS15 in the TSCUSCS register when a low level is detected and increments when a high level is detected.
However, the counter does not increment any value exceeding the value set by bits SCS0 to SCS15.
The PRE and Main measurement results are reflected in the primary counter.
Only the Main measurement result is reflected in the secondary counter.
The conditions for transition from measurement STEP 1 to measurement STEP 2 are as follows:
The Main measurement result is determined as low when PRE measurement is turned OFF.
The PRE measurement result is determined as low and the Main measurement result is determined as low
when PRE measurement is turned ON.
Either CHxA0 or CHxA1 is selected for CHxA by bits CHXAS00 to CHXAS35 in registers TSCHSEL0 to
TSCHSEL2.
25.3.1.6
Measurement Data
In measurement STEP 1, the primary counter values when a low level is detected for the first time are stored in
bits DBR0 to DBR15 in the TSCUDBR register (data 1).
In measurement STEP 2, the primary counter values when the secondary counter value reaches 0 are stored in
bits PRC0 to PRC15 in the TSCUPRC register (data 2). Stored data 1 and data 2 are transferred as the
measurement data to RAM using the DTC in Status 22.
Figure 25.8
Measurement Data Transfer
TSCU register
TSCUDBR
TSCUPRC
06B1Ah
06B1Ch
Store measurement data 1
Store measurement data 2
Transfer
Transfer data 1 and data 2
to RAM using DTC