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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error Loading Controls Programatically

Hi, I have some code that requests what voltage channels a user wishes to record before running. For ease of use there is a save/load config option.

The control that is giving me problems is an array of channels that the user can select. I tested this code on a USB 6211 (Called DEV1) and all worked fine, I've just tried using it with a cDAQ 9178 and the loading of the controls fails. Interestingly if I change the name of the DAQ modules from the default the code works.

 

 

Anyone have any ideas on how to get this to work with the default names?

0 Kudos
Message 1 of 3
(2,725 Views)

Your attached code just saves and loads control values to and from file, so it shouldn't matter what device you're communicating with unless there's something weird in the name of the device cause the parsing the mess up.

 

Do you have a couple of config files that you've been having problems with?

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 3
(2,706 Views)

Ah, nevermind, I'm able to cause some trouble when I put in different device names, namely one with a space.

 

If I were you I would change around the way you set up your config file instead of just flattening and unflattening from a string. This is generally the easiest way to do it, but string parsing can get messed up easily without any grouping or formatting the array of control information.

You should try to use the Config VIs and set up a different "section" for each control that you want to save and load. This will seperate them out and each control name, etc will be its own "key". This will actually make the config fie easy to read as well if you wanted to look at it in Notepad.

 

Here I replaced your Save code to use the config VIs. Just do the opposite for the Load case (using the same tags) and it should fix any problems:

GetSettings.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 3 of 3
(2,701 Views)