LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

QMH Loop not stopping

Solved!
Go to solution

Hello,

 

I'm building a QMH based HMI for talking with my cRIO FPGA. I've got three loops, an event driven (creating queue elements), one used to communicate with the FPGA, and a third for logging and post processing. I then have a third queue to pass stream data between the communication loop, and the logging one.

 

The problem I have is after starting logging, and the 'Logging' message is executed, the repeating loop for saving the data doesn't ever stop, even when the stop event is triggered:

 

NI1.PNG

I'm at a loss as to what is going on, and what is stopping the loop from stopping. Do you have any ideas?

 

I've attached the LabVIEW project for reference. The top level file is Logger PC Host V2, within Host V2.

 

Thanks,

Peter

 

 

 

0 Kudos
Message 1 of 5
(3,027 Views)
Solution
Accepted by topic author PeterGrant

You should NEVER have "long running" loops inside of your message handler.  What you should do is send the log data through the message queue.  Add messages for creating the log file and another to close it.  Store the TDMS reference in a shift register.

 

What is happening is you are not listening for your stop message while inside of the "Logging" state.  In general, a loop should only ever be dequeuing from 1 queue.


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 2 of 5
(2,993 Views)

Hi Crossrulz

 

Thanks for the message.

 

I did think when I was writing the code that it felt a bit wrong having a loop within there again, I felt like it was required to have continuous data saving, but I suppose while data is being sent via the message queue, it knows to carry on capturing data. 

 

As a second question with regards to removing long running loops from message handling, how would go about managing my FPGA connection states? 

 

Currently I'm doing this (which is now I presume incorrect)

1. Connecting to FPGA is done via a 'Connect' message state, which once connected, sets the next message to 'Get Live Data'

NI2.PNG

 

 

2. 'Get Live Data' contains a loop, to continuously read via DMA FIFO. 

NI3.PNG

 

 

3. Stop and close FPGA after all three loops are finished.

NI4.PNG

 

I presume what I want to do is create a message for the connect and stop events (much like I've already done), but then how do I ensure that I continue to receive data in the second state? 

 

Thanks again, and sorry deepening question!

 

Peter

 

 

0 Kudos
Message 3 of 5
(2,980 Views)

PeterGrant wrote: but then how do I ensure that I continue to receive data in the second state?  

What I do is use the Timeout capability of the dequeue.  It I get a timeout, I perform the read.  You can set the timeout with a shift register so that it defaults to -1 (wait forever) and then you change it to your update rate when you connect to the FPGA.


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 4 of 5
(2,973 Views)

Ok, great, I'll give it ago and see where I get too. Thanks again. 

0 Kudos
Message 5 of 5
(2,962 Views)