05-02-2016 04:18 AM
Hi
I am doing some tests with the DaqMX API for .NET. Please note that I am not using Measurement Studio but only the .NET API (see the references below).
I am an experienced programmer but completely new to National Instruments products (hardware and software).
The issue
I have used MAX (Measurement and Automation Explorer) to set up a few virtual (global) channels.
In my .NET application i wish to:
Listing the channels is easy (the DAQmx.DaqSystem.Local.GlobalChannels string array), but the second one is harder.
The only way I have found so far is:
Public Function getVirtualChannelByName(channelName As String) As DAQmx.Channel Try Dim dummyTask As New DAQmx.Task Dim ch As DAQmx.Channel = dummyTask.AddGlobalChannel(channelName) dummyTask.Timing.ConfigureSampleClock("", 100, DAQmx.SampleClockActiveEdge.Falling, DAQmx.SampleQuantityMode.ContinuousSamples) dummyTask.Control(DAQmx.TaskAction.Verify) Return ch Catch ex As Exception Throw ex End Try End Function
Is there a better way of doing this? Or are there maybe any logical limitations which prevents the API from retrieving the channel information without it being added to a task? Clearly MAX can do it, so I think this would be possible.