20 R/F CONVERTER (RFC)
S1C31D50/D51 TECHNICAL MANUAL
Seiko Epson Corporation
20-5
(Rev. 2.00)
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.
20.4.4 Converting Operations and Control Procedure
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 sen-
sor 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 os-
cillation has been terminated normally. If the RFC_
n
INTE.EREFIE bit = 1, a reference oscillation comple-
tion interrupt request occurs at this point.