LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Learn QMH with multiple loops

Solved!
Go to solution

@govindsankar wrote:

@Jay14159265, thank you for the advice, but actually I am learning actor framework. That is the idea. So I start with QMH, then I move onto OOP. Both QMH and OOP I know the concept, i need to practice it. So thats what I am doing now. Once I have mastered both, I will start actor framework. It was my idea all along to learn actor framework. 


That is great to hear! I think you are on a good learning path. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 21 of 42
(1,577 Views)

Thank you very much Ravi. Finally I have been able to understand how to do QMH. I always knew the basics of it but never understood how to differentiate between the loops. Because when I send a message all loops responded. This was my problem in the past. Finally I understood how to solve it. Thank you. Today morning I did another simple program. Like a fun program I played with using QMH. There is a counter that goes from 0 to 10. There are 3 LEDs and if value is from 0 to 3 Ok Led is on, between 4 and 7 then Warning Led is On and between 7 and 10 Danger Led is on. These LEDs can be switched on manually as well. By sending a message like Warning LED on. Also there are 3 push buttons to turn on each of the LEDs. Pressing a push button turns on its appropriate LED for 5 seconds and goes back to the initial state. Both Manual Operations will only work if the counter value is below 4. This was just a fun program I created. I have attached it. You can have a look if you want. But once again thanks Ravi. 

0 Kudos
Message 22 of 42
(1,550 Views)

Hi govindsankar,

just looked in your code and saw the Stop and timeout, as of your timeout does nothing but to read the Stop-button, move the Stop-Button in the stop Event and remove the timeout, then your event while loop only does something if an event is happening.

 

Idea for learning, make the 3 selector buttons not use a 5 sec timeout.

 

greetings

Timo

Message 23 of 42
(1,545 Views)
Solution
Accepted by topic author govindsankar

Hi Govind, I'm glad it helped. Celebrate each little success. You're on the right path.

 

As @t.n14 suggested, you don't need a timeout in an event structure unless you want to do some periodically.

 

Also, you probably noticed that when you click the Increment/Decrement buttons, they stay "On," and only when you click them again, do they turn "Off". For starters, please put these buttons in their respective event cases and see the correct behavior. Also, spend some time learning about the button "Mechanical Action" (right-click menu). 

0 Kudos
Message 24 of 42
(1,528 Views)

@Ravi, yeah I noticed that problem with increment decrement button. I didnt give it much thought because i thought that was not important for this tutorial. But you are right, I need to find out why. I did use latch until released. So not sure why its stays on. 

0 Kudos
Message 25 of 42
(1,523 Views)
Solution
Accepted by topic author govindsankar

It stayed on because a latched button must be read for it to release the latch. Since the buttons are just hanging out outside the event cases, they are only read once at the beginning and never again. If you move the buttons to their respective cases, they will be read on value change, which will set them back to off.

 

Also, experiment with "Panel Close?" event for stopping the VI. Stop buttons are hardly used in mainstream applications. Based on their experience with most apps/applications, users are used to using the Window close button. It also makes your front panel a bit cleaner by removing one redundant button.

 

Try using all (at least most) controls/indicators from one palette. System controls palette is generally a safe bet, but if you prefer Modern or NXG, go for it. But stick to mostly one. Your UIs will look better put together.

Message 26 of 42
(1,512 Views)

I don't know about anyone else here, but I think this is an awesome topic.  Great two-way communication between OP and group to achieve real learning.  Self-improvement is a great reason for being here!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 27 of 42
(1,506 Views)

@Ravi or @govinsankar, can one of you help me understand how you get the queue refnum in the cluster as shown below? I also want to learn.

GRCK5000_0-1683121311945.png

 

 

 

0 Kudos
Message 28 of 42
(1,482 Views)

How I did it was create four queue constants, named each of them and placed them in a cluster constant. So the output wire from the obtain queue, I right click on it and select create constant. This will create a queue constant. And I named the first one counter and so on. 

Message 29 of 42
(1,475 Views)

@GRCK5000, you can just create an empty cluster constant/control (or add to an existing cluster). Create the queue or any other reference, create a constant from that reference, and just copy or drag-drop that reference into the cluster.

0 Kudos
Message 30 of 42
(1,469 Views)