19 R/F CONVERTER (RFC)
S1C17F13 TeChniCal Manual
Seiko epson Corporation
19-5
(Rev. 1.0)
Connecting the reference element and sensor with the same resistance will result in <Initial value: n> = <Coun-
ter value at the end of sensor oscillation: m> (if error = 0). Setting a large <Initial value: n> increases the reso-
lution of measurement. However, the measurement counter may overflow during sensor oscillation when the
sensor value decreases below the reference element value (the measurement will be canceled). The initial value
for the measurement counter should be determined taking the range of sensor value into consideration.
The time base counter should be set to 0x000000 before starting reference oscillation.
Counter value read
The measurement and time base counters operate on RFCCLK and TCCLK, respectively. Therefore, to read
correctly by the CPU while the counter is running, read the counter value twice or more and check to see if the
same value is read.
Converting Operations and Control Procedure
19.4.4
An R/F conversion procedure and the RFC operations are shown below. Although the following descriptions as-
sume that the internal oscillation circuit is used, external clock input mode can be controlled with the same proce-
dure.
R/F control procedure
1. Set the initial value (0x000000 - n) to the RFC
n
MCH and RFC
n
MCL registers (measurement counter).
2. Clear the RFC
n
TCH and RFC
n
TCL registers (time base counter) to 0x000000.
3. Clear both the RFC
n
INTF.EREFIF and RFC
n
INTF.OVTCIF bits by writing 1.
4. Set the RFC
n
TRG.SREF bit to 1 to start reference oscillation.
5. Wait for an RFC interrupt.
i. If the RFC
n
INTF.EREFIF bit = 1 (reference oscillation completion), clear the RFC
n
INTF.EREFIF bit and
then go to Step 6.
ii. If the RFC
n
INTF.OVTCIF bit = 1 (time base counter overflow error), clear the RFC
n
INTF.OVTCIF bit and
terminate measurement as an error or retry after altering the measurement counter initial value.
6. Clear the RFC
n
INTF.ESENAIF, RFC
n
INTF.ESENBIF, and RFC
n
INTF.OVMCIF bits by writing 1.
7. Set the RFC
n
TRG.SSENA bit (sensor A) or the RFC
n
TRG.SSENB bit (sensor B) corresponding to the sensor
to be measured to 1 to start sensor oscillation (use the RFC
n
TRG.SSENA bit in AC oscillation mode).
8. Wait for an RFC interrupt.
i. If the RFC
n
INTF.ESENAIF bit = 1 (sensor A oscillation completion) or the RFC
n
INTF.ESENBIF bit = 1
(sensor B oscillation completion), clear the RFC
n
INTF.ESENAIF or RFC
n
INTF.ESENBIF bit and then go
to Step 9.
ii. If the RFC
n
INTF.OVMCIF bit = 1 (measurement counter overflow error), clear the RFC
n
INTF.OVMCIF
bit and terminate measurement as an error or retry after altering the measurement counter initial value.
9. Read the RFC
n
MCH and RFC
n
MCL registers (measurement counter) and correct the results depending on the
sensor to obtain the detected value.
R/F Converting Operations
Reference oscillation
When the RFC
n
TRG.SREF bit is set to 1 in Step 4 of the conversion procedure above, the RFC Ch.
n
starts
CR oscillation using the reference resistor. The measurement counter starts counting up using the CR oscil-
lation clock from the initial value that has been set. The time base counter starts counting up using TCCLK
from 0x000000.
When the measurement counter or the time base counter overflows (0xffffff
→
0x000000), the RFC
n
TRG.
SREF bit is cleared to 0 and the reference oscillation stops automatically.
The measurement counter overflow sets the RFC
n
INTF.EREFIF bit to 1 indicating that the reference oscil-
lation has been terminated normally. If the RFC
n
INTE.EREFIE bit = 1, a reference oscillation completion
interrupt request occurs at this point.