From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-11-2013 03:15 AM
I would like to use the pure C# way to communicate with CompactDAQ devices that are on our local lan.
So no NI MAX - only native C# using NationalInstruments.DAQmx napespace (+Common :-).
I can't find any examples etc. only the usual configuration setups - how do I go from IPnumber only (or perhaps event through discovery)
It is needed for some automatic configuration setups where the hardware is being swapped from time to time by an operator.
06-20-2013 08:29 AM
Hi Larover 88
Did you find a solution to your problem?
There is as far as I know no built in functions for auto discovery of DAQ devices. But if you have configured them with an IP address then it is faily simple.
1) First you need to reserve the chassis to your PC and add it. Take a look at these two functions in the manual:
NationalInstruments.DAQmx.DaqSystem.AddNetworkDevice()
NationalInstruments.DAQmx.Device.ReserveNetworkDevice()
2) After you have added the device and reserved it you can use it as a traditional DAQ device. Like in this articles
http://www.ni.com/white-paper/5409/en/#toc4
http://www.ni.com/white-paper/2835/en/
Best Regards
Anders Rohde
Applications Engineer
National Instruments Denmark
06-20-2013 08:35 AM
As Anders mentioned, you can reference the chassis by IP address or hostname when using the AddNetworkDevice() method. After that, it will have a DAQmx device name (like cDAQ9191-<serial number>) and you can use the DAQmx functions as if it was a device connected directly to the PC.
Just to avoid any possible confusion from ambiguity: once the chassis is added and reserved, you can use it as you might have traditionally used other NI-DAQmx devices. It can not be used with the Traditional NI-DAQ driver, though.
For programmatic discovery and configuration, you can consider the NI System Configuration API. Here is a quick reference that claims support for Visual Studio environments, though I can't vouch for whether or not they specifically provide a C# API. So you may need to do some integration work to call into one of the supported APIs from your application.
06-20-2013 08:36 AM
I did find a partial solution - I ended up reserving the device in NIMAX and then create the rest in C#.
Is there a best practice paper / white paper for .NET (or C++) interfacing - describing the intended interaction between the different classes?
It seems to me that the focus of the NI documentation effort has switched greatly to LabView which in the end caused the pure code based work to lag behind a bit when comparing to 10 years ago.
07-08-2015 05:04 AM - edited 07-08-2015 05:06 AM
It can be done in fully in code:
DaqSystem.Local.AddNetworkDevice("169.254.228.179", "cDAQ9188XT", 10)
DaqSystem.Local.LoadDevice("cDAQ9188XT").ReserveNetworkDevice()
This is done in VB.NET but should be easy to port it to C#
05-27-2016 06:43 AM
This seems to be a bit of an oversight on NI's part.
I used Anders suggestion but had to modify it slightly to get it to work:
Device device = NationalInstruments.DAQmx.DaqSystem.Local.AddNetworkDevice("169.254.69.102", "cDAQ9184", 30);
device.SelfTest();
Tom Martin
Software Engineer
JetSoft.co.uk