LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Configure cDAQ programmatically with LabVIEW

Solved!
Go to solution

I have a cDAQ chassis with two modules. I want (for bizarre reasons too convoluted to get into Smiley Sad ) to be ble to programmatically configure the MAX configuration for it. And I mean everything.

I need, in my LabVIEW app, to be able to tell MAX to wipe it's current configuration clean, detect  the chassis with the two modules, rename the chassis and the two modules, and create a whole bunch of tasks too.

I'm fairly sure I can create the tasks programmatically, but I've had little luck finding info on programmatically reconfiguring detected hardware.

Can it be done?

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 1 of 7
(3,696 Views)
Solution
Accepted by topic author Thoric

Thoric,

 

The only way I know of to rename hardware without using MAX is to import a configuration file with new names for same hardware.  One version of config file is an .INI file which as you know is very easy to create/edit in LV.  MAX Copy Configuration.vi can move config file both ways.  I've been playing around with this using my cDAQ and it seems to work.

 

I could see powering up the hardware and letting NI detect it.

Export config to .INI and edit item names, etc.

Import modified config to MAX and replace existing config

 

Here is a brief example of how I was doing the export/import

 

 

MAX_import_exp_BD.png

 

 

Message 2 of 7
(3,676 Views)

Thanks for putting in the effort to look at this for me Wayne, this seems to be just what I need.

 

I've tested it and it seems to work very well for me! Smiley Happy

 

I'm very grateful to you, kind sir Smiley Very Happy

 

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 3 of 7
(3,670 Views)

Thoric,

 

Glad that fit your needs.   I had been considering how to do a similar thing for a while now.  You question was a great excuse to try it out.  Kudos for a great question.

0 Kudos
Message 4 of 7
(3,668 Views)

Hello and thanks too for the great idea of using this MAX Copy Configuration.vi,

[Labview 8.21 - DAQmx 8.7]

I am running into the following issue trying to apply a certain .nce configuration at the beginning of my Labview vi (scale factors and tasks are imported from the configuration) it does not take the selected configuration until I stop and restart the vi. No error comes out of the MAX Copy Configuration.vi. This vi is the first thing that code does in my vi. I have tried both the merge and replace modes and it does not change anything.

If it would not work at all I would be less worried but the weird thing is really that it works on the second try. Then if I try to load another .nce it takes again 2 times to be active.

What can I do?

Thanks,
Christophe

 

0 Kudos
Message 5 of 7
(3,587 Views)

Christophe,

 

What you are seeing is probably an expected behaviour.  Best guess is that when a vi is first loaded into memory, task and scale info from MAX is loaded/referenced once.  The vi has no idea if a change has occured in MAX so it has no reason to go back and recheck.  Perhaps someone from NI can verify what is happening between the vi and MAX.

 

Better way to handle this is to programatically create your tasks and scales in your vi.  Save all the settings to create these in a .ini file of your own.

0 Kudos
Message 6 of 7
(3,582 Views)

Thanks. But between the first and the second time I do not exit Labview. I just stop the program and re-run it. And that is enough to have the nce parameters set. Then I even tried to run the MAX Copy config twice consecutively in the VI but that does not work either. So really stopping and restarting the VI is the only thing that works in my case.

Any idea?  Can a vi be restarted programmatically?

Maybe NI has some clues on what is going on between Labview and MAX in that particular occurence.
Thanks.

Christophe

0 Kudos
Message 7 of 7
(3,579 Views)