11-16-2020 05:46 PM
I have been working with analog up until now. I have added a DI/DO module to my DAQmx and now need to work with both digital and analog. I am wondering what the "typical" design pattern is for mixing these two signals.
I am expecting about 10 voltage signals and about 12 DI signals at 1,000/second.
Messing around I learned that I can set up a task for each and then convert a digital waveform to an analog waveform and then add the waveform to my array of analog waveforms. I this "best" or are there better ways to do this?
11-17-2020 07:38 AM
That seems reasonable, but there are 2 other important things you should do:
- sync the 2 tasks in hardware by configuring them to share the same sample clock. (sharing a common trigger can work if both devices are in the same chassis, but I very much prefer the shared sample clock approach whenever feasible.)
One task will generate its own sample clock the normal way, the other will be configured to use it. The former task would then be considered the master for timing, and must be started last.
- read the same # samples from both AI and DI tasks to keep the data in sync as well. This may not be *strictly* necessary, but is almost always a good idea when sampling is sync'ed.
-Kevin P
11-17-2020 08:32 AM
Great! Thank you.
I do have the samples collecting at the same rate. I'll add the clock sharing.
Thanks for your help!