Measurement Computing DAQFlex User Guide User Manual
Page 10

DAQFlex Software User's Guide
Using DAQFlex Software
10
VB
Dim deviceNumber As Integer
Dim device As DaqDevice
Dim deviceName As String
deviceNumber = 0
deviceName = deviceNames(deviceNumber)
device = DaqDeviceManager.CreateDevice(deviceName)
4.
Once you have a DaqDevice object, use the SendMessage() method to program your DAQFlex-
supported device.
C#
DaqResponse response;
response = device.SendMessage("AI{0}:RANGE=BIP10V"); // set the input range for channel 0
response = device.SendMessage("?AI{0}:VALUE"); // read a single value from channel 0
VB
Dim response As DaqResponse
response = device.SendMessage("AI{0}:RANGE=BIP10V") ' set the input range for channel 0
response = device.SendMessage("?AI{0}:VALUE") ' read a single value from channel 0
The DaqResponse object contains a method for getting the response as a string and a method for
getting the response as a numeric.
To get the response as a string, use the ToString() method:
C#
string value = response.ToString();
VB
Dim value As String
value = response.ToString()
To get the response as a numeric, use the
ToValue()
method:
C#
double value = response.ToValue();
VB
Dim value As Double
value = response.ToValue()
If the response does not contain a numeric value, ToValue() returns Double.NaN.
When you no longer need the DaqDevice object, you can release it by calling the ReleaseDevice()
method:
C#
DaqDeviceManager.ReleaseDevice(device);
VB
DaqDeviceManager.ReleaseDevice(device)