LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to update task programatically each time NI USB device is attached?

Solved!
Go to solution

Hi. May I know how the task in NI MAX can be modified programtically each time a different NI USB device is attached, without any user to do anything?

 

I have created few taks for NI USB-6221, However, when the NI USB-6229 is attached, Dev 2 appears instead of Dev 1.

Can we create a program that automatically updates the task in NI MAX before the actual operation of the new device? 

 

Please advise.

Thanks in advance.

Clement

0 Kudos
Message 1 of 5
(2,542 Views)

Hi,

 

Sometimes I use either a USB-6501 or USB-6008 but I search to see which is connected based on the model I want and return the 'Dev' number.  See attached, hope it helps.

 

Regards,

0 Kudos
Message 2 of 5
(2,532 Views)

Hi I think I did not not make myself clear. In case of changed model (NI USB device) with similiar specifications, we delete the missed device in NI MAX and replaced the DEV1 with DEV2 and the following tasks  will be updated immediately. So can it be same way for labview program that automatically replaced the device abd update the tasks automatically after change of device, without any user interference.

 

Clement

0 Kudos
Message 3 of 5
(2,517 Views)

Hi Clement,

 

you need some user interaction in every case. If you programmed your device with the name like "Dev1" you only need to change the device in MAX and everything works fine. So if you want to replace your 6221 with an 6229 all you need to do is change the name from Dev2 to Dev1 (delete Dev1 before that or change the name) and your LabVIEW programm will work with the new Dev1 device.

 

How many devices are connected to your PC at the same time?

 

Stefan

0 Kudos
Message 4 of 5
(2,502 Views)
Solution
Accepted by topic author astroboy

Hi, if I understand you correctly, if you use the code I showed then it doesn't matter what the Dev number is.  It only matters if you have more than one device attached to the PC of the same model.  If you only have 1 device connected at any one time then the code I showed would retrieve the Dev number for that device and your task code can then use it.  I don't believe there is any need to change Dev assignments in MAX.

0 Kudos
Message 5 of 5
(2,490 Views)