05-23-2017 04:53 AM - edited 05-23-2017 05:03 AM
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:
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
Solved! Go to Solution.
05-23-2017 06:05 AM
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.
05-23-2017 06:48 AM
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'
2. 'Get Live Data' contains a loop, to continuously read via DMA FIFO.
3. Stop and close FPGA after all three loops are finished.
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
05-23-2017 07:21 AM
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.
05-23-2017 07:31 AM
Ok, great, I'll give it ago and see where I get too. Thanks again.