Recently I have a project that I need to trigger three different devices by using NI DAQ board. The challenge is that the interval among each individual device has to be as accurate as 0.1 ms. It is impossible to use “wait” function to do that and based on my test, using the “wait” function can not achieve that precise delay.
I have read about some solution in the forum and websites. There is no perfect solution for my situation. After several tests, I came up with a simple solution by just using DAQ assistant.
The idea is pretty simple. First, I have to use the digital output ports which support buffer. Based on the sampling rate (10KHz in my case), feed the DAQ assistant with digital data. In my case, the sampling rate is 10 KHz and 500 samples to read which means my buffer size is 500 samples. The interval between each sample is 0.1 ms, so I can use this to designate the interval among the devices.
In my example, I have three devices, so I used for loop to create three channel data. Once you want to trigger a device, just use replace function to change the boolean array data than you can get a digital output “HIGH”. Additionally, I knew that the interval is 0.1 ms between each sample, so I can precisely control the delay between each device.
I am sorry that I don’t share my complete code here, since it includes other stuff in the program. However, I am more welcome if anyone need to know more.