11-23-2017 12:29 AM
Hi Everybody,
This is the topic i want to discuss about continuous measurement using daqmx with QMH, previously i created a numerous topic on continous measurement and data logging so that i could learn more about different architectures to write a program. Now i want to discuss about the QMH architectural design patterns to draw a new idea on that, here i will start with new vi based on QMH,
with start, stop and cancel button to start and stop the measurement and to stop the vi but when i start the button i get a data values but when i press stop it was not stopping practically, i need to know what are the things i missed here and what are the things i need to keep in mind?
Thanks in advance for your valuable reply,
regards,
Paul
11-23-2017 08:54 AM
Don't have LabVIEW here, but for simplicity, I suggest that you look at the DAQmx continuous acquisition example with events, search under the examples menu. It is a clean simple interface that is easily extensible.
mcduff
11-23-2017 11:13 AM
OK, you need to learn some Fundamentals (here presented in no particular order).
Bob Schor
01-04-2018 07:49 AM - edited 01-04-2018 07:53 AM
Hi Bob_schor,
Sorry for asking same question again and i really want to know about QMH, now i attached a new vi using QMH with just start,stop and exit, but the program is not working in the way i needed, if i press start button, the one button dialogue box appears only one time and if i press again the start button it was not working, what am i missing here? i don't need a idea but i want to know, what i did wrong here and what changes do i need to make it work?
regards,
paul
01-04-2018 08:19 AM
I'm happy to help, but my crystal ball is on the fritz, so I can't see the VI you forgot to attach.
Bob "no underscore" Schor
01-04-2018 09:54 AM
Hi Bob schor,
Thanks for the reply and sorry for the underscore 🙂
I again attached you the vi.
Regards,
paul
01-04-2018 10:07 AM
Adding to Bob's excellent suggestions, and referring to your msg #1 code:
1. Your DAQmx code is reading a 1D array of buffered data. If you want buffered data you should be making a call to DAQmx Timing.vi to set during config. You should also add an action that calls DAQmx Start explicitly.
Or, if you only want a single sample of AI at a time, never mind the DAQmx Timing and select the 1Chan 1Samp version of DAQmx Read. It's still a good idea to call DAQmx Start explicitly.
2. It appears you want to use "Acquire Data.vi" as an Action Engine by calling it repeatedly with different actions from your top level loop. In that case, you shouldn't have it loop from action to action internally. Let the calling code decide when to direct the action.
The first thing to do is simply hardcode a TRUE to the while loop stop terminal in "Acquire Data.vi". Then have the "Read data" action return data on an output terminal. Also remove the delay timer. You're not gonna loop internally any more.
3. To retrieve data continuously now requires you to make a QMH case for "Read data" which in turn simply calls the action engine with the "Read data" action. You need to send this message repeatedly.
The simplest thing to do is not the best, but it can at least get you started. Have the "Read data" message case queue up another "Read data" message for its QMH loop. Also have the event case for "Start" queue up both a "Start" message and an initial "Read data" message.
Here's a reason this isn't ideal: if the event loop sends a "Stop" message while the QMH loop is in the midst of reading acq data, you'll add another "Read data" message to the queue which will be *behind* the "Stop". You'll try to read data one more time *after* stopping the task.
There are many discussions about the dangers of a QMH that feeds messages to itself. Be wary.
-Kevin P
01-04-2018 10:25 AM
Your latest code works better after 2 simple things:
1. Your wrapper function for Dequeue should have its "VI properties" for Execution changed to be reentrant with preallocated clones. That'll allow the loops to operate independently. (I'd change the Enqueue wrapper too.)
2. Change the mechanical action for your GUI buttons to "latch when released". Right click on each button to bring up the submenu.
-Kevin P
01-04-2018 09:25 PM
@paulrobinson wrote:
Hi Bob schor,
Thanks for the reply and sorry for the underscore 🙂
Close, but no cigar -- not only don't I use an underscore in my name, Paul Robinson, but I capitalize the last name, too (see signature) .
So I largely agree with Kevin's comments. Some of these will be similar, some different.
Bob "Picky, picky" Schor