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: 

Automated loading and executing array of presets sequentially

Hi,

 

I have built a system that allows a user to set certain parameters and send those parameters to another program using an event case.  In order to have my controls update in real time I had to use nested while loops.  The inner loop contains the controls which is halted by the event trigger that is housed in the larger while loop along with the inner while loop.  I have recently built functionality to be able to save and load preset files in order to make it easier to set these controls.  My end goal is to allow the user to load in multiple preset files sequentially and have those values pass through to the other program where the hardware I am using can utilize it.

 

The problem I am having is in figuring out how to automate this loading and execution of presets.  I can automate the loading of presets outside of the main VI, but due to the while loops I am confused on how to have only one preset be executed at a time.  Essentially, the pattern I am looking to create is to have a preset automatically load and then pass those control values on to the rest of the program.  Then the system will wait for a signal that the hardware has done its job and will then proceed to load and pass the next set of preset control values.

 

I have attached a VI that shows how the main controller operates.  I would attach the whole thing, but it would contain too many files as there are multiple subVIs being called.  Any help in figuring this out would be greatly appreciated.  Thanks!

0 Kudos
Message 1 of 2
(2,202 Views)

You could consider using the Queued Message Handler.  It's a state machine that uses an event structure as one way to influence the next state in a state machine.  I'm not sure if there is an example of it in LV 2010 though.

 

I would split up the functions into different states.  One state can load your presets, another can read the data from the controls themselves.  A third state would send the data and would be called by either of the other two states.  You would have a button for calling the preset state and another to read the controls.  A final state would cause a graceful exit.  Refer to the template to see how that gets set up.

 

I was considering just using a basic event structure inside a while loop followed by your code to send the data to the external program, but upon exiting you would have to send one final set of config data to the external program, which is probably NOT what you want to do.

 

I guess you could use a simple state machine with an idle state that polls the buttons, but I don't like button polling.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 2
(2,182 Views)