02-12-2015 12:44 PM
Hello
I am trying to get my head around the Queued Message handlers. I wrote a super simple program just to send a message and switch some Boolean indicators. The program works but it won't shut down properly. Can someone explain how this should be stopped?
Both while loops get a true at the stop icon but the front panal stays gray without the graph lines.
Thank-you,
Ross
Solved! Go to Solution.
02-12-2015 12:57 PM
Can't open your VI (still on LabVIEW 2012 here) but try running with Execution Highlighting turned on? Also, put a probe on each of the inputs to the final Merge Errors, and see if they both receive a value?
02-12-2015 01:15 PM
I think you're running into a problem in your Stop case of the consumer loop. You are trying to dequeue an additional element from the queue. But you are not enqueueing anying after you enqueue the Stop command. Therefore, your consumer loop is waiting for an extra element in the queue before it can actually stop. As was suggested, use Highlight Execution to see exactly where the hangup is.
02-12-2015 02:25 PM - edited 02-12-2015 02:28 PM
Sorry should have stated 2014. I'm kinda new to the forums.
I have been using the highlight function and I also put the Pass Data State indicator to see what was happening. It just confuses me more. I get the stop state message string out and the correct lights out but there is an Idle state Queued up at the statemachine. I shouldn't be enqueueing Idle until 4 seconds elapses but it shows up instantly.
How does a state get into the queue after Stop has been pressed?
02-12-2015 02:30 PM
Ross,
Check out CrossRulz solution. I think Cross is right. Get rid of the dequeue inside of your stop case (or use disable diagram to "comment" it out) and try it with highlight execution turned on. As long as you get into that stop case, and still have the true constant wired out to the conditional terminal in the while loop, you'll be golden.
02-12-2015 02:36 PM
Should I move all of the Dequeue Elements to the outside of the case structure? The other cases seem to Dequeue all right.
I'll try moving all the Dequeues out and see what happens. I will just pull the element wire into the case structure.
02-12-2015 02:42 PM
Yeah, you only need the one dequeue outside of the case structure for most simple architectures. You pass the data from the dequeue into the case and do what you need to do with it (along with using the dequeue'd data to select the case). Once you have dequeue'd data, you can't dequeue it again.
02-12-2015 02:46 PM - edited 02-12-2015 02:50 PM
Still not solving the problem.
EDIT: Correct image this time.
02-12-2015 02:48 PM
You didn't make the change! There's still a Dequeue Element inside the case structure, and it shouldn't be there.
02-12-2015 02:49 PM
Check this