06-10-2020 10:42 PM
Hi, I am learning to use NI multifunction I/O board to trigger an external stimulator. I use matlab to control the NI board and now can send 5v voltage output through an analog output channel to trigger a stimulator. The problem now is that I have 6 stimulators to be triggered but the NI board only has 2 analog output channels. The NI board does have more counter output channels. I am wondering if it's possible to trigger external stimulators with these counter output channels? And how to control the counter output through matlab?
I would appreciate any help. Thanks.
06-11-2020 05:20 AM
The best approach will depend on some things you didn't describe. What DAQ device do you have? At what rate do you need to "trigger" the external device? Does the timing need to be very regular and precise, i.e., do you need hardware timing?
5V output signals can be generated as analog, digital, or counter output. I like counters plenty, but digital output may turn out to be a better option depending on answers to questions above.
-Kevin P
06-11-2020 11:22 AM
Hi Kevin, Thank you for help. The NI board I use is NI USB-6216. The timing of output signal to trigger external stimulators has to be randomly distributed between 1s to 5s, which I can control with inter-trial interval with matlab when I use anolog output. I will try to see if digital output channel works.
Thanks again.
06-11-2020 12:47 PM
It sounds like you're using software timing for your AO so you can approach DO pretty much exactly the same way. Your device only has 2 AO channels and 2 counter channels, so you'd have to use *some* DO anyway. May as well use DO alone, I would think, all 6 channels. Save the AO and CO for things that DO can't do.
-Kevin P
06-18-2020 10:59 PM
Hi Kevin, thank you for your advice. I did try to control external stimulators with DO channels and it works. I have another question, is it possible to change the single pulse duration of DO output? and how?
Thanks again.
06-19-2020 12:58 AM
It appears that the USB-6216 is a reduced-functionality version of M-series device that does not support hardware timing for DIO. (Most M-series devices support hardware timing but cannot generate their own sample clock. They need to get it from an outside source. NI commonly referred to this partial capability as "correlated DIO".)
So your only option will be software timing, but that's what I figured previously anyway.
Under Windows, software timing will usually be pretty good, but can never be counted on to be precise, deterministic, or reliable. Just warning you.
A typical construct might be to string together 3 functions with sequencing controlled by the error in/outs. First write a True, then call the "Time Delay" function to delay for the amount of time you choose, then write a False to complete the pulse. Just bear in mind that the delay you *get* will sometimes be more than the delay you *ask* for. Occasionally quite a bit more.
-Kevin P