LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need tips about queued message handler

Hello, I have to use, for the first time a queued message handler. I'd like to know what is the best way to share data between cases in a loop and from a loop to another, I think with local variables  isn't  the best way...

However all the tips on the queued message handler are welcome!!!

Thanks

0 Kudos
Message 1 of 6
(3,727 Views)

As "Queued Message Handler" is a name used for slightly different implementations, can you please provide a small example of your code?

 

Depending on the "sharing" of data, you can internally use a shift register for one QMH.

Distribution of data to other QMHs, you would use the queue of the target QMH. The target QMH has to inlcude a case storing that data in e.g. a shift register.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 6
(3,716 Views)

@smilegv wrote:

I'd like to know what is the best way to share data between cases in a loop


Shift registers.  Doesn't matter if QMH, State Machine, Producer-Consumer, etc.

 

 


@smilegv wrote:

I'd like to know what is the best way to share data ...from a loop to another


Well, now that completely depends on what you are passing around.  Streaming data?  Use a Queue or User Event.  Last known value (ie Tag)?  Global Variables, Action Engine.


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
0 Kudos
Message 3 of 6
(3,703 Views)

In "recent LabVIEW Versions" (LabVIEW 2012 and more recent, possibly earlier as well), you can open a new Project, choose "From Template", and choose Queued Message Handler.  It will create an NI-Standard Queued Message Handler with comments, documentation, and suggestions on how to modify it for your own needs.  It includes passing data between States on shift registers, and passing data betwen loops (the QMH and an Event Loop) using Queues.  By studying this, making some modifcations and "trying it out", you should be able to figure out a lot about this Design Pattern.

 

Bob Schor

0 Kudos
Message 4 of 6
(3,667 Views)

Also have a look at the JKI "Statemachine" template (which is actually a type of queued mesage/event handler).  Uses shift registers.

0 Kudos
Message 5 of 6
(3,652 Views)
Sending the data tobthe message handler is done with the queue, sending it back, which should rarely be needed, can be events.
/Y
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(3,626 Views)