LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer user input to different case in QMH ?

Solved!
Go to solution

Hello Folks,

 

Greeting.

 

I started a project to learn LabVIEW. As a newbie I started with Queue Message Handler. Right now I am making one GUI for a function generator but later on more device and functionality will be followed with existing structure. This is the problem I'm dealing with:

 

My code is working but now my next move is to make my existing code bit modular where I don’t have any idea how to do it. I want to show user input (amplitude and frequency) to another case as a waveform graph. So in QMH how can I do this?

 

I attached my VI. After “AD2” case I want to make another case named "Graph" to show user input as a waveform graph. Any modification in my VI will be marvelous and any suggestion will be welcomed. But I prefer to show the process that I should follow. As a new comer in LabVIEW it’s hurting me a lot 😫

 

For anything thanks for your effort.

- Reduan    

0 Kudos
Message 1 of 4
(1,951 Views)
Solution
Accepted by topic author REDUANUL

This may sound silly, but I think it will (a) teach you something(s) important about the QMH, (b) take only a little time to do this, and (c) enable you to solve your problem with your existing code.  Please bear with me ...

  1. Start LabVIEW.  Choose "Create Project".  Choose "Queued Message Handler" as the Project.
  2. This is a key step!  In the first box of the Project Creator, give your Project a "Real" Name.  "Untitled Project 17" is a terrible name.
  3. Look carefully at the first two or three steps of the just-created QMH.  Notice that many of them involve "passing data to a subsequent Step" by putting both the "Step Name" and "Step Data" into the Message.  All QMH Messages must have a "Step", but not every one needs a name.
  4. You might notice that when you do this, you wind up with a "Queue Wire" being brought into the Case Statement that determines the Step, and also that there is a branch of this Wire that snakes around the outside of the Case to the Error Handler.  
    1. Personally, I find this "branching and snaking around of the Queue Wire" aesthetically unpleasing.  One "improvement" I've used is to put the Queue Wire in a "top-of-the-Case" Shift Register, similar to the "Data" Wire, and bring it down to the Enqueue function when needed.  Note that you only need to wire Queue In, and can leave Queue Out unwired (do you understand why this is?), which also helps keep the Block Diagram neat.
    2. Since LabVIEW 2016, which introduced Asynchronous Channel Wires, I've used what I call the Channel Message Handler (CMH), which substitutes a Messenger Channel for the Queue.  This is, for me, a much better and more intuitive "metaphor" for asynchronous data transfer (visually) than the Queue.  With the exception of code running on a Real-Time Platform, almost all of my LabVIEW Projects since 2016 have used the CMH Design Pattern.
  5. You should now see how to pass Data to a specific Step.  You bring the Queue inside the Case Step from which you want to make the Call, then wire an "Enqueue Message" function with the Step and the Data.  I notice your Untitled Project 17 never uses Enqueue Message!  Oops.

Bob Schor

Message 2 of 4
(1,901 Views)

Thanks Bob for letting me know several basic stuff in QMH.

 

I got the concept how can I call data within different case. I'll be back shortly after trying it !

 

- Reduan

0 Kudos
Message 3 of 4
(1,885 Views)

Thank you so much Bob!

 

Now everything working like a charm and by this problem definitely learned a lot about QMH analogy in LabVIEW.

 

- Reduan

0 Kudos
Message 4 of 4
(1,853 Views)