From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx and NI IO Trace

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;
}
}

0 Kudos
Message 1 of 3
(2,128 Views)

Please somebody help me...

0 Kudos
Message 2 of 3
(2,091 Views)

Hi BarnabasKiss,

 

I hope this reply is not too late for you.

 

Did the code worked as expected? On the first view I don't see a problem with the code and would expect it to run properly. So I guess the IO-Trace is the problem. Why are you using IO-Trace, have you had any driver issues during development?

Is it possible that you changed the Filter-Settings (Tools->Recording...) to not log DAQmx-Messages?

 

I hope this helps out and my reply is not too late!

 

Jan Göbel

Staff TSE

National Instruments

0 Kudos
Message 3 of 3
(1,999 Views)