Converting Operations And Control Procedure - Epson S1C17F13 Technical Manual

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

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.
19.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 RFCnMCH and RFCnMCL registers (measurement counter).
2. Clear the RFCnTCH and RFCnTCL registers (time base counter) to 0x000000.
3. Clear both the RFCnINTF.EREFIF and RFCnINTF.OVTCIF bits by writing 1.
4. Set the RFCnTRG.SREF bit to 1 to start reference oscillation.
5. Wait for an RFC interrupt.
i. If the RFCnINTF.EREFIF bit = 1 (reference oscillation completion), clear the RFCnINTF.EREFIF bit and
then go to Step 6.
ii. If the RFCnINTF.OVTCIF bit = 1 (time base counter overflow error), clear the RFCnINTF.OVTCIF bit and
terminate measurement as an error or retry after altering the measurement counter initial value.
6. Clear the RFCnINTF.ESENAIF, RFCnINTF.ESENBIF, and RFCnINTF.OVMCIF bits by writing 1.
7. Set the RFCnTRG.SSENA bit (sensor A) or the RFCnTRG.SSENB bit (sensor B) corresponding to the sensor
to be measured to 1 to start sensor oscillation (use the RFCnTRG.SSENA bit in AC oscillation mode).
8. Wait for an RFC interrupt.
i. If the RFCnINTF.ESENAIF bit = 1 (sensor A oscillation completion) or the RFCnINTF.ESENBIF bit = 1
(sensor B oscillation completion), clear the RFCnINTF.ESENAIF or RFCnINTF.ESENBIF bit and then go
to Step 9.
ii. If the RFCnINTF.OVMCIF bit = 1 (measurement counter overflow error), clear the RFCnINTF.OVMCIF
bit and terminate measurement as an error or retry after altering the measurement counter initial value.
9. Read the RFCnMCH and RFCnMCL registers (measurement counter) and correct the results depending on the
sensor to obtain the detected value.
R/F Converting Operations
Reference oscillation
When the RFCnTRG.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 RFCnTRG.
SREF bit is cleared to 0 and the reference oscillation stops automatically.
The measurement counter overflow sets the RFCnINTF.EREFIF bit to 1 indicating that the reference oscil-
lation has been terminated normally. If the RFCnINTE.EREFIE bit = 1, a reference oscillation completion
interrupt request occurs at this point.
S1C17F13 TeChniCal Manual
(Rev. 1.0)
Seiko epson Corporation
19 R/F CONVERTER (RFC)
19-5

Advertisement

Table of Contents
loading

Table of Contents