National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference SCXI_AO_Write
NI-DAQ FRM for PC Compatibles 2-320
©
National Instruments Corporation
2: Translate a voltage or current value to binary, return in binaryWritten.
rangeCode is the voltage or current range to be used for the analog output channel.
0: 0 to 1 V.
1: 0 to 5 V.
2: 0 to 10 V.
3: –1 to 1 V.
4: –5 to 5 V.
5: –10 to 10 V.
6: 0 to 20 mA.
voltCurrentData is the voltage or current you want to produce at the DAC channel output.
If opCode = 1, NI-DAQ ignores this parameter. If opCode = 2, this is the voltage or current
value you want to translate to binary. If the value is out of range for the given rangeCode,
SCXI_AO_Write returns an error.
binaryData is the binary value you want to write directly to the DAC. If opCode is not 1,
NI-DAQ ignores this parameter.
Range: 0 to 4,095
binaryWritten returns the actual binary value that NI-DAQ wrote to the DAC.
SCXI_AO_Write uses a formula given later in this section using calibration constants that
are stored on the module EEPROM to calculate the appropriate binary value that will produce
the given voltage or current. If opCode = 1, binaryWritten is equal to binaryData. If
opCode = 2,
SCXI_AO_Write calculates the binary value but does not write anything to the
module.
Using This Function
SCXI_AO_Write uses the following equation to translate voltage or current values to binary:
B
w
= B
l
+ (V
w
- V
l
) * (B
h
- B
l
) / (V
h
- V
l
)
where
B
l
= binary value that produces the low value of the range
B
h
= binary value that produces the high value of the range
V
h
= high value of the range
V
l
= low value of the range
V
w
= desired voltage or current
B
w
= the binary value which will generate V
w
NI-DAQ loads a table of calibration constants from the SCXI-1124 EEPROM load area.
The calibration table
contains values for B
l
and B
h
for each channel and range.