Hi All,
I am developing a C# program which can communicate the device through Digital I/O.
In my PC I have a Digital I/O card.
After I made the write code base on the DAQmx example, the code doesn't give back error, but I can't see anything in the NI IO Trace. (I've started capturing...)
The example program does the same issue.
I don't know what the problem is. Nevertheless, If I push the start button on the test panel I can see the captured communication lines.
Please help me whether the example code wrong or the NI IO Trace.
The example source code as below or in the attachement:
private void writeButton_Click(object sender, System.EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
try
{
using (Task digitalWriteTask = new Task())
{
// Create an Digital Output channel and name it.
digitalWriteTask.DOChannels.CreateChannel(physicalChannelComboBox.Text, "port2",
ChannelLineGrouping.OneChannelForAllLines);
// Write digital port data. WriteDigitalSingChanSingSampPort writes a single sample
// of digital data on demand, so no timeout is necessary.
DigitalSingleChannelWriter writer = new DigitalSingleChannelWriter(digitalWriteTask.Stream);
writer.WriteSingleSamplePort(true, (UInt32)dataToWriteNumericUpDown.Value);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
Cursor.Current = Cursors.Default;
}
}