05-13-2020 04:38 PM
I have this program that works alright however, I would like to be able to let the user change the controls during the main loop and have it alter the parameters to the "Configure Standard Waveform" block in real time, like a real oscilloscope. I have tried moving some of the controls into the loop but it does not allow me to route them backwards into the initializer functions that I need to be outside of the loop for setup, as the same parameters need to be used before the loop.
Is there also a way to have the program run at the flip of a toggle switch and off again however many times the user wants?
Solved! Go to Solution.
05-14-2020 04:39 AM
Hi,
You should look into state machines and events
https://labviewwiki.org/wiki/State_Machine
https://en.wikipedia.org/wiki/State_machine_(LabVIEW_programming)
I did a quick mock up.
Yddet
05-15-2020 01:13 PM
Might you know how I can route things like instrument handles and error outs to the next state?
05-18-2020 02:31 AM
You need to use shift registers. Here it does not work because the initialisation of the register does not correspond to the data in Bundle.vi. The initialisation is the cluster constant on the left of the loop.
Right click on the output of Bundle, create constant. Replace the initialisation of the shift register by this new constant.
Read this, it is well written, explains how to properly use the shift registers ans how to avoid some common mistakes.
https://www.viewpointusa.com/TM/ar/shift-registers-in-labview/
https://www.ni.com/getting-started/labview-basics/shift-registers
What you did could work but usually the error has its own shift register. It makes it easier to use.
As you may modify the cluster to include more data or change their type, it is a good idea to change the cluster constant into a TypeDef. A modification to the type def updates everywhere where it is used. If you don't use a type def, the code will be broken at a lot of places each time you modify the cluster.
To create the TypeDef, right click on the cluster constant, customize control. Right click on the cluster, open custom control (or something similar). At the top of the new window, switch from "custom control" to "Type definition". Save.
It is a good idea to replace the Bundle.vi by BundleByName.vi and wire the left register to the top of BundleByName.
The online courses are free this month. You should really look into LabVIEW core1 and core2
Yddet
05-19-2020 01:06 PM
That was extremely useful, thank you.
05-19-2020 01:49 PM
I have switched over to the typedef and changed the bundle to BundleByName however, I still can't figure out how to add the instrument handles into the typedef and it says I'm connecting an empty cluster to the bundle.
05-19-2020 02:02 PM
Hi crash,
a simple way to created the correct typedef:
Finished!
On your images: You init the shift register with a cluster of 8 elements, but you want to bundle 11 elements inside that case!?
05-20-2020 12:41 PM
Sorry I forgot to expand the main case cluster after adding new things to the typedef.