
ANALOG INPUT SECTION 10
Page 10-3 RPC-320
into an array which requires 6 bytes per entry. The
second example takes only two byes per entry, can save
to extended m emory, but requires a longer time to get a
data point.
The program below takes about 1.5 ms per data point.
10 DIM A(254)
20 FOR X=0 TO 254
30 A(X) = AIN(0)
40 NEXT
This next program saves data above MTOP. MTOP was
previously set. However, if you have 128K or more
RAM, you can POKE into segment 1 or higher. It takes
approximately 2 mS per data point and is not affected by
the memory location saved to.
10 A = 30000
20 FOR X=0 TO 999
30 POKE W0,A,AIN(0)
40 A=A+2
50 NEXT
Data is retrieved using the PEEK W command.
Noise Notes
An input channel can appear noisy (change readings at
random) if unused inputs are allowed to float. To
minimize noise (and increase accuracy), connect all
unused inputs to ground.
A high impedance input is, by definition, sensitive to
voltage pickup. Noise is minimized by running wires
away from AC power lines. A low impedance voltage
source helps to reduce noise pick up. Shielded cable can
help reduce noise from high impedance sources. Make
sure the shield is not used for power ground. Using the
shield for power ground defeats its purpose.
Wire pairs can also be twisted. 5-6 twists/foot provides
a reasonable amount of noise cancellation.
Noise is defined in this section as any random change
from a known input. The amount of noise you can
expect under nor mal operatin g circumstances is ±3
counts for any input range.
One way to compensate for noise is to take a number of
samples and average the results. Taking 6 or more
samples would, in theory, cancel out any effects of
noise. A problem with this is noise tends to group
together. Taking 6 readings at one time might show no
change from the norm. Another 6 readings might be all
high. If possible, try to spread out readings over a
period of time (several seconds if possible).
Another way is place a capacitor (0.1 to 1 mfd) between
the input terminal and ground. This is useful when the
source resistance is high.
Noise is, by definition, random. If you were to plot out
the deviations from a norm, it would roughly resemble a
bell shaped curve. Experiments on the RPC-320 have
shown that 99% of the readings are within the ±3 count
reading and 60% are ±1 count. Noise readings were
made with all inputs shorted to ground.
Temperature Measurement
Reference IC U14 outputs a voltage proportiona l to its
temperature. This information is used to determine
approximate ambient temperature in order to turn on
fans or heaters.
Vo = 2.1(T + 273)
or
T = Vo/2. 1 - 273
or
T = Vc * .581428 - 273
Where T = Te mp eratu re in °C
Vo = Output voltage in mV
Vc = Count returned using AIN, 0 -
5V range
At 25°C the output voltage is approximately 625 mV, or
506 counts. Vo is expressed as a milli-volt number
(625) not .625.
The output from U14 must be buffered. To measure
temperature, jumper H1[1-3]. Remove resistor R13.
Jumper H1[2-4]. Temperature is read at analog channel
0. The sensitivity is incr eased by jumpering H 1[5-7] to
ground. This will double the output voltage and any
voltage changes due to temperature.
100 T = AIN(0) * .581428 - 273
T returns the temperature in celsius.
Sensitivity is increased by jumpering H1[5-7] to ground.
This doubles the output voltage and any voltage changes
due to temperature.
NOTE: Temperatur e measurements are approximate
and are meant as a guide to indicate ambient
temperature.