Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I configure the USB-6501 DIO ports as push-pull?

Solved!
Go to solution

I am using this code in my Visual C# application to write digital outputs on the USB-6501 after adding NationalInstruments.Common and NationalInstruments.DAQmx as References:

 

using NationalInstruments.DAQmx;

 

private static void writeport(int value)
{
    try
    {
        using (Task digitalWriteTask = new Task())
        {
            digitalWriteTask.DOChannels.CreateChannel("Dev1/port2", "MyPort", ChannelLineGrouping.OneChannelForAllLines);

 

            DigitalSingleChannelWriter writer = new DigitalSingleChannelWriter(digitalWriteTask.Stream);
            writer.WriteSingleSamplePort(true, value);
        }
    }
    catch (Exception ex)
    {
    }
}

 

I want to configure the USB-6501 DIO ports as push-pull. What is the syntax for doing this and will the USB-6501 retain that configuration after power cycling it?

 

I found this documentation on the NI website:

https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/mxcprop/attr1137.html

 

I see that DAQmxSetDOOutputDriveType() can be used to set the drive type to DAQmx_Val_ActiveDrive but I don't know how to access this API from C#. Any suggestions?

 

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

Somehow your post is exactly the same except for the difference in language - https://forums.ni.com/t5/Digital-I-O/USB-6501-Drive-Type-configuration-with-Python-nidaqmx-and-NI-MA...

 

There is  a property to set that in DAQmx in .NET

 

santo_13_0-1673931984737.png

This documentation is available under C:\Users\Public\Documents\National Instruments\NI-DAQ\Documentation if you have installed DAQmx support for .NET

 

I don't think the value of this property will persist on power cycle, as a safe bet, always set this property on creating the task.

 

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 3
(1,283 Views)
Solution
Accepted by scottmorgan

Thank you for the response. Here is the solution in practice and it works!


DOChannel ch = digitalWriteTask.DOChannels.CreateChannel("Dev1/port1", "MyPort", ChannelLineGrouping.OneChannelForAllLines);
ch.OutputDriveType = DOOutputDriveType.ActiveDrive;

 

We also have removed all of the weak pull-up resistors from the USB-6501 so that the outputs don't automatically powerup high when the board powers up.

 

 

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