01-04-2018 06:09 AM
Did you Notice that the generated code is sorted on channel name and not channel order?
Nifty but not perfect.
At the very least though, we have exactly spelled array constants we can "Cluster sort" and feed into the config loop.
Or, just use the task! And !@$@ the code.
01-04-2018 08:07 AM
@JÞB wrote:
...
Config:
Looking like Ben suggested ...
So we only need the original poster to confirm the channels are in the order they desired to confirm what I had suggested.
Ben
01-04-2018 08:55 AM - edited 01-04-2018 08:59 AM
Yeah,
I might just mention that "Sorting" Feature in the code generation framework elsewhere. The Task itself is correct. Its just the generate configuration code that has this feature.
Now, looking through the original post.....
He did ask for an "Arbitrary" order. What could be more arbitrary than an order sorted on channel names?
01-04-2018 09:11 AM
@Kevin_Price wrote:
Agreed, that's a pretty nifty config wizard NI has provided!
...
Yes it is. Any time I am looking at a new set of DAQ interfaces, I use that approach to figure out which options I need to configure the new channel type.
Now if we could only convince NI that the modular instruments need to support a similar functionality...
Ben
01-04-2018 09:14 AM
Jeff's solution of creating a new Task using the NI MAX wizard works. The only "downside" is that the data has to be fed in as a Boolean array instead of just as 32-bit integers when using the simpler 0:31 or 31:0 configuration. This is however not a big problem and otherwise the solution works well.
Thank you all!
01-04-2018 09:29 AM
So we only need the original poster to confirm the channels are in the order they desired to confirm what I had suggested.
It's starting to look good. Took me some fiddling with DAQmx properties for channel names and the special NI names for waveform attributes, but at least now the digital waveform graph appears to honor the special channel order. Seems very likely that the hardware will do the same.
Here's what I saw in MAX (I used only the lower 8 bits):
The auto-generated code adds individual lines to the task as additional channels in the corresponding sequence - line0, line5, line2, line7, etc. So far, so good.
Then I modified the auto-generated code to insert my own recognizable pattern in 1D U8 format. This matches the OP's format except for fewer bits to deal with. I chose to convert from uint to boolean array to get away from finicky bit manipulations, and I had to tweak the auto-code to query channel names *correctly* and embed them into the waveforms:
I sent the 1D array of digital waveforms to a graph (and to a simulated device to verify absence of errors), and produced this:
...and Voila! You guys were both right! The pattern that was originally the MSB gets mapped to the last digital line to be configured in the task, line4. And so on.
Looks like I've been reflexively old-school about most DAQmx stuff for so long that I've missed out on some nice features and capabilities like the wizard Jeff walked us through. Thanks for the education and nudge!
-Kevin P