ANALOG INPUT
following tables for differ ential inputs.
When channel = odd
Pol. | - | + | - | + | - | + | - | + |
CH # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
channel | 1 |
|
| 3 | 5 |
|
| 7 |
When channel = | even |
|
|
|
|
| ||
Pol. | + | - | + | - | + | - | + | - |
CH # | 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
A
When operating in differential mode, r elative + 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
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
SECTION 10
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)
CONFIG AIN channel, 1 , 0
The result is 0 for
Acquiring Analog Data
Analog data is accessed with the AIN function. The syntax is:
A = AIN(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
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
Use the following formulas to convert a returned number to a voltage:
0 - 5V A = . 001221 * AIN(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
Page