Reading hardware-paced i/o – Measurement Computing DAQFlex User Guide User Manual
Page 19

DAQFlex Software User's Guide
Using DAQFlex Software
19
' Stop the counter
MyDevice.SendMessage("CTR{0}:STOP")
Catch Ex As Exception
' handle error
Label1.Text = Ex.Message
End Try
Reading hardware-paced I/O
The basic approach to programming analog input scans is to set the device's scan properties, send the
START
command, and call the
ReadScanData()
method. The following examples show how to program a
basic input scan.
C#
try
{
double[,] scanData;
string[] names = DaqDeviceManager.GetDeviceNames(DeviceNameFormat.NameAndSerno);
DaqDevice device = DaqDeviceManager.CreateDevice(names[0]);
device.SendMessage("AISCAN:LOWCHAN=0");
device.SendMessage("AISCAN:HIGHCHAN=0");
device.SendMessage("AISCAN:RATE=1000");
device.SendMessage("AISCAN:SAMPLES=5000");
device.SendMessage("AISCAN:START");
scanData = device.ReadScanData(5000, 0);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
VB
Try
Dim ScanData As Double(,)
Dim Names As String()
Dim Device As DaqDevice
Names = DaqDeviceManager.GetDeviceNames(DeviceNameFormat.NameAndSerno)
Device = DaqDeviceManager.CreateDevice(Names(0))
Device.SendMessage("AISCAN:LOWCHAN=0")
Device.SendMessage("AISCAN:HIGHCHAN=0")
Device.SendMessage("AISCAN:RATE=1000")
Device.SendMessage("AISCAN:SAMPLES=5000")
Device.SendMessage("AISCAN:START")
ScanData = Device.ReadScanData(5000, 0)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try