11-16-2015 06:09 AM
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?
Solved! Go to Solution.
11-16-2015 06:16 AM
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…
11-16-2015 06:21 AM
how do I load the default data when the subvi is not yet running? All configuration vi's have diferent ata structures.
11-16-2015 06:23 AM
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.
11-16-2015 06:26 AM
@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.
11-16-2015 06:39 AM
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...
11-16-2015 06:44 AM
@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?
11-16-2015 06:53 AM
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.
11-16-2015 07:26 AM
The Tab contol takes up to 8 devices (same or different type). The devices array has clusters which describe the device.
11-16-2015 07:29 AM
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.