National Instruments 321645c-01 用户手册

下载
页码 554
Appendix B
Analog Input Channel, Gain Settings, and Voltage Calculation
©
 National Instruments Corporation
B-7
NI-DAQ FRM for PC Compatibles
Offset and Gain Adjustment
Measurement of Offset
To determine the offset parameter used in the 
AI_VScale
 and 
DAQ_VScale
 functions, follow this procedure:
1.
Ground analog input channel i, where i can be any valid input channel.
2.
Call the 
AI_Read
 function with gain set to the gain that will be used 
in your real acquisition (g). The reading given by the 
AI_Read 
function is the value of offset. The offset is only valid for the gain 
setting at which it was measured. Remember that the data type of 
offset in the 
AI_VScale
 and 
DAQ_VScale
 functions is floating point, 
so if you use 
AI_Read
 to get the offset, you will have to typecast it 
before passing it to the scale function.
Note
Another way to read the offset is to perform multiple readings using a DAQ 
function call and average them to be more accurate and reduce the effects 
of noise.
Measurement of Gain Adjustment
To determine the gainAdjust parameter used in the 
AI_VScale
 and 
DAQ_VScale
 functions, follow this procedure:
1.
Connect the known voltage V
in
 to channel i.
2.
Call the 
AI_Read
 function with gain equal to g. Use the reading 
returned by 
AI_Read
 with the offset value determined above to 
calculate the real gain.
Note
You can use the DAQ functions to take many readings and average them instead 
of using the 
AI_Read
 function.
The real gain is computed as follows:
The gain adjustment is computed as follows:
G
R
reading
offset
maxReading
-------------------------------------------
maxVolt
V
in
------------------------
×
=
gainAdjust
1
g
G
R
(
)
g
----------------------
=