LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence structure "freezing" until I turn on Highlight Execution

I have a sequence structure, in the first frame of which I create a queue. In the next frame, I wait 5 seconds, then in the frame after that, I enter into a loop of trying to de-queue an item, read it, and act on it. However, execution seems to halt after creating the queue. In the image I've attached, probe 14 executes, but probes 21, 20, and any other downstream probes are not executed. Weirder still, if I enable "highlight execution" at any time, either before running the VI or during execution, it starts working - execution continues down the line as expected.

Even *stranger* is the fact that this VI is a startup VI in a web service, and when I move it out of the web service and run it like a normal VI, it works fine.

This has really stumped me. I have only about a year's worth of (highschool internship) experience with LabVIEW, but I've never seen it behave this way even with vastly more complicated VIs and systems that span dozens of targets. Any help is greatly appreciated!

 

Download All
0 Kudos
Message 1 of 6
(2,155 Views)

"Highlight Execution" slows everything down.

 

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

That's why I added the 5 second delay, thinking that for some reason the queue takes a little while to initialize, but that didn't work. It also doesn't make sense that I could run it, it would get stuck, then I could hit highlight execution and it would magically unstick.

0 Kudos
Message 3 of 6
(2,131 Views)

Sounds like a disconnect between what your BD says is your code and your compile cache thinks your code is.

 

Switching on debugging forces a recompile, so did you

1) have compiled code separated

2) have to switch on debugging in order to enable execution highlighting?

 

The other less exotic option is that you have a race condition which affects the code inside the sequence and prevents it from ever finishing.

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

Your problem is most likely this guy:

 

He is a "greedy loop".  He will use 100% of your CPU, likely preventing the rest of your code to execute.  My recommendation is you put what is in that loop at the end of your main loop.  This will eliminate local a local variable and only update the GUI when you complete an iteration.

 

Also, don't use the Abort button to stop your code.  Add logic for stopping your loops so that you can gracefully shut down your application.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(2,096 Views)

Also, Index Array is expandable, you only need one.  Drag the bottom border down until you get 4 outputs.  The top 3 will automatically be index 0, 1, and 2 without wiring any constants.  Just wire a 12 to the bottom index.

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