Remote Processing RPC-210 User Manual
Page 45

ANALOG I/O
BASIC
SECTION 10
Page 10-3
A problem w ith offset and gain errors is that, at the
extreme ranges, readings are probably unreliable. The
upper and lower 100 mV should be deemed as unusable.
Offset
Offset is the initial, or base voltage the A/D reads with 0
volts input. It is also the output voltage of a D/A w hen
comm anded to outpu t 0 volts. Offset er rors are typica lly
±25 mV, but can be as high as ±50 mV. Offset errors
are reduced or elim inated simply by subtracting the error
from the curr ent reading.
Gain
An offset error is specified at 0 volts while a gain error
is specified at full scale. Gain err or, then, is the
differen ce betwe en what sho uld be rea d at full scale
(either 2.500V or 5.000V) and what is actually read after
offset is removed. This can be as high as ±25 mV.
Gain in the 5.000V ra nge can be compensated for by
adjusting R16. Gain for the 2. 500V range cannot be
adjusted. Typically it is 2.5V, but can range between
2.45 to 2. 55 volts.
Compensating for offset and gain errors
The best w ay to com pensate for gain and offse t erro rs is
t o a c co u nt fo r th e m in y ou r p ro g r am . T y p ic a ll y s o m e
kind of sensor or other device is connected to the board
anyway. Perform ing a 2 point calibration (offset and
gain) will remove most errors. See AIN-3.BAS for an
example of how these errors are compensated for.
NOISE
An input channel can appear to be noisy (change
reading s at rando m) if unuse d inputs are allowed to floa t.
To m inimize noise (and incr ease accur acy), connect all
unused inputs to ground.
RPBASIC-52 takes 8 reads and averages them before
returning the result. In theory, this filters out random
noise from the C PU and external sourc es. N oisy
environments may still require capacitors on the front
end.
A high im pedance inp ut is, by definition, sensitive to
voltage pickup. Noise is minimized by running wires
away from A C 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. U sing the
shield for power ground defeats its purpose. Wire pairs
can also be twisted. 5-6 twists/foot provides a good
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 unde r good op erating cir cumstan ces 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 7 or more
samples seems to cancel out any effects of noise. A
problem with this is noise tends to group together.
Taking 7 readings at one time might show no change
from the norm . Another 7 readings might be all high.
If possible, try to spread out readings over a period of
time.
Noise is, by definition, random . If you wer e to plot out
the deviations from a norm, it would roughly resemble a
bell shaped curve. Exper iments on the RPC-210 have
shown that 99% of readings can be w ithin ±3 counts.
The conversion clock is set for minimum noise.
CONVERTING ANALOG
MEASUREMENTS TO REAL WORLD
UNITS
Inputs are converted to engineering units of measurement
by performing scaling calculations in the program. The
AIN function returns values from 0 to 4095. To change
these numbers into something more m eaningful, use the
following formula:
var = K * AI N (n)
n is the analog channel to read. K is the scaling
constant. K is obtained by dividing the highest number
in the range of units by the maximum AIN count (4095).
var result is in real wor ld units (PSI, p ounds, inch es,
volts, etc.)
E x am p le 1 : T o m ea su r e t he r es ul ts of an A / D
conversion in volts and the voltage range is 0 to 5V,
divided 5 by 4095 to obtain K.
K = 5/4095
K = .001221
Your program could look something like:
1000 C = .001221 * AIN(N)
Example 2: Y ou want to measure a 0 to 200 PSI
pressure transducer w ith a 0 to + 5V output. Divide 200
by 4095 to obtain the constant K.