Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

CDAQ 9174/9178 modules synchronization

Dear Sirs,

 

I'm triying to prepare an application to read data from three modules (9215A, 9219 and 9213) on a 9174 chassis and then record this data in a TDMS file. I'm carrying out some test acquiring data in modules 9215A and 9219 at the same rate (always < 100 Hz) but I don't get the same number of samples in both 9215 and 9219 modules when I check the TDMS file after the test. I'm using a different time engine with each module (time engine 0 for 9219, 1 for 9215A and 2 for 9213).

 

I have enclosed below the block diagram (is divided into two jpg files) below.

 

Thanks.

Download All
0 Kudos
Message 1 of 7
(6,227 Views)

You aren't providing a number of samples to read in your DAQmx Read VIs, so each of them will just read however many samples are available from that particular timing engine.

 

Your three tasks are also starting at different times-- you're creating and configuring the first task (cDAQ1Mod4), starting it, then creating and configuring the second task (cDAQ1Mod2), starting it, then creating and configuring the third task (cDAQ1Mod3). Thus you're seeing a different number of samples the first iteration in the first task then the third task, because the first task has been running for slightly longer.

 

Are all three tasks running at the same rate? If so, you can put all three into the same task by using multiple DAQmx Create Channel VIs. The attached 'multiple-daqmx-create-channel' VI snippet demonstrates this (although for a simple finite task).

 

If they're not running at the same rate but you still want to start them synchronously, you can configure all three tasks to use a start trigger, and then use a counter to generate a single pulse that triggers all three simultaneously.

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 2 of 7
(6,221 Views)

Thanks for your quick answer Bsteriff!!

 

I have try to improve the code with a start trigger but I'm not sure. I have enclosed the new code snapshoots below. Now I get the same number of sample in both 9215 and 9219 modules at 100 Hz and a proportional number of samples in module 9213 at 1 Hz (100 times less). But if all sample rates are different (100, 50 and 1 Hz), module 9213 task is operating more time until get its last sample at 1 Hz and modules 9215 and 9219 stop earlier but also in different times.

 

Thanks.

 

Download All
0 Kudos
Message 3 of 7
(6,208 Views)

How many samples are you expecting to read each iteration of your loop? You still aren't giving a 'number of samples per channel' on your DAQmx Read VIs.

 

Also your tasks may be started in any order; Since you're triggering the second two tasks off of the first's te0/StartTrigger signal, if the first task (the one using te0) starts first then your second two tasks will sit and wait for a trigger that has long since fired. You want to start the second two tasks first (they'll sit and wait for the trigger) then the first one. You can use the 'error' wires to determine execution order, like so:three-tasks-with-trigger.png

(I didn't have a 9213 handy, so I substituted a 9205; the same principles still apply.)

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
Message 4 of 7
(6,187 Views)

Hi,

I am trying to figure out what am I doing wrong in attached Vis. So, I am trying to read data from two modules (cDAQ1Mod1 = 9201, cDAQ1Mod2 = 9205) simultaneously. I use 9174 chassis. Rate for the first module (9201) is 50k, for the second (9205) I used 10k.
I used methods for synchronization from old Topics here. In each Vis I measured time between start  times of two waveforms from modules. On each start of application I get different time difference, sometimes that difference is big (aprox. few milliseconds) but sometimes is a few microsecond. But I would like to avoid that time shift (I would like to read channels (or tasks) at the same time, simultaneous). Is that possible with cDAQ equipment? Or I have to use something with simultaneous reading without modules with multiplexors. Now I am using solution test_1 (picture bellow) with few miliseconds time shift (sometimes when I am lucky at starting app. I get few microseconds 🙂

test_1.png


Thanks and sorry if I didn't see that somebody already has solved this problem.

 

Regards,

Voltic

Download All
0 Kudos
Message 5 of 7
(5,878 Views)

This page from the Knowledgebase mentions that when using an internal signal such as aiStartTrigger, you can expect phase-synced signals when collecting at different rates, however they may still start at different times. 

 

The author suggests the use independent digital triggers on something like a 9402 to start simultaneous collection. I tried this (on a 9401) modifying one of Voltic's test VI's above, unfortunately I still had the same timestamp delays, between 0.05-1.0ms. My temporary solution will be to just upsample the lower signal and then align them based on timestamp in post-processing.

 

Has anyone successfully used this hardware to start at the same timestamp (or at least with very little delay) when using 2 different acquisition rates? 

 

0 Kudos
Message 6 of 7
(5,691 Views)

I know this is an old thread, but I was having the same issue, and this solution helped, so thanks!

 

On the timing loop in the example, it seems like the time difference you're seeing based on the timestamps would not be accurate.  If I'm not mistaken, the timestamp is not a function of the DAQ clock, so a difference in the timestamp values from the two read functions will not indicate a difference in the actual sampling clocks.

 

 

0 Kudos
Message 7 of 7
(5,204 Views)