Remote Processing RPC-330 User Manual
Page 37
ANALOG INPUT
SECTION 10
Page 10-3 RPC -330
40 NEXT
This next program saves data to RAM segment 1 in a
s y st e m w i th 1 28 K of R A M . I t t ak e s a p pr o x im a te l y 2 m S
per data point and is not affected by the memor y location
saved to.
10 A = 0
20 FOR X=0 TO 999
30 POKE W1,A,AIN(0)
40 A=A+2
50 NEXT
Data is retrieved using the PEEK W command.
Noise Notes
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.
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 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
exp ect und er nor ma l op er atin g ci rc um sta nce s 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. Ta king 6 readings at one time might show no
change fr om the no rm. Another 6 reading s might be a ll
high. If possible, try to spread out readings over a
period of time (several seconds if possible).
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-330 have
shown that 99% of the readings are w ithin the ±3 count
reading . N oise read ings wer e made with all inputs
shorted to ground.
Temperature Measurement
Refer ence IC U14 outp uts a voltage pr oportiona l to its
temperature.
Vo = 2.1(T + 273)
or
T = Vo/2. 1 - 273
or
T = Vc * .581428 - 273
Where T =
Te mp er atu re in °C
Vo =
O u tp u t v o lt a ge in m V
Vc =
Count returned using AIN , 0 -
5V range
At 25°C the output voltage is approximately 630 mV, or
516 counts.
The output from U14 must be buffered. To measure
temperature, jumper H1[1-3]. Remove resistor R13.
Jumper H1[2-4]. Tem perature is read at analog channel
0.
100 T = AIN(0) * .581428 - 273
T retur ns the tempera ture in celsius.
The outpu t from the tempe ratur e sensor v aries fr om unit
to unit.
You can increase the output voltage from the
t e mp e r at ur e se n so r b y l ow e r in g R1 2 an d gr o u nd in g H 1
pin 5 (jumper H1-5 to H1-7).
Data logging on a timer tick
Some applications require that data is read at fixed
intervals. The O NTIC K construct can be used to take
data in interv als from 0.0 1 to 327 secon ds. T he exam ple
below takes 1 sample per second until 100 samples have
been obtained.
10 DIM A(100)
20 ONTICK 1,500
30 REM THE REST OF YOUR PROGRAM
40 REM CONTINUES
80 GOTO 30
500 A(N) = AIN(3)
510 N=N+1
520 IF N = 100 THEN ONTICK 0,500
530 RETI