01-16-2023 02:26 PM
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?
Solved! Go to Solution.
01-16-2023 11:08 PM
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
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.
01-17-2023 07:39 AM - edited 01-17-2023 07:47 AM
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.