private void btnInit_Click(object sender, EventArgs e)
{
DeviceInformation myDevice = new DeviceInformation();
myDevice.Description = "DemoDevice,BID#0";//板卡名称,可以从DAQ上面找到
myDevice.DeviceMode = AccessMode.ModeWrite;//板卡模式
myDevice.DeviceNumber = 0;//板卡编号,可以从DAQ上面找到
myDevice.ModuleIndex = 0;//
instantAiCtrl1.SelectedDevice = myDevice;
//The default device of project is demo device, users can choose other devices according to their needs.
if (!instantAiCtrl1.Initialized)
{
MessageBox.Show("No device be selected or device open failed!", "AI_InstantAI");
this.Close();
return;
}
else
{
listBox1.Items.Insert(0, "初始化成功!");
this.btnInit.Enabled = false;
}
}
// 读一下--单通道,每次只能读到一个数据
private void btnRead_Click(object sender, EventArgs e)
{
double dblData = 0;
ErrorCode er = instantAiCtrl1.Read(0, out dblData);
this.listBox1.Items.Insert(0, dblData.ToString("0.0000"));
}
// 读一下--多通道,一个通道每次只能读到一个数据
private void btnReadM_Click(object sender, EventArgs e)
{
double[] dblData = new double[1024];
ErrorCode er = instantAiCtrl1.Read(0, 8, dblData);
//this.listBox1.Items.Insert(0, dblData.ToString("0.0000"));
}