LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change input controls during execution of a loop?

Solved!
Go to solution

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. 

 

f298384352dd401d6e9803b714fb3cc3.png

 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?

 

 

0 Kudos
Message 1 of 8
(5,302 Views)
Solution
Accepted by topic author crash_override
Message 2 of 8
(5,243 Views)

Might you know how I can route things like instrument handles and error outs to the next state? 

 

c62fabec141a53a609f894ccba6caa78

0 Kudos
Message 3 of 8
(5,199 Views)
Solution
Accepted by topic author crash_override

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 

https://learn.ni.com/training

 

Yddet

Message 4 of 8
(5,173 Views)

That was extremely useful, thank you.

0 Kudos
Message 5 of 8
(5,146 Views)

 

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.

 

29b700632ee351b8fab1a41beaf50cf4.png

 

 

Untitled.png

 

 

0 Kudos
Message 6 of 8
(5,138 Views)
Solution
Accepted by topic author crash_override

Hi crash,

 

a simple way to created the correct typedef:

  1. Create a cluster using the Bundle function (plain, not by name).
  2. Now right-click the middle connector of the Bundle function and create a constant for it: you get a constant of that cluster.
  3. Right-click the constant to create a typedef from it.

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!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(5,135 Views)

Sorry I forgot to expand the main case cluster after adding new things to the typedef. 

0 Kudos
Message 8 of 8
(5,100 Views)