LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing with external triggering of DAQmx

I am using PFI0 to externally trigger a PCI-6023E DAQ board, as following



For the 'rate' input of the DAQmx timing VI, the LabVIEW help says : 'If you use an external source for the Sample Clock, set this input to the maximum expected rate of that clock.'

So, I set rate=1000Hz here, even though the frequence of external triggering pulse is 25 Hz.

From the updating speed of the waveform chart, I can see that the data were acquired at 25Hz. However, when I write the waveform data to a data file and open that result file, I found that on the column of X axis (corresponding to time), the dt is 0.001, instead of 0.04. This means dt is determined by the value that I wired to the rate input, instead of real physical time.

ANyone know why this happened? How to make true physical time to be written to data file?

Thanks a lot for your advice.

-Regards,
Dejun

Message Edited by Dejun on 08-27-2007 07:03 AM

Message Edited by Dejun on 08-27-2007 07:04 AM

0 Kudos
Message 1 of 8
(2,972 Views)
The content of the data file is as following:

X-axis    Y-axis
t0            ***
t1       ***
t2    ***
....................

For the first time of running the VI after I open it, I found t0 is zero. However if I didn't close the VI, wait for a while, then run the VI again, I found t0 is not zero this time. The longer the waiting time, the lager is t0.    As long as I close the VI and run it again, to start from zero again.

Above happens only for 'external trigering'. If I use 'onboard clock', t0 is always zero no matter when I run the code.

So, under the case of external triggering, how shall I make t0 always be zero no matter when to run the VI?


0 Kudos
Message 2 of 8
(2,963 Views)
Pop up my own post ......waiting online
0 Kudos
Message 3 of 8
(2,956 Views)
Personally, I rarely use waveforms, in no small part due to the kinds of issues you brought up. 
 
Your example uses an external sampling clock.  By definition, the actual rate is out of the task's control.  So DAQmx is kinda stuck having to believe whatever number you wire in as the *alleged* rate.  Inconvenient, but kinda unavoidable.
 
Maybe the simplest thing for you is to override the "t0" and "dt" values after the fact.  There are waveform functions that let you wire in your own chosen "t0" or "dt" to associate with the data array.
 
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 8
(2,941 Views)


@Kevin Price wrote:

Maybe the simplest thing for you is to override the "t0" and "dt" values after the fact.  There are waveform functions that let you wire in your own chosen "t0" or "dt" to associate with the data array.

Hello Kevin,

Thank you very much for your help. Can you explain in more detail in how to do this?        I don't know how and where to modify data with my own t0 and dt.

Thanks a lot.

-Dejun
0 Kudos
Message 5 of 8
(2,937 Views)
You can use Get Waveform Components and Build Waveform functions found in the Waveform palette.  If you expand these functions towards the top you will see t0 and dt.
 

Message Edited by tbob on 08-27-2007 09:19 AM

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 8
(2,931 Views)
My waveform data are from two channels, so the data are in 1D array of waveform. So, in order to use the two waveform functions you recommended, do I have to split the signal using array index function, and later build them into an array again later for displaying and writting datafile?
0 Kudos
Message 7 of 8
(2,927 Views)
Yes you should get each waveform from the array using Index Array.  Then combine them after changing t0 and dt back into an array using Build Array.  You can also use a For Loop, wire in the array and set the terminal for indexing enabled.  Set the output also for indexing enabled.  The For Loop with indexing enabled would take the place of Index Array and Build Array.
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 8
(2,918 Views)