10-15-2007 03:15 PM
Hi,
I am trying to get the available channels for a selected device in Visual C#. I was able to get a list of available devices connected onto the system into a combo box by
cboDevices.Items.AddRange(DaqSystem.Local.Devices);
The user is supposed to select a device and then I need to find how many channels this device has. Is there a method or function that I can call to retreive the available channels?
I know that in the sample code there is the following code that gets the total number of channels but for all the NI devices connected onto the system:
numOfChannels = DaqSystem.Local.GetPhysicalChannels(PhysicalChannelTypes.AI, PhysicalChannelAccess.External).Length;
I just need it for one specific device. If any one knows about a method please inform me. Thanks.
10-16-2007 05:02 PM
Hi Daniel,
I understand that you want to find a C# function that gets the number of channels in a specific device in your system. If you are using DAQmx, you can access a function that will return an array of strings of the analog input channels of the device. You will have to access the Device class and the AIPhysicalChannels Property. You are currently under the Daqsystem class which will give you access to system properties. This is why you are getting all the physical channels in the system and not just in the device you specify. The DaqSystem.Devices Property will allow you to access the specific device you need and then you can use the Device class and the AIPhysicalChannels property to access a list of channels. From there you can access the length of that array to get the number of channels. Hope this information is helpful!