LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I autoindex a for loop to create multiple daqmx channels

Solved!
Go to solution

I'm trying to autoindex a FOR loop containing the DAQmx create channel vi to create multiple ai voltage channels with identical parameters except I need to apply specific channel names using a constant and specific physical channels using a constant. Wiring a DAQmx physical channel constant doesn't work because the type of data is incorrect. Similarly, I haven't figured out how to use a string constant to autoindex via channel names either or how to configure the string constant(s) to assign the names. Also, when I try to do any of these, I get an autoindex output tunnel from the DAQmx create channel, rather than a task out. I can accomplish my goal using multiple explicit DAQmx create channel calls, but for high channel counts this is very time consuming. 

I'm using LV 8.5.

 

I am hoping to find code demonstrating how to perform the type conversion, flattening, or whatever needs to be done.

0 Kudos
Message 1 of 13
(4,825 Views)

I'm not really clear what you are trying to do, could you post a screen shot (.png/.jpg, NOT .bmp) or a snippet of your code. Have you tried an array of strings fed into the FOR loop?

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 13
(4,821 Views)

Here's a snippet of the code I'm trying to improve. I want to create an autoindexed FOR loop to replace the four leftmost daqmx create channel calls. In my final application I'll have about 30 ai voltage channels, not just four. Notice how I am assigning specific names to the 4 DAQmx channels (load, stroke, lvdt1 and lvdt2). I'd like to feed the loop either a string array of channel names to assign, or a constant consisting of physical channel names to autoindex the loop. The specific channel names and the physical channels need to be from a constant, not a control as I don't want the user to be able to change them from the front panel.

I've tried several ways, I think including a simple array of strings. That didn't seem to work.

THanks,

JK

0 Kudos
Message 3 of 13
(4,812 Views)

Shift registers.

 

Message Edited by Ravens Fan on 03-16-2010 09:10 PM
Message 4 of 13
(4,798 Views)

Thanks, but I can't seem to get my cluster constant to be the same as yours, or my for loop to autoindex off the cluster constant you have wired. The only way I can connect the cluster and the loop is via a tunnel that won't autoindex. I've attached an image of the block diagram.

As you can see, the wire thickness coming off my cluster is smaller than yours, and the unbundle by name doesn't work either. I'm using LV 8.5.

Can you tell me how you created your cluster?

Thanks.

0 Kudos
Message 5 of 13
(4,772 Views)

You show an array of clusters, inside another cluster.  Take the array out of the cluster.  Then wire the array into the FOR loop, just like Ravens Fan shows.

Message Edited by DianeS on 03-17-2010 12:13 PM
0 Kudos
Message 6 of 13
(4,766 Views)
Solution
Accepted by topic author jkessler

Diane has it.

 

I have an array of clusters.  Each element of that array is a cluster.  The cluster consists of a string (scalar) and the I/O (also scalar).

 

Also, my attachment it a snippet.  I believe your file was LV2009.  If so, you can drag out the image from the browser and drop it onto a block diagram.

0 Kudos
Message 7 of 13
(4,759 Views)
Thanks. I never would have figured that out on my own. I was trying to go the other way, creating an array of channel names and an array of physical channels, and placing them in a cluster. I will create a cluster of two elements and then an array of those clusters.
0 Kudos
Message 8 of 13
(4,755 Views)
Don't mark your own post as the solution.  Mark Ravens Fan's post as the solution.
0 Kudos
Message 9 of 13
(4,716 Views)

That was a mistake, but I couldn't figure out how to undo it...

JK

0 Kudos
Message 10 of 13
(4,711 Views)