LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change value of indicator from other while loop

I have two while loops. First while loop contains event structure to handle events and second while loop is data aquisition/recorded loop. How the DATA (recorded) data can be reset to 0 from CLEAR DATA button pressed?

If I use code bellow, the DATA is not reset...

 

 

Capture.PNG

0 Kudos
Message 1 of 6
(2,737 Views)

You need to act on the data carried by the shift register in the acquisition loop.

Here are two examples, one with an event structure, the other without. There may be other small variations, though.

 

reset_data.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 6
(2,716 Views)

@AndrazS wrote:

I have two while loops. First while loop contains event structure to handle events and second while loop is data aquisition/recorded loop. How the DATA (recorded) data can be reset to 0 from CLEAR DATA button pressed?

If I use code bellow, the DATA is not reset...

 

 

Capture.PNG


The reason your code doesn't work is that even though you are resetting the DATA indicator to empty, the data still (also) exists on the shift register and thus gets repopulated in its entirety next loop.

 

You're like 75% of the way to a producer/consumer queued state machine so why not just make it such.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

Message 3 of 6
(2,709 Views)

@AndrazS wrote:

I have two while loops. First while loop contains event structure to handle events and second while loop is data aquisition/recorded loop. How the DATA (recorded) data can be reset to 0 from CLEAR DATA button pressed?

If I use code bellow, the DATA is not reset...

 

 

Capture.PNG


You are correct that this code does not Reset the data. Remember, the data is in the wire, not the indicator. You might temporarily change the indicator, but it will change back within 100 ms. 

 

The suggestions that pincpanter gave work for this simple example - you really only need one loop. If you really need two loops then one common way is to set up a queue to send messages from the UI loop to the data acquisition loop. Search for information on queued message handlers to learn more about how this might work for your application. Channel wires can also be used.

0 Kudos
Message 4 of 6
(2,705 Views)

Help -> Find Examples -> Queued message handler

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 6
(2,685 Views)

Assuming there is not much more to all this, just do everything in one loop. I like the case output tunnels that "use default if unwired", eliminating a lot of extra wires. (the shaded tunnel immediately shows that the other case is empty!)

 

Here's how it could look like (feel free to position the array indicator, case structure, and built array to your liking ;)):

 

altenbach_0-1635883662232.png

 

 

0 Kudos
Message 6 of 6
(2,632 Views)