Remote-processing RPC-2350 Manuel d'utilisateur Page 45

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 83
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 44
CHAPTER 8 ANALOG I/O
8-3
The input range is -2.5V to + 2.5V. The result from an
AIN function is 0 for -2.500V, 2048 for 0. 000V, and
4095 for + 2.4998V.
4. Differential, ±2.5V input
CONFIG AIN chan,0,0
The input r anges from -2. 5V to + 2.5V. The r esult is
the difference of the two voltages. AIN will return 0
for a difference of -2.500V, 2048 for a difference of
0.000V, and 4095 for a difference of 2.498V.
ACQUIRING ANALOG DATA
Once the analog input is initialize d, the AIN function is
used to acquire data. The syntax is:
S = AIN(ch)
Where: ch = channel number, 0-7
This command reads the voltage and returns a number
from 0 to 4095 to the variable S. The number returned
corresponds to the voltage input and the type the channel
was configured for.
To convert the returned numbers to a voltage, use the
following formulas:
5V Unipolar: A = 0.0 0122 * AIN(chan nel)
±2.5 Bipolar: A = 0.00244 * AIN (channel) - 5
The AIN function requir es about 500 m icro-Seconds to
convert a channel of data. Additional time is needed to
store the data. Saving data to a single dimension array
takes 500 micro-seconds longer than saving to a sim ple
variable.
Data logging on a timer tick
Some application require that data be taken at fixed
intervals. The ON TIC K construct can be used to take
data in intervals from 0.01 to 655.35 seconds. The
program below takes 100 samples on 2 channels every
10 seconds.
10 DIM F(100,2)
20 ON TICK 10 GOSUB 50
30 ..this is a dummy loop
40 GOTO 30
50 F(I,0) = AIN(0)
60 F(I,1) = AIN(1)
70 INC I
80 IF I = 100 THEN ON TICK 10 GOSUB
90 RETURN
Line 80 shuts off interrupts after 100 samples.
MEASURING HIGHER VOLTAGES
Input voltages higher than 5V are measured by placing a
resistor in series with the input. Use the following
formula to determine the required series resistance:
Rs = Vi * 20,000 - 100, 000 0-5V range
Rs = Vi * 40,000 - 100, 000 0-2.5V range
Rs is the resistor value in ohms in ser ies with the input.
Vi is the maximum input voltage. If the result of your
calculation is 0 or negative, a series resistor is not
necessary.
NOTE: When an input voltage exceeds its voltage
range, other channels values are affected.
The 100K ohm resistor is R15. This is a 2% part. Y ou
may want to add a trim resistor in series with a fixed to
obtain higher accuracy.
Since input impedance is higher , noise incr eases. A
capacitor at the appropriate channel at W13 will reduce
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 meaningful, use the
following formula:
var = K * AIN(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 world units (PSI, pounds, inches,
volts, etc.)
Example 1: To measure the results of an A/D
conversion in volts and the voltage range is 0 to 5V,
Vue de la page 44
1 2 ... 40 41 42 43 44 45 46 47 48 49 50 ... 82 83

Commentaires sur ces manuels

Pas de commentaire