Download Print this page

Epson S1C31D50 Technical Instructions page 330

Cmos 32-bit single chip microcontroller
Hide thumbs Also See for S1C31D50:

Advertisement

The time base counter is a 24-bit presettable up/down counter. The time base counter counts up
with TCCLK during reference oscillation to measure the reference oscillation time. During sensor
oscillation, it counts down from the reference oscillation time and stops the sensor oscillation when it
reaches 0x000000. This means that the sensor oscillation time becomes equal to the reference
oscillation time. The value counted during reference oscillation should be saved in the memory. It can
be reused at subsequent sensor oscillations omitting reference oscillations.
Counter initial value
To obtain the difference between the reference oscillation and sensor oscillation clock count
values from the measurement counter simply, appropriate initial values must be set to the
measurement counter before starting reference oscillation.
Connecting the reference element and sensor with the same resistance will result in <Initial value: n>
= <Counter value at the end of sensor oscillation: m> (if error = 0). Setting a large <Initial value: n>
increases the resolution 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 assume that the internal oscillation circuit is used, external clock input mode can be
controlled with the same procedure.
R/F control procedure
1. Set the initial value (0x000000 - n) to the RFC_nMCH and RFC_nMCL registers (measurement
counter).
2. Clear the RFC_nTCH and RFC_nTCL registers (time base counter) to 0x000000.
3. Clear both the RFC_nINTF.EREFIF and RFC_nINTF.OVTCIF bits by writing 1.
4. Set the RFC_nTRG.SREF bit to 1 to start reference oscillation.
5. Wait for an RFC interrupt.
i.
If the RFC_nINTF.EREFIF bit = 1 (reference oscillation completion), clear the RFC_nINTF.EREFIF
bit and then go to Step 6.
ii.
If the RFC_nINTF.OVTCIF bit = 1 (time base counter overflow error), clear the
RFC_nINTF.OVTCIF bit and terminate measurement as an error or retry after altering the
measurement counter initial value.
6. Clear the RFC_nINTF.ESENAIF, RFC_nINTF.ESENBIF, and RFC_nINTF.OVMCIF bits by writing 1.
7. Set the RFC_nTRG.SSENA bit (sensor A) or the RFC_nTRG.SSENB bit (sensor B) corresponding to the
sensor to be measured to 1 to start sensor oscillation.
8. Wait for an RFC interrupt.
i.
If the RFC_nINTF.ESENAIF bit = 1 (sensor A oscillation completion) or the RFC_nINTF.ESENBIF bit
= 1 (sensor B oscillation completion), clear the RFC_nINTF.ESENAIF or RFC_nINTF.ESENBIF bit
and then go to Step 9.
ii.
If the RFC_nINTF.OVMCIF bit = 1 (measurement counter overflow error), clear the
RFC_nINTF.OVMCIF bit and terminate measurement as an error or retry after altering the
measurement counter initial value.
9. Read the RFC_nMCH and RFC_nMCL registers (measurement counter) and correct the results
depending on the sensor to obtain the detected value.
S1C31D50 TECHNICAL MANUAL
(Rev. 1.00)
Seiko Epson Corporation
20-5

Advertisement

loading