I made the mistake of opening Cycle Count first, and wondering "Why didn't he use the Multi- channel version of the Basic Threshold Detection VI?". Then I noticed that your input, which should have been an Array of Waveforms, was wrong -- it was an Array of (Cluster of Array), which made no sense.
When I did finally open Main, and saw the Dreaded DAQ Assistant and its evil Twin, the Dynamic Data Wire, I understood how you had been misled. DAQmx, when used as intended, likes to produce an Array of Waveforms, which bundles Time of acquisition "efficiently" into a Waveform Cluster along with the array of data. Now you can present this Array of Waveforms to the (polymorphic, but that's not so obvious!) Threshold Detection VI.
Here's what you do to rewrite Cycle Count so it looks like this:
- Arrange your Inputs on the left, outputs on the right. We're going to "operate" on the functions in the middle. Note that I added the Error In and Out (always a good practice when writing sub-VIs).
- Delete Array of Clusters (ignore all the broken wires -- we don't need much of the insides, anyway). Replace it with an Array of Waveforms (you can find a Waveform Constant on the Block Diagram Waveform Palette, Analog Waveforms sub-Palette).
- Find your Basic Threshold Detector VI and delete all its inputs and outputs so that it is a bare VI. Right-click it, click "Visible Items", and turn on "Polymorphic Indicator". Change it to "Trigger Detection for N Channels".
- Now start wiring your Inputs. The Level and Hysteresis need to be Arrays, so simply create them, using the size of your Signal In array to initialize an array of the appropriate size.
- I made "Reset" a variable, as you only want it to be True the first time you call this function.
- Rather than using a Selector to increment (or not) the Cycle Count, I changed the Boolean to 0/1 and simply added it to the Cycle Count.
So how to fix Main? Here I usually say "Learn DAQmx", but here's a quicker way to "Undo the Damage" -- convert the Dynamic Data Wire to a 1D Array of Waveforms, like this:
Note that by default, the Convert from Dynamic Data does not use Array of Waveform (its First Choice) as the default, so you'll have to right-click it and choose Array of Waveform. With all of the changes you made to Cycle Count, you might find that (as I did) you forgot to connect the new Inputs and Outputs to the Connector Pane, so do that, then wire your Array of Waveforms, Level, Hysteresis, and Reset, and enjoy the results.
Bob Schor