Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

read digital output usb

Hello,
 
I need to read the current digital output state for each line when my program is started.  I'm using the USB-6501 board.  Can this be done?  I'm using .Net 2.0 and measurement studio. 
 
Thanks,
 
Jeff
0 Kudos
Message 1 of 2
(3,189 Views)
Jeff,

Thanks for posting to the NI forums.  You can check the digital output state for each line by creating a task containing a digital output channel and then reading from the channel.  In C# it would look something like the following:

CNiDAQmxTask myTask = new CNiDAQmxTask();
myTask.DOChannels.CreateChannel(physicalline,"",DAQmxOneChannelForAllLines);
CNiDAQmxDigitalSingleChannelReader reader(myTask.Stream);
value = reader.ReadSingleSampleSingleLine();

This will return the current value of the digital line.  Let me know if you have further questions about how to implement this functionality.

Regards,

Neil S.
Applications Engineer
National Instruments

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