10-04-2017 11:41 AM
I have been able to synchronize multiple DAQ cards in a PC as well as a PXI chassis. This is the first time I have had to do this using Compact DAQ. I am programming in .NET and needed to know how to synchronize multiple clocks using cDAQ. All examples I have been able to find are all LabView.
Here is how I've done this in the past.
Multiple DAQ cards in a PC chassis with an RTSI cable. Use the "OnboardClock" of one of the cards as the AITask.Timing.ReferenceClockSource. For any other cards, you set their ReferenceClockSource to the first ReferenceClockSource.
Multiple DAQ cards in a PXI chassis. Use the "PXI_Clk10" as the AITask.Timing.ReferenceClockSource. For any other cards, you set their ReferenceClockSource to the first ReferenceClockSource.
How does the cDAQ work with on board clocks like individual cards in a PC chassis, or more like a PXI chassis with a specific clock for synchronization? I haven't found much documentation on this.
Any help is greatly appreciated.
Mike S.
10-04-2017 12:48 PM
Is there a specific reason you're approaching sync via Reference Clocks? I've done a lot of multi-device timing and synchronization, and have only rarely resorted to doing any of it via Reference Clock.
I've found that usually when things need to be sync'ed, their data also needs to be correlated. Thus, syncing via Sample Clock alone has often proven sufficient. Triggering is sometimes also needed, but less often than people seem to think.
All that said, I can't give any great detailed specific advice about the cDAQ platform. I just wanted to raise the question of whether the use of *other* timing signals might give you an alternative method to get sufficient sync.
-Kevin P
10-04-2017 12:54 PM
The only reason I've used Reference Clocks is that the sample source code examples I've used in the past have used reference clocks and it definitely works. I'm not opposed to using Sample Clock syncing. Just would like to see an example to make sure I have all properties in the task covered properly.
10-05-2017 08:37 AM
If you're just looking for examples in .NET, there should be some installed with DAQmx if you navigate to Start » All Programs » National Instruments » NI-DAQmx » NI-DAQmx Examples » .NET[version].
10-05-2017 09:46 AM
I've done that and find synchronization examples all have different series of AI cards (M, E, M PXI, DSA Sample Clock and DSA Reference Clock). There is no C series example in the AI Continuous acquisition code. What I have explained in my original post was the M series and the M series PXI examples. I have made those work great, but they don't cover this latest series of DAQ modules (C series). I know I can't use it as an M series device because I've tried that and it gives an error. I've been trying to experiment and have not been able to make things work with two devices getting data at the same time. Even if the clocks are not the same.
10-05-2017
10:21 AM
- last edited on
08-09-2024
12:34 PM
by
Content Cleaner
You will likely just want to use sample clock synchronization. For more information, see section 3 here: https://www.ni.com/en/support/documentation/supplemental/10/synchronization-explained.html
In general, you will simply just want to share a sample clock between multiple tasks with the DAQmx Timing function. If you have many tasks,you will likely want one task to act a master and the rest act as slaves (i.e take care to start tasks in the correct order).
I would look over that architecture and just try to apply it to .NET with appropriate function calls.
10-05-2017 11:33 AM
I'm missing something because I keep getting this error when I attempt to start scanning the devices (see attached file). It is the slave device (cDAQ1Mod2) that is attempting to reference the master device (cDAQ1Mod1). When I start the slave task first, I get this error. Any tips on where to go from here?
10-05-2017
11:39 AM
- last edited on
08-09-2024
12:34 PM
by
Content Cleaner
Seems like a syntax error. Make sure you are typing that source terminal name in the correct format. I don't think that terminal should have any problem being routed.
10-05-2017 11:47 AM
Here is the code specifically:
m_AITask.Timing.ConfigureSampleClock(clockSource, ScanRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(ScanRate));
Where the clock source for the master is "", and for the slave it is "\cDAQ1Mod1\ai\SampleClock"
Do I have to call out the cDAQ device (cDAQ1) as opposed to the module (cDAQ1Mod1)? Or do I have to call out them both (\cDAQ1\cDAQ1Mod1\ai\SampleClock)?
10-05-2017 12:04 PM
I don't have much experience with DAQmx in C#, so I won't be of too much help. I believe it should be forward slashes and not back slashes, though?