Daqdevice.readscandata(), Readscandata() – Measurement Computing DAQFlex User Guide User Manual
Page 27
DAQFlex Software User's Guide
DAQFlex Software Reference
27
The ToString method has additional overloads that accept formatting parameters. The overloads are
ToString(string format), ToString(IFormatProvider provider) and ToString(string format,
IFormatProvider provider). The overloads can be used to format the numeric part of a response, if
present. If the response does not contain a numeric, these overloads are ignored.
If an error occurs while sending a message to a device, the SendMessage method will
throw an
exception
rather than returning an error code. This means the application should encapsulate calls
to SendMessage within a try/catch block.
Refer to the following sample code.
C#
try
{
DaqResponse response = MyDevice.SendMessage(message);
label1.Text = response.ToString();
}
Catch (Exception ex)
{
// handle exception
label1.Text = ex.Message;
}
VB
Try
DaqResponse Response = MyDevice.SendMessage(Message)
Label1.Text = Response.ToString()
Catch Ex As Exception
' handle exception
Label1.Text = Ex.Message;
End Try
DaqDevice.ReadScanData()
Reads data for a scan operation.
C#:
double[,] ReadScanData(int samplesRequested, int timeOut);
VB:
Function ReadScanData(ByVal samplesRequested As Integer, ByVal timeOut
As Integer) As Double(,)
Parameter
samplesRequested
The number of samples per channel to read.
timeOut
The number of milliseconds to wait for the samples requested to become available.
Return value
An array of data samples read from the device.
Remarks
The DAQFlex library always performs scan operations in the background, but ReadScanData()
always runs in the foreground. When called, ReadScanData() returns control to the application that
called it when the number of samples requested has been read. When timeOut is non-zero, if the
number of samples requested isn’t available within the time specified by timeOut, an exception is
thrown. The DAQFlex library manages all memory allocation and array indexing so the application
doesn't have to.