LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

use notification to stop parralle loop

Solved!
Go to solution

another approach using a single loop event driven state machine....event driven statemachine.png

0 Kudos
Message 11 of 17
(1,304 Views)

In my case, I cannot stop loop. I need to keep saving data and stop saving

after certain time, I need to save data again

 

I will look at the example using queue.

 

In my case, I need to send saving msg to 3 consumer loops when I click save button. So queue is still a good choice not notifier , right?

I knew notifier may be useful for one producer loop and multiple consumerloops, is it right?

 

0 Kudos
Message 12 of 17
(1,282 Views)

Actually I use this structure to control my valve. (event case and consumer loop)

 

If I use this one save data, I may also need to use SR to save the queue element . Otherwise, it will keep wait for saving message again.

I attached my case.

 

 

The first loop is displaying data in chart from NI 9213.

I used queue structure to send data to 'write to measurement file (consumer loop)'. In second loop, false case is empty , becasue save is false, I donot want data recorded in a file

 

In certain condition, which is determined by other device , I need to change "save " to true state, then data is recorded in a file (True case.)

After certain time, I need to change "save " back to false state,  when I need, I may need to change save to true again...

 

Meanwhile, I have 2 more consumer loops which collect data from com port. I need to let these consumer loops saving data at the same time and stop at the same time....

 

So in my case, which methods are best ?

Thank you so much

 

NI 9213-ASK.png

0 Kudos
Message 13 of 17
(1,277 Views)
Solution
Accepted by topic author dragon-long

@MYLONG wrote:

 

When I click save ,consumer loop will start save immediately

But When I click stop saving , after one loop it will stop. because the SR value is still true, so saving data loop will run one more loop then stop

Is there other methods to improve this?


Think about the logic.  If you put the Save case structure AFTER the one that checks for the timeout, instead of parallel to it, it will work as you want.

0 Kudos
Message 14 of 17
(1,265 Views)

Thanks. It works

 

0 Kudos
Message 15 of 17
(1,252 Views)

This is also one good solution. Thanks,

By the way, how can I set up FP size so that when I open VI, it only shows the small window which includs controls and indicators, not a big window?

I try to use mouse to shrink FP size, but when I open it again, It looks not the same

 

0 Kudos
Message 16 of 17
(1,227 Views)

The VI should save its position and size when you save it, and reopen at the same size and position.  If you need it a different size only when you run it, check out the Window Run-Time Position category of VI Properties.

0 Kudos
Message 17 of 17
(1,222 Views)