Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

"Synchronizing" (accurately timestamping) data from separate USB devices

Solved!
Go to solution

Hi All,

 

I am working on a system in which I am:

 

- providing an analog output to create an excitation signal (call it OUT1)

- acquiring an analog voltage which precisely measures the excitation being applied (call it IN1)

- acquiring 2 outputs from a sensor which responds to the excitation: one is an analog voltage, the other is a CAN signal (call them IN2 and IN_CAN)

 

Currently, I am using an NI-6216-OEM USB device for all the analog tasks and an NI-9862 in the cDAQ-9171 chassis for the CAN communication.  Thus these are two separate USB devices which cannot communicate with each other directly (which may be the reason for all my problems, but here goes)

 

I am trying to acquire IN1, IN2, and IN_CAN in such a way that, even if post-processing is required, I will have three arrays which all represent data from the same absolute time, to within +/- 1ms would be the goal, as this would be enough to perform some phase-sensitive analysis that I need to perform.

 

Simply synchronizing IN1 and IN2 with each other is quite easy, as I can perform a 2-channel sampling operation with the 6216 card.  Synchronizing the IN_CAN acquisition has proved trickier, as I cannot use the usual techniques of routing a synchronization signal, sample clock, start trigger, etc between the two cards.  So the next best thing I tried was to use the waveform acquisition tool and it's timestamps, but I still end up with a ~15ms delay between the IN_CAN and the IN1 signals, even when the waveform timestamps reported by each indicate that the samples were taken at the exact same time.  This delay is evident in the "looping" of the XY plot.  So there must be some error in the reported t0's in either the analog read or the CAN read operation, and I am not totally sure where the error is coming in.  On top of this, I am not sure if what I am trying to do is a futile exercise or can be fixed with better software design (I am a noob to LabView).

 

I have read this about the timestamps, and it seems that as long as the read request occurs while acquisition is still happening (it must as I am continuously sampling), I should be able to do much better than 15ms.

 

I've attached the VI and some screennshots for more information.  The relevant part is states 3.0 and 3.1.  All help and advice, including throw your crap away and buy the 4-slot card to stick ANA IN, ANA OUT and CAN modules which can be hardware synchronized, will be much appreciated.

 

 

 

 

0 Kudos
Message 1 of 2
(3,379 Views)
Solution
Accepted by topic author bodypillow

Hello bodypillow,

 

The only way to synchronize your USB-6216 with your NI 9862, is for the two devices to share a timebase and a trigger (as you mentioned). Unfortunately, the NI 9862 has no lines from which its timebase can be routed to your USB-6216.

 

The USB-6216 can accept an external clock as the timing source for analog input tasks. To do so, you would have to wire the clock source to any PFI line on your device, and then within your LabVIEW task, designate that line as the “AI Sample Clock”. Refer to page 4-14 of the following manual for more information on this:

 

NI USB-621x User Manual

http://www.ni.com/pdf/manuals/371931f.pdf

 

Since there is no pin on the NI 9862 through which the timebase on the backplane of the cDAQ can be accessed, you have no means of exporting the cDAQ’s timebase to your USB-6216.

 

There is an example program in LabVIEW that shows how one would synchronize a C Series CAN device with a DAQmx Analog Input. Within the LabVIEW Example Finder, it is in the folder: Hardware Input and Output>>CAN>>NI-XNET>>Synchronization. This example shows that the two devices need to share a start trigger; it does not show the devices sharing a clock, because the example assumes the two modules are in the same chassis, which would mean that they share a timebase.

 

Considering that the only way to synchronize your USB-6216 and NI 9862 is for them to share a trigger and a timebase, you would need to incorporate additional hardware into your system, such as a larger cDAQ chassis that contains a module capable of exporting the timebase of the chassis to your USB-6216.

 

Please let me know if you have any additional questions regarding this topic.

Gabby
National Instruments Applications Engineer
0 Kudos
Message 2 of 2
(3,349 Views)