01-10-2013 09:35 AM
Hello all,
I am trying to configure a USB-6353 to initiate 2 tasks (an analog sample set and a digital sample set) at the same time and make sure the samples of both tasks are sync'd. As I currently have this coded, the TDMS files generated clearly show the 2 tasks start sampling at slightly different times and actually end up with a different number of total samples.
I need both tasks to sample at the same rate, start at the same time (this time does not need to be based on an edge, a software trigger or using the DAQmx Start funtion is fine), and take the same number of total samples if possible (but less important than the first two items.)
If it is not possible for the tasks to be sampled at identical times, I am fine with the sampling of both tasks being interleaved (ie, analog channels sampled, digital channels sampled, analog channels sampled, etc.).
I have tried 2 or 3 different methods of doing this and I have attached one of them below.
Thanks!
01-10-2013 09:43 AM
It doesn't look like you based your code on the example that comes with LabVIEW. There is no synchronization at all in your code. Look at the Multi-Function-Synch AI-Read Dig Chan example.
01-10-2013 10:11 AM
I realize there is no synchronization in the example I attached, because I attached the wrong file. I attached the correct one this time. The example I initially tried to follow was "Analog Input - Synchronization". It does not work as I have it coded currently.
I found the example you suggested Ni.com but not in the example finder. I am trying it now. Where does the "Get Terminal Name with Device Prefix" VI come from? I don't have it on Labview 2012.
Thanks for your help.
01-10-2013 10:12 AM
It's in the example folder in 2012.
01-10-2013 10:53 AM
LucasH0011 wrote:Where does the "Get Terminal Name with Device Prefix" VI come from?
It's a VI used in a few examples. You will not find it in the palettes. I recommend saving off a copy for yourself.
01-10-2013 12:35 PM
Please look at my latest attempt that I've attached. This is the method used in the example you provided. I am getting the same results I had before, with the digital and analog tasks taking a slightly different amount of samples and starting at a slightly different time (the difference is milliseconds). I tried this with and without the Start Trigger section.
I greatly appreciate your help.
01-10-2013 03:53 PM
Where are you seeing this difference? In the TDMS files? The data isn't logged until you read it. Since you are not reading at the exact same time, the timestamps will be slightly off. But the data should be clocked in together.
01-11-2013 10:05 AM
Yes, the difference is in the TDMS files.
I understand that the data is not logged until I read it, but surely when the data is read from the DAQ's buffer is not what determines the timestamp (wf_start_time)...
01-14-2013 05:49 PM
Hello LucasH0011,
When you are saying you are getting slightly different amounts of samples, how many are you getting? Your code will write 100,000 samples per channel and then read all of the samples in the buffer.
01-21-2013 08:19 AM
I'm sorry to respond after a week, I've been out on vacation.
Using the code in the latest example I attached on here, the total # of samples collected depends on how long you wait to click "stop" on the front panel. So, after the most recent time I ran the code... I collected 12,965 samples for each analog channel and 13,001 samples for each digital channel.
I have come to understand, through emailing with another NI engineer, that I won't be able to sync up the tasks using a software trigger - I'll need to use a hardware trigger shared by both tasks. Additonally, I won't be able to stop them at the same time (and I am OK with this) without using a phyical stop trigger as well.