Motorola USB08 User Manual

Page 53

Advertising
background image

Software Module Descriptions

Software ADC Module U08ADC.C

USB08 Evaluation Board

Designer Reference Manual

MOTOROLA

Software Module Descriptions

53

First, the switch S is closed and the capacitor C uncharged. As soon as
the switch S is opened, the charging procedure begins. The voltage at
the input E of the microcontroller rises according to the exponential
function:

U

E

(t) = V

CC

(1 – e

(–t/RC)

)

The threshold voltage at the input pin of the MC68HC908JB8, from
which a level change from low to high takes place, is approximately
50 percent of the operating voltage V

CC

. Until this threshold is reached,

the loading time, tx, amounts to:

t

x

= K * R

x

C with K~0,7 for V

CC

/2

Since k represents a constant value (in the considered short time frame),
a linear connection between the measured time and the product RxC
appears. Since C is constant, one can draw a direct conclusion from the
charge time to the value of the resistance Rx.

To determine the absolute resistance of Rx, first the value of the capacity
C and the constant k have to be determined. However, that is not
economical (particularly with series products having a certain distribution
of its value). Instead, one can accomplish a calibration cycle before the
actual measurement. This calibration cycle uses a reference resistance
value R0 and determines the time t0. The following measure cycle uses
series connection Rx, consisting of the reference resistance R0 and the
variable resistance R1 (for example, RX = R0 + R1), to determine the
time tx. The result can be calculated using the relationship:

R

1

/R

0

= (R

x

–R

0

)/R

0

= (t

x

–t

0

)/t

0

The range of values of the result is between 0 and 1, if R1max = R0.

The software ADC module of the USB08 application serves three A/D
channels (see

Section 2. Hardware Description

). Reaching the

threshold voltage is sensed via the port pins PTE[0..2]. The switch
function for charging/discharging the capacitor is realized by switching
the port pins as outputs. In contrast to the circuit diagram (

Figure 3-1

),

the polarity is exchanged (for instance, the point of reference is V

CC

instead of ground) and the charge of the capacitor is made by activating

Advertising