LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem stopping very simple Queued Message Handler

Solved!
Go to solution

 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

MSGHandler.jpg

Download All
0 Kudos
Message 1 of 19
(3,868 Views)

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?

0 Kudos
Message 2 of 19
(3,857 Views)

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.


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 3 of 19
(3,850 Views)

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?

0 Kudos
Message 4 of 19
(3,834 Views)

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.

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 5 of 19
(3,824 Views)

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.

0 Kudos
Message 6 of 19
(3,816 Views)

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.

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 7 of 19
(3,813 Views)

Still not solving the problem.

 

EDIT: Correct image this time.

MSGHandler2.jpg

 

0 Kudos
Message 8 of 19
(3,810 Views)

You didn't make the change! There's still a Dequeue Element inside the case structure, and it shouldn't be there.

0 Kudos
Message 9 of 19
(3,807 Views)

Check this

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 10 of 19
(3,802 Views)