LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

changing default values of a subpanel vi

Solved!
Go to solution

I like to initialize several devices connected via gpib using several subpanel (one for each device). Each device type (temperature monitor, multimeter) has its own subvi (or better a vi template) for configuration. The subvi takes a gpib address only as parameter. When the vi is loaded into the subpanel, the user is able to change the configuration via the frontpanel controls. Then he fires the "init" button and the vi's are run (which writes the data from the frontpanel to the device).

 

Currently, these config vi's load their default values from the vi file itself (make current values default). Is it possible to change this default value before running the subvi, without losing the flexibility?

0 Kudos
Message 1 of 20
(3,144 Views)

Hi Marvin,

 

yes, there's a possibilty… (As always when you start to program 🙂 )

 

You could load your default data from a file. You could use Config files (aka INI files) with some keys/values with parameters of each supported device…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 20
(3,130 Views)

how do I load the default data when the subvi is not yet running? All configuration vi's have diferent ata structures.

0 Kudos
Message 3 of 20
(3,121 Views)

marvin24 wrote: Is it possible to change this default value before running the subvi, without losing the flexibility?

I second the use of configuration files.  There is a very nice palette API for you to use that are quite simple.


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 4 of 20
(3,119 Views)

@marvin24 wrote:

how do I load the default data when the subvi is not yet running? All configuration vi's have diferent ata structures.


You don't.  You have your configuration VIs read the configuration file when they are first ran.  Then you have the VI loaded into a subpanel.


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 5 of 20
(3,112 Views)

I already tried "first call" in the subvi to load the configuration. Unfortunately, when using "Run VI" invoke node, it is always the first time...

0 Kudos
Message 6 of 20
(3,099 Views)

@marvin24 wrote:

I already tried "first call" in the subvi to load the configuration. Unfortunately, when using "Run VI" invoke node, it is always the first time...


And why is that a problem?


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 20
(3,090 Views)

what I tried is to add "first run" wired to a case structure. In true case, it loads the config, and in false case, it configures the device. In the main vi, I load the subvi into the subpanel, and use "Run VI" to load the configuation. Then the user is able to change this config and when he is finished, he presses the global "init" button, so the config(s) in the various subpanels are written to the device(s). The last step is done in a second call of the subvi, which should end in the "false" case, but it doesn't.

0 Kudos
Message 8 of 20
(3,081 Views)

lb.png

 

The Tab contol takes up to 8 devices (same or different type). The devices array has clusters which describe the device.

0 Kudos
Message 9 of 20
(3,063 Views)

maybe it's not possible at all. An alternative would be to pass the main "init"-button pressed to each sub vi (all running in parallel), so I can handle the load/modify/save/init logic there.

0 Kudos
Message 10 of 20
(3,054 Views)