From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How Do You Porperly Use DAQmx Flatten Channel String.vi?

I am trying to make a VI I can use to generally access an NI 9203 module.  I need to access multiple channels at the same time, but don't always know how many (some setups have 3 pressure transducers, some have 5, etc.).  I can use the VI I attached, but there remains two imiplicit typecasts.  The first is supplying the array of physical channels to DAQmx Flatten Channel String.vi, which wants an array of strings.  The second is sending the string from DAQmx Flatten Channel String.vi into DAQmx Create Channel.vi, which expects a list of physical channels.  What should I actually be doing?  I don't like to rely on implicit typecasting, this tends to be quite brittle.

0 Kudos
Message 1 of 16
(5,133 Views)
Since you can easily select multiple channels with one front panel I/O control, why are you using multiple controls?
0 Kudos
Message 2 of 16
(5,132 Views)

I'm using this inside of another VI, and don't want the end user to have to select the channels themselves.  This is going into test stands used by shop personnel, so I'll be wiring the terminals to physical channel constants, like in the picture attached to this post.

 

Edit: And in some cases, there are 2 instruments connected, some 5, it varies.  I don't want to write a seperate VI every time I want to use NI 9203.

0 Kudos
Message 3 of 16
(5,122 Views)
Sorry, but that makes no sense to me. It looks like you have a different top level VI for each configuration. A single physical channel constant is still simpler than 8 different ones. You could define the single constant in an ini file for that matter and just load the appropriate one as needed.
0 Kudos
Message 4 of 16
(5,114 Views)

You can do it that way, but the LabVIEW help says you can make an array, feed it into DAQmx Flatten Channel String.vi, and wire that to the input.  Or it does in my version anyway (attached image).  Perhaps this method was depricated at some point?

0 Kudos
Message 5 of 16
(5,106 Views)
I don't think it was deprecated. I've never used it though as I think it's not necessary. Your method seems overly complicated.
0 Kudos
Message 6 of 16
(5,100 Views)

Did you ever solve your problem? I ran into something similar where I'm not sure the proper way to input multiple channels into Daqmx Flatten Channel String.vi

 

0 Kudos
Message 7 of 16
(4,936 Views)

I did not.  I actually use controls now and put them on the rearmost tab of a tab control.  That way, if something hoses up in the middle of a test, I can just switch which instrument is where without having to change the wire diagram.  In any case, I still just live with the implicit typecast.

0 Kudos
Message 8 of 16
(4,923 Views)

I solved it, sort of.  I used explicit type casting from the Type Cast VI (Programming-->Numeric-->Data Manipulation).  It's still dumb that Lab View's help files specificially say to use this function, but the data types it takes in and outputs are wrong.  They should either depricate the VIs or keep them up to date.

0 Kudos
Message 9 of 16
(4,796 Views)

I still don't understand what problem you are attempting to solve. Why do you do all of that typecasting? Leaving everything as in your very first post works just fine. The coercion dots are not a problem. The function seems to work exactly the same whether there is a string array or physical channel array. Please post details on problems you see with a physical channel array.

0 Kudos
Message 10 of 16
(4,783 Views)