Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Change Device in DAQmx task

I'm sure this is simple but I've been going around in cricles for a while.

 

I have created a task in my project.  It works fine with 6008 (Device 1).

 

task.PNG

 

Now we are building a new system and using a different 6008, imaginatively entitled dev3.

 

Is there anyway to edit the task to change the device, (see below)?

 

dev1.PNG

 

The above should be dev3 but I cannot find a way to set it.

 

Rgds,

Seán

0 Kudos
Message 1 of 9
(4,997 Views)

Did you try right-clicking on the channel?  There should be a menu option for changing the physical channel.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(4,995 Views)

I did indeed, (i'm not that bad!).

 

However, it only allows the channel to be changed and not the device.

0 Kudos
Message 3 of 9
(4,992 Views)

Hi Sean,

 

I have found a method that I've tested with a pair of USB-6009s:

 

  1. With your first device plugged in (dev1) create your tasks
  2. Unplug dev1
  3. Plug in dev3
  4. Delete dev1 from Devices and Interfaces.
    • Select "Leave the items associated with the device" from the dialog box that appears and click OK
  5. Rename dev3 to dev1
  6. The tasks created for your original dev1 will now run on your second device (which was called dev3)

If you need to use both devices on the same PC you can continue with the following steps:

 

  1. Export the NI-DAQmx Tasks and the connected device in an System Configuration Export as explained in this KB:
  2. Rename the connected device back to dev3
    • Click Yes when asked "There are resources that reference this device's name, Do you want to update these resources to use the new name?"
  3. Rename the tasks to something different, for example from "MyVoltageTask" to "MyVoltageTaskDev3". This prevents naming conflicts with the tasks
  4. Plug the first device, dev1, back in
  5. Import the System Configuration you exported in step 1, as described in the KB
    • When warned of a conflict for the device ensure that "Dev1 will be replaced" is selected
  6. You should now have the tasks you created present for both devices

This method has quite a few steps in it however I believe  it should achieve what you were asking for. Hope this helps!

 

Joe

Joe P
Applications Engineer
National Instruments UK & Ireland
Message 4 of 9
(4,921 Views)

Hi Joseph,

 

Thanks for the workaround.  Still a bit surprized there isn't a more straightforward way to change the device.  Maybe next release of LabVIEW will have an easier solution?

 

Rgds,

Seán

0 Kudos
Message 5 of 9
(4,901 Views)

Hello,

 

I am attempting somewhat same, but the problem is I have created many tasks with two USB 6212 devices (for eg. Dev1 and Dev2)

 

Tasks:

Digital_Input_task_USB01

Digital_Input_task_USB02

Digital_Output_task_USB01

Digital_Output_task_USB02

 

The problem, the device may get identified under different names in different systems when shared as application.

 

So, I wanted to ask whether there is any method to keep the channel unchanged ; but to select and change the device programmatically?

 

This may help the user to change device from Front panel without any knowledge of Ni Max.

 

0 Kudos
Message 6 of 9
(3,274 Views)

I define my tasks using an XML or JSON file.  So the only thing that would be updated for me is the device name(s) for the task(s) in those files.  I haven't found any better way to protect against wrong device names.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 9
(3,269 Views)

Hello crossrulz,

 

Can you provide me with an example.

 

Thanks.

0 Kudos
Message 8 of 9
(3,252 Views)

Here is an example of an xml file I use (I had to zip it up for the forums).  Unfortunately, I am not able to share the code at the moment.  But I have a section in the file for each channel.  Each channel has attributes for the Device and the Channel of that device.  I use Format Into String to build up the channel path that goes into the DAQmx Create Virtual Channel.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 9
(3,245 Views)