LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[QMH] Having a state repeat until a condition is met (without blocking)

Solved!
Go to solution

So, you're saying that, instead of queuing ALL 5 states at the same time, to just queue the first 3, then have the "3rd state case" set the queue to the next 2 cases?  At this point, am I just using a shift register instead of the message handling VIs?

 

I know I might be asking a lot, but if you could, could you make a quick example VI?  I'm not sure I'm making the same conclusions that you are.

 

Thanks Cross!

0 Kudos
Message 11 of 14
(681 Views)

Here is a snippet and VI saved in 8.0 that you can mess around with.


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
Download All
Message 12 of 14
(668 Views)

OK, it looks like I was understanding you correctly.  Thanks for clarifying.

0 Kudos
Message 13 of 14
(644 Views)

@crossrulz wrote:

What I like to do is use the queue's timeout.  You can store what the timeout should be in a shift register.  If you set it to -1, it will wait forever.  So if you do not get a timeout, you can process the message and react to it.  If you do get a timeout, you will get the default state and a Boolean output (Timed Out) will be TRUE.  So when you do get a timeout, you can do something.  If you have multiple things that could be set in a timeout condition, you can store the state to run when you get a timeout in a shift register.  A simple Select will make this simple to choose between the queue's state output and the stored state based on the Timed Out Boolean.


For those who find this thread later...

 

Sometime in the last year I made an upgrade to this setup.  I now use a class to hold the message queue, the timeout time for the queue, the message to perform when the Dequeue times out, and a message to perform if there is an error from the Dequeue (typically used to shut down the QMH if somebody destroyed the queue).  The only complicated part really is the Wait For Message VI where I decipher which message to pass on (not hard, just several case structures inside of each other).


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 14 of 14
(408 Views)