LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop and case structures in parallel

Solved!
Go to solution

Here...I attached one simple program that i am using in my application as flow..While loop code  runs inside and executing results...Here I am passing while loop value in case structure...But it is not being executing...Why this is happening...!! How can pass to value in case structures...

0 Kudos
Message 1 of 20
(2,658 Views)

You need to start with simple tutorials and learn about the principles of dataflow.

 

You have three independent code segments that all start at the same time. Only the loop will continue to spin while the other two will complete in an instant and will never execute again during that same run.

0 Kudos
Message 2 of 20
(2,646 Views)

Well..!! I am accepting challenge...I want to put whole code in either in event structure or sequence structure..Is it correct way..??

0 Kudos
Message 3 of 20
(2,616 Views)

@Tusharvp4 wrote:

Well..!! I am accepting challenge...I want to put whole code in either in event structure or sequence structure..Is it correct way..??


No.

0 Kudos
Message 4 of 20
(2,604 Views)

I tried this logic..

0 Kudos
Message 5 of 20
(2,595 Views)

Please stop posting meaningless garbage code that makes no sense. You NEED to start with tutorials and learn the basic principles of dataflow!.

 

Again you have three code fragments that all start immediately, the two on top will complete in nanoseconds while the event structure will wait forever because a timeout never happens (unwired timeout is infinite!) Changing any controls at this point does nothing because the terminals have already been  read.

 

What is the program supposed to do?

0 Kudos
Message 6 of 20
(2,580 Views)

Capture.PNG

I am reading data from measurement in while loop..Process 1 for storing data in Database..Process 2 is for PDF Report Code..

0 Kudos
Message 7 of 20
(2,548 Views)

Hi Tusharvp,

 

please do the basics tutorials to learn about THINK DATAFLOW!

 

Why do you need a FOR loop iterating just once?

Why do you need a sequence structure?

Why do you need local variables?

 

Your code may look like this:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 20
(2,535 Views)

@GerdW wrote:

Why do you need a sequence structure?


Your code (as written) will not care about booleans operated during the run. Not sure what the OP wants. ALso the stop contion should typically be "stop if true" unless the button has a weird default and mechanical action or the while loop does not even need to be there..

0 Kudos
Message 9 of 20
(2,523 Views)

Hi Christian,

 


@altenbach wrote:
Your code (as written) will not care about booleans operated during the run. Not sure what the OP wants.

I agree on this one. Still no sequence needed when the "process" buttons are placed inside the loop…

 


@altenbach wrote:
ALso the stop contion should typically be "stop if true" unless the button has a weird default and mechanical action or the while loop does not even need to be there..

I just took what Tusharvp created: I always assume there is a conscious intention of the code creator…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 20
(2,503 Views)