10-30-2017 03:49 PM
I cannot find 1 channel N samples that accepts a 1D array of booleans. When I click the polymorphic selector, none of the menu items says 1 channel N Samples. I found "Digital 1D U8 1 Chan NSamp" but that expects U8, not booleans. There is a "Digital 1D Bool NChan 1Samp", but I don't think I want NChannels, right?
10-30-2017 05:46 PM
Got it! Forgot to change my sample size when I changed to Boolean array.
10-31-2017 04:26 AM
Mmmmmm, not so sure you've *quite* got it yet.
First, you're right -- there isn't a 1D Boolean array version of DAQmx Write for 1 channel N samples. All the N sample writes require either a digital waveform or the less desirable bitwise port format. Sorry about that, it's been a while since I did hw-timed DO.
Dig into the digital waveform palette and you'll find a function to convert from your 1D Boolean array to a digital waveform.
Second, if you only define 2 samples for your repeating buffer, you may need to set up your task to do on-board regeneration. It's possible DAQmx may do that by default when supported, but I'm not sure it will. An alternative would be to define a much larger buffer of alternating T-F values to allow the driver to deliver data from PC to board in bigger chunks at a lower rate.
-Kevin P
10-31-2017 10:02 AM
Thanks for the extra background. What I have shown (1 Channel for all lines, Continuous sample, internal clock, 1D array of boolean with 1 and 0 and sample size of 2) works with my NI USB-6363 on any individual DO output pin. Works, meaning a continuous 50% duty cycle pulse is seen on my O-scope. Since this is working, perhaps I will go back when I have more time and poke around with the waveform method.
10-31-2017 10:34 AM
That's interesting, but also surprising in that you're showing a DAQmx Write for N channels 1 Sample. I'm not sure why that works. It seems like you should need to specify N samples (and maybe also 1 channel).
After a closer look, I also see you've only defined 1 sample by feeding in a 1-element Boolean array constant. I'm not sure why the task wouldn't either error (some DAQmx properties require a min quantity of 2, I thought data buffer might be one of them) or just repeat that same value indefinitely giving you a constant True state instead of pulsing.
But you see what you see, I'll believe it, just surprised.
-Kevin P