03-16-2010 05:47 PM
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.
Solved! Go to Solution.
03-16-2010 06:13 PM
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?
03-16-2010 07:04 PM
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
03-16-2010 08:07 PM - edited 03-16-2010 08:10 PM
Shift registers.
03-17-2010 12:05 PM
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.
03-17-2010 12:12 PM - edited 03-17-2010 12:13 PM
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.
03-17-2010 12:28 PM
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.
03-17-2010 12:37 PM
03-17-2010 03:14 PM
03-17-2010 04:03 PM
That was a mistake, but I couldn't figure out how to undo it...
JK