LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

QMH with while loop?

Hello community,

I'm a student who's getting back into LabVIEW after a break. I'm currently working on a project using the QMH (Queued Message Handler) structure, which I was familiar(ish) with. However, I've run into an issue where it seems that the QMH is not working as expected when there's an active while loop inside it.

 

In my program, I noticed that the QMH doesn't send out strings while the while loop is running. I've made a simplified example below to illustrate the problem since I am not authorized to put the actual code here:

When starting the program and press the "Something" button, neither the array indicator nor the string display changes. Both of them only change when I press the button to stop the while loop. Is there a way to send out strings (i.e., move on to the next case in MHL) while the while loop is running? 

 

Any help or advice would be greatly appreciated. Thank you!

Billy

 

The code was written in LabVIEW 2018 macOS version.

0 Kudos
Message 1 of 8
(540 Views)

If you run your program in Highlight Execution mode, you'll see why the Message Handling Loop is no longer handling messages.  You have blocked execution until that while loop is complete and the only action that can end the while loop is a button press.  Think Dataflow. 

 

To help you fix this, we need to know more about what you want to accomplish. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 2 of 8
(503 Views)

Hello aputman,

Thank you for replying so fast.

I did run the program in Highlight Execution mode, and it is running as expected.

The problem is that it seems the string cannot be send out the while loop without stopping the loop.

Basically I am looking for method to send data out of the loop with out stopping. 

I already tried using both queue and cluster. Both of them cannot send out data without stopping the loop though.

Don't know if you know any method to do this? I've been trying all over the weekend but still nothing.

 

Thanks again for the response. Have a great day!

Billy.

 

0 Kudos
Message 3 of 8
(422 Views)

Hi Billy,

 


@Billy90 wrote:

Basically I am looking for method to send data out of the loop with out stopping. 

I already tried using both queue and cluster. Both of them cannot send out data without stopping the loop though.

Don't know if you know any method to do this? 


A queue can definitely send data "out of the loop".

A cluster is just a datatype (container), it (by itself) does not send data anywhere!

 

Use a queue/notifier/channel wire to send data from one loop to another without stopping them…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 8
(415 Views)

I did run the program in Highlight Execution mode, and it is running as expected.


If it is running as expected, you wouldn't be here asking the question. 😉

 


The problem is that it seems the string cannot be send out the while loop without stopping the loop.


The loop is indeed sending the message but the message can't be processed because the while loop is still running.  Execution is stuck in the "Something" case until the user clicks the Stop button. 

 

You haven't explained how you want to use this.  I know you want to send data out of the loop but that is too vague to offer suggestions. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 8
(402 Views)

GerdW, 

Thanks you for clarifying the difference between queue and cluster. 

I will go watch some youtube videos about them.

 

Thanks for the help! 

Billy

0 Kudos
Message 6 of 8
(378 Views)

The project is about using line scanner to scan a surface. However, the scanning width of the line scanner is only 8 mm while I have to scan a 50 mm area.

Since the program I got was constructed with QSM, I want to convert it to QMH structure. 

The problem is that if I want it to be continuous acquisition, I need it to be inside the while loop.

But at the same time, I need the acquired data to show on the intensity chart which is another case loop for QMH.

That's why I want to know if there's anyway to achieve this.😊

 

Have a great day!!!

Billy

 

0 Kudos
Message 7 of 8
(375 Views)

@Billy90 wrote:

The project is about using line scanner to scan a surface. However, the scanning width of the line scanner is only 8 mm while I have to scan a 50 mm area.

Since the program I got was constructed with QSM, I want to convert it to QMH structure. 

The problem is that if I want it to be continuous acquisition, I need it to be inside the while loop.

But at the same time, I need the acquired data to show on the intensity chart which is another case loop for QMH.

That's why I want to know if there's anyway to achieve this.😊

 

Have a great day!!!

Billy

 


Put the chart drawing in a separate loop and send data through a queue to it.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 8
(360 Views)