ANALOG INPUT
into an array which requires 6 bytes per entry. The second example takes only two byes per entry, can save to extended m emor y, b ut requir es a longer time to get a data point.
The pr ogram below take s 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 . M TOP 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)
40A=A+2
50NEXT
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 minim ize noise (and increase accura cy), 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.
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
SECTION 10
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 wer e to plot out the deviations from a norm, it would roughly resemble a bell shaped curve. Exper iments on the
Temperature Measurement
Refer ence IC U14 outp uts a voltage pr oportiona l to its temperature. This information is used to determine approximate ambient temper ature in order to turn on fans or heater s.
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 = 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
The output from U14 must be buffered. To measure temperature, jumper
0.T he sensitivity is incr eased by jum pering H
100 T = AIN(0) * .581428 - 273
T retur ns the tempera ture in celsius.
Sensitivity is increased by jumpering
NOTE: Tem peratur e measu rem ents are a pproxim ate and are meant as a guide to indicate ambient temperature.
Page