
ANALOG INPUT
SECTION 10
Page 10-2 RPC -320
following tables for differ ential inputs.
When
channel
= odd
Pol.
-
+
-
+
-
+
-
+
C H #
0
1
2
3
4
5
6
7
channel
1
3
5
7
When
channel
= even
Pol.
+
-
+
-
+
-
+
-
C H #
0
1
2
3
4
5
6
7
channel
0
2
4
6
When
range
= 0, the input is ±2.5 v olts and a 1 = 0 to
5 volts.
Differential Mode
When d ifferential m ode is specified , inpu ts are actu ally
pseudo-differential. What this means is that a ground
reference is needed. For example, you cannot place a
battery be tween ch annel 0 and 1 and get an ac curate
reading. T he (-) input must be referenced to ground.
An example of where pseudo-differential works is an
output from a bridge network.
A pseudo-differential input subtracts the DC component
from an input. T he IC maker recomm ends the (-) input
remain stable within 1 count with respect to ground for
best results. Connecting a 0. 1 uF capacitor from the (-)
input to grou nd wor ks well.
When operating in differential mode, r e and -
voltages must be connected to specific inputs. When
inputs are reversed, a conversion returns a 0. When the
relative voltage changes, perform a conversion on the
alternate c hannel. CON FIG AIN is p erfor med on b oth
channels.
Pairs of channels c an be differ ential while oth ers single
ended. Thus, if channel 0 and 1 are differ ential inputs,
channels 2-7 may be single ended.
Examples u sing CON FIG AIN
Below are sample syntaxes for CO NFIG AIN
Differential, 0 to + 5V input
CON FIG AIN 0,0, 1
CON FIG AIN 1,0, 1
Per form a conver sion as nor mal:
A = AIN(0)
The difference between channel 0 and 1 is returned.
When channel 1 is more positive than channel 0, the
result is zero. The differenc e is read on channel 1 by
performing:
A = AIN(1)
Single-ended, ±2.5V input
C O N F I G A IN
channel
, 1 , 0
The result is 0 for -2.500V input, 2048 for 0. 000V, and
4095 for + 2.4988V.
Acquiring Analog Data
Analog data is accessed with the AIN function. The
syntax is:
A = A I N (
channel
)
This function assigns the analog value of a channel to the
variable ; A in th is case. The value retur ned is alway s in
the 0 to 4095 range bec ause the converter is 12 bits.
Power up or reset default configures inputs to the 0-5V
range, single ended.
To view the result of a conversion in the command
mode, type:
print ain(0)
The result at channel 0 is returned. T he returned value
will always be in the 0 to 4095 range. When using a
channel in the ±2. 5V ra nge, the value r eturned is
interpreted differently. Zero count is now -2.500V,
4095 is + 4.9988, and 2048 is 0.000V.
Use the following formulas to convert a returned number
to a voltage:
0 - 5V
A = . 0 0 12 2 1 * A IN (
channel
)
±2.5V
A = .001221 * ain(
channel
) - 2.5
The AIN function require s about 1.5 ms to convert the
data. Additional time is needed to store the data. The
example below takes 255 data samples and stores them