LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Natt Sequences - problem passing arguments from one sequence to another

Solved!
Go to solution

Hello all,

 

I decided to refactor a code I was previously working at using Natt Sequences (https://forums.ni.com/t5/Community-Documents/Natt-Sequence/ta-p/3970582) as it felt it makes the code feel much cleaner and working much smoother than the flat sequences I used. However, I stumbled upon a little problem regarding the DAQ: I have one sequence that sets up the DAQ for data acquisition, then I have an actuall acquisition loop. In a flat sequence, connecting the two is straightforward - just connect the wires! But in a Natt sequence, it´s no longer that simple. For a while, it felt like a shift register would be the solution, but it didn´t work, since the data types are apparently of two different kinds:

 

"These cannot be wired together because their data types (numeric, string, array, cluster, etc.) do not match. Show the Context Help window to see what data type is required.
The type of the source is DAQmx Physical Channel. The type of the sink is DAQmx Event (DAQmx,DAQmx Task Name)."

Any suggestions? I have attached the VI.

 

Thanks in advance for your help!

 

 

0 Kudos
Message 1 of 10
(278 Views)

Hello,

 

I decided to refactor the code of a program I´ve been previously been working - I realized that Flat Sequences might not be the optimal solution and I wanted to learn new types of sequences. I understand that Stacked Sequences are a pain, and Natt Sequences seemed to be an interesting concept, so I started to learn them. Things were running ok until the moment I needed to start working on the DAQ, namely, when I need to recall DAQ arguments from the DAQ Setup sequence to a DAQ acquisition sequence. I thought that a shift register might do the trick (albeit it felt it didn´t make much sense), but it failed with an error message stating that the two data types were different. I also thought of creating a local variable and use it on the Acquisition sequence. But honestly, I wanted to know if there is a more robust way to do it. 

 

I am currently working with LabView 2023 Q3 (32-bits) on a Windows 11 PC. Please find attached my VI

0 Kudos
Message 2 of 10
(291 Views)

I don't see anything in this code that involves DAQmx. Are you sure you posted the right VI? Or is DAQmx hidden in the missing subVIs?


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 3 of 10
(258 Views)

Ups, my bad! Here´s the right version!

Also, thanks for merging the questions - I posted an earlier one, and I was unable to find it posted anymore - not even in my profile, so I reposted again. 

0 Kudos
Message 4 of 10
(241 Views)
Solution
Accepted by topic author Flonares

You're close. Check the help for Create Virtual Channel, you send Physical channels in - and get a DAQ-task out, those are not the same. That task should go to a shift register and be used in the other cases.

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

Qestit Systems
Certified-LabVIEW-Developer
Message 5 of 10
(209 Views)

Your problem is you are trying to use the Channels data to hold your task. You need another Shift Register to hold the task.


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 6 of 10
(208 Views)

That made the trick! The VI is now valid. Thanks a lot for your input! Let´s see if everything else runs fine 🙂

0 Kudos
Message 7 of 10
(201 Views)

Remember to wire the Task through all cases, else it'll be nullified.

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

Qestit Systems
Certified-LabVIEW-Developer
Message 8 of 10
(186 Views)

There´s still an issue I haven´t quite worked out - the data inside the loop is there, and I can see it. But when I extend the outside the loop, it gets lost. Is it still a wiring issue? Am I choosing the wrong tunneling scheme?

I´ve uploaded the updated VI in this reply.

 

UPDATE: Apparently concatenating the data does the trick. I don´t understand why it didn´t work the first time I did it, but it is now working and the data sets are identical.

0 Kudos
Message 9 of 10
(96 Views)

I'm guessing you had a "Last value" exit from the loop. Concatenating is a simple way to solve it. 🙂

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

Qestit Systems
Certified-LabVIEW-Developer
Message 10 of 10
(74 Views)