LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

reassign device names

I have hidden a USB-6009 within a box of sensors that I want to carry arround and connect to different PC's.   A specific CVI program on these PC's uses this box.  But I don't want the user to have to have to go to Measurement & Automation on each of the computers to get the proper device assignment established.  (The user is typically not savy about device configuration stuff, and probably doesn't want to know about it anyway)   Is there a way I can control and configure device assignments programmatically within my CVI program?   Examples would be beneficial.

Thanks.
0 Kudos
Message 1 of 9
(4,624 Views)
Hi Steve,

You can make a call to DAQmxGetSysDevNames() to return the names of all devices currently installed in the system.  You could then parse through to find the device you are using and configure your application accordingly.  The NI-DAQmx C Reference Help (Start>>Programs>>National Instruments>>NI-DAQ) contains information about this system property call as well as others that may be beneficial for your application.

Regards,
Andrew W
National Instruments

0 Kudos
Message 2 of 9
(4,589 Views)
Once the device is configured in MAX won't this function still show the device as there when it is disconnected as it reports the configuration info not that it is connected?
0 Kudos
Message 3 of 9
(4,571 Views)
Hi Kevin,

This property should return only devices that are currently installed in or connected to the system.  I tested this out by installing a USB-6008 and having it detected in MAX.  I then disconnected the 6008, and it was displayed in MAX with a white icon and red X under NI-DAQmx devices.  Calling the system property after doing this did not return my USB-6008 in the array of installed devices.

Regards,
Andrew W
0 Kudos
Message 4 of 9
(4,548 Views)

Andrew,

You are right, I was thinking of DAQmxGetDeviceAttribute with the attribute DAQmx_Dev_ProductType which is not dependent on whether it is connected just that it is configured in MAX.

0 Kudos
Message 5 of 9
(4,522 Views)
Being the originator of this issue, let me further explain what is happening, and why the suggestions so far have not worked.  Suppose I had originally installed a USB-6008 into my PC, and it gets assigned as "DEV1".  Later,  the USB-6008 is replaced with a USB-6009, and it is assigned as "DEV2".   MAX will now show both the USB-6008 assigned as "DEV1" and  the USB-6009 assigned as "DEV2"  in the device table, albeit that "DEV1" is shown with an X, denoting that it is absent.   Since my CVI program expects to use a USB-6009 assigned as "DEV1", I have to perform some corrections in MAX by first deleting the "DEV1" from the table, and then reassign "DEV2" to be the new "DEV1".   I see no functionality in the DAQmx library that allows me to programmatically delete and reassign.
0 Kudos
Message 6 of 9
(4,487 Views)
Hi Steve,

I looked into this some more, and unfortunately the DAQmx API does not provide functions for programmatic deletion or renaming of devices within MAX.  I would recommend a combination of the previously mentioned DAQmxGetSysDevNames() with a call to DAQmxGetDevProductType().  DAQmxGetDevProductType() will return the product name (USB-6008, USB-6009, etc.) of a specified device name (Dev1, Dev2, etc.) so that you could identify programmatically determine that DevX is associated with "USB-6009".  Suppose there is a case where the USB-6009 is installed and assigned a device name of Dev3 because Dev1 and Dev2 are already assigned.  Using this approach would allow you to identify and account for this rather than running into problems by wanting to delete Dev1 and reassigning the wrong device from Dev2 to Dev1.

Regards,
Andrew W
0 Kudos
Message 7 of 9
(4,457 Views)
I've also been contemplating how to handle this problem to improve the customer-proofing of my product, a data acquisition dll for an industrial vibration monitoring and automatic diagnostics system, for liability and customer satisfaction-it's always my fault if my customer gets confused.   You can also detemine the device serial number and whether the device is active or if it is simulated using DAQmxGetDeviceAttribute and I do these things plus getting the product type.  One possibility would be to store the serial number and product type info and make a warning/error popup message and perhaps something more.  In the parent vibration program, assuming the customer hasn't been too "creative" in setting up the system, it's relatively easy to change the device name but  I'm not completely comfortable with that solution.  Furthermore, I can already forsee situations where I may want to insert a layer in the between the calling program and NI's system to handle device and channel naming inconsistencies, some of which may come from the need to interface with other systems beyond my control.  A function to change the device name might be nice.

Duncan
0 Kudos
Message 8 of 9
(4,450 Views)
Hi Duncan,

We always look for ways to improve our products and add features that are important to customers.  I would recommend visiting our Product Suggestion Center here to make recommendations on features you would like to see in our products.

Regards,
Andrew W
0 Kudos
Message 9 of 9
(4,421 Views)