02-01-2022 04:05 AM
Hello community,
currently I am trying to learn DQMH as best as I can. I try to implement my hardware (9185 chassis with 9232 device) into the "CML DQMH" example.
I do understand the "set timeout to zero" to start the acquisition on the Helper Loop. And I also heard advice that I might need to handle all my hard hardware related stuff within the Helper Loop. But I would like to understand how to implement the "initialize" and "configure" part for the hardware in the Message Handler Loop.
Because I cannot figure out how to use the "HW Refnum" (type string) correctly.
Allow me to explain:
This is a simple version of my "acquire data" (this file is also attached as a LV2016 VI):
Now, I create a fresh example of the "CML DQMH" (Version 6) and open the Main.vi from the Acquisition.lvlib:
I open the block diagram and I have the "configure" and "initialize" part (marked with 1.) and the acquire part (marked with 2.)
Now I open the first module from "1." (this file is also attached as a LV2016 VI):
How can I pass a reference to my "Task Out" (which is type "DAQmx task") over the "HW Refnum" (which is type string)? I've already tried the task name (here "MyNewTask"), the physical channel (pass to an array, then use the "DAQmx Flatten Channel String") and even passing the "Task Out" directly, but this is not working.
How do I have to do this correctly? (I do apologize if this is a stupid question)
Martin
Solved! Go to Solution.
02-01-2022 10:49 AM - edited 02-01-2022 10:51 AM
Hi Martin,
The string is just an example. Hardware uses all different kinds of refnums, sometimes a VISA refnum, DAQ task, numeric, etc. You can change it to what you need in the Module Data cluster. (Acquisition.lvlib:Module Data--cluster.ctl typedef located just to the left of message handling loop on the block diagram)
02-02-2022 04:26 AM
Thank you Gregory,
that was extremly helpful. I will post my code as soon as it works (in case someone else stumbles upon the same problem 😉
Martin
02-02-2022 05:32 AM
@Consortium, can we improve the CML example by adding some comments detailing this?
DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )
02-02-2022 05:21 PM
Unfortunatly, I have to add a follow-up question:
All my hardware related items (DAQmx timing, DAQmx read etc.) are using "DAQmx event" on their wire.
So, I figured that I need to replace that wherever necessary [I do think that I found all] with "DAQmx Task Name" (since the data type of the DAQmx Task out is DAQmx Task Name).
But, I will not work, I constantly get the "-200088" error. What am I doing wrong here?
Just in case, I have attached the "CML DQMH" project with all my changes.
Thank you.
02-02-2022 06:42 PM
In the "Wakeup Helper Loop" event, the DAQmx task is sent to the helper loop. You should change that data from a string to DAQmx task. When that data is received in the helper loop, you should keep it in the local data of that loop using a "bundle by name" node.
02-03-2022 09:44 AM
Thank you so much @Gregory, it is now working as expected, I can use my hardware for data acqusition.
For anyone interested, I have included the updated code.
Just FYI: After stopping the module (not the acqusition itself), there is a -200088 error code while calling "STOP DAQmx Task". Maybe the task has been stopped or is not properly referenced... I will update this post after I found the problem 🙂
02-03-2022 04:57 PM
Hi mw42,
That is because you clear the task in the "Stop Acquiring" case of the Message Handling Loop. If you modify your "Stop Acquisition.vi" by removing "DAQmx Clear Task" then you should be fine. When the module exits it stops and clears the task in the "Exit" case.
02-04-2022 04:37 AM
Yes, that was indeed the correct solution 🙂
Thank you!