Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Different time stamps

Highlighted
My Labview program starts two continuous sampling processes and then periodically reads the inputs.  Both get data from cDAQ harware -- one for thermocouples, one for currents.  Both processes initializae at program startup, with the initialization vis running in parallel (two subvi calls in the same sequence frame).  When I read data at 1 Hz in the main program loop, I find that the temperature data time stamp is about 10-15 seconds earlier than the current data -- even though both buffers were read the previous 1 Hz program cycle.  The computer is Vista on a Dell dual-core processor.  How can I get the data to time align?
0 Kudos
Message 1 of 4
(1,861 Views)
Highlighted
Hi Hoard,

That is pretty interesting behavior that you are seeing. I am still slightly unsure of how your program is operating, as you have said you are configuring each of the tasks separately. Could you please attach your VI or a screenshot of the code? Also, I am interested in more details about the problem you are seeing. Are you configuring the hardware for a specific rate and number of samples to read, or is the read software-timed? Also, when the read happens, are you able to guarantee that each cycle is only taking 1 second? Is the 10-15 second timestamp difference showing that the other timestamp occurred before the current (correct) timestamp, or does it show that it happened in the future, or after the correct timestamp? If you could include a screenshot of the data you are reading, it would also be helpful. Thanks,
Daniel S.
National Instruments
0 Kudos
Message 2 of 4
(1,841 Views)
Highlighted

I have done some further investigation, and here is where I think the issue arises:  In my main program (frame 0) I call a routine to initialize the input temperature and current read tasks, and the analog current write task.  These are all listed in one program panel, so the execution order is not defined but it looks like it goes in this order:

- Initialize the Read All Currents task ( reads 4-20 mA data from cDAQ1)

- Initialize Write All Currents Task (writes to currents on cDAQ1)

- Initialize read All temperatures Task (reads from cDAQ2)

When I start the Main program, the first loop is 10-15 seconds -- i.e., almost the same as the time difference in data time stamps.  I think the Current data gets started and then there is a delay until the temperature data gets started, and this time offset persists throughout the program.

 

Can I fix this by (at the end of the initialization or on the first data read) fircing t0 of the temperature to the value for the currents?  Or, is there a way to force the two cDAQ units to have the same timer?

 

Thanks.

0 Kudos
Message 3 of 4
(1,816 Views)
Highlighted

Hi Hoard,

 

I am still slightly unclear on what your program actually looks like, but ideally you would want to have the current and temperature readings happening together, in the same task. Therefore, when you perform your read, it will take a reading from both devices at the same time. You can have different DAQmx Create Channel VIs wired together in series, such that the current and temperature inputs are in the same task. Then, when you callDAQmx Read, you will simply be reading multiple channels for each different type of measurement. For more information on this topic, please see the online KnowledgeBase articles titled "Using Different Types of DAQmx Global Channels in the Same Task" and "Virtual Channels of Different Measurement Types in One Task in the DAQ Assistant". Of course, you can always play with the t0 value returned from the waveform, such as wiring the t0 from one waveform and using this as the t0 of the other waveform. However, this does not actually change the fact that the readings are not happening at the same time, and so the first method of using a single task would be the best choice. Hope this helps,

Message Edited by dansch on 08-18-2008 06:21 PM
Daniel S.
National Instruments
0 Kudos
Message 4 of 4
(1,786 Views)