LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing Problems with DAQ

hi

 i am using the USB 9221 DAQ and i made a simple datalogger which stores the signal into a lvm file. the signal is a linear slope with a negative gradient

i have also included the express vi timer where when the voltage goes below 9V the timer is marked at the instantaneous time and when the voltage goes below 1volt it is marked again, hence it will give me two ponts in time so i can calculate the  "delta" time (t)

 

but when the sampling rate is increased the timing is often incorrect.. can anyone help?

 

also when the signal is displayed on a chart it shows the signal delayed by up to several seconds. i know this becuase when i know the signal is zero it still showing the voltage above zero.

 

thanks

0 Kudos
Message 1 of 10
(3,343 Views)

more info

 

the signal starts at 10volts and moves to 0volt, the signal is linear

Message Edited by Labviewuser3 on 04-27-2009 06:50 PM
0 Kudos
Message 2 of 10
(3,340 Views)

Labviewus-

No you can't calculate dT. You are dependant on the system mSec timer (the 9221 is software timed) and it is not tracable to a NI SECOND!

 

You can approximate dT - but you have no measurement of time- just a guess that means nothing.  use a counter! 

0 Kudos
Message 3 of 10
(3,324 Views)

so i carnt even use the express vi Elapsed Time ?

 

0 Kudos
Message 4 of 10
(3,321 Views)

Not if you want a measurement tracable to the unit "Second"

 

the system clock is a really bad "watch" and keeps "civil time" or "time of day"- no direct relationship to the second.  (anyone got a Degree I can borrow? Farenheight, celcius, arc, collage- it makes no difference)

 

0 Kudos
Message 5 of 10
(3,314 Views)

sorry but im a bit confused.

 

isnt the express vi displaying the elapsed time, therefore the time it hapened? or is the while loop holding it back giving it a delay

 

0 Kudos
Message 6 of 10
(3,304 Views)

Hi Labviewuser3,

 

The 9221 is actually hardware timed, offering a sample rate of up to 800 kS/s (multiplexed).  Thus, if you have configured a sample clock for the 9221, the amount of time between samples will be a constant value determined by the sample clock (e.g. a 1 KHz rate would result in a 1ms dt between samples).

 

Thus, you can determine the exact time elapsed (based off of the sample clock, not the OS clock) by checking the amount of samples in between your two threshholds.  The amount of time elapsed would be equal to 1/Fs * N, where Fs is your sample rate, and N is the number of samples that occur between the threshholds.

 

EDIT: The timestamp is determined in software using t0 from the OS clock, and dt based off of the sample clock rate.  Since your application is measuring the difference between two points, the t0 value should not be important.

 

-John

Message Edited by John P on 04-28-2009 11:12 AM
John Passiak
Message 7 of 10
(3,270 Views)
Thank you for clarifying the 9221 capabilities

"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 10
(3,264 Views)

thanks guys

 

what would be the best way to to measure the delta time?

 

currently i have logic which logs the time from the Express VI "elapsed time" both start and finish times. is this sufficent in giving the correct time?

 

on the alternative how can i devalop logic to count the number of cycles from the 9221 as you have explained?

 

can you also explain the differnece between the aqiusition mode settings :

1 sample (on demand)

1 sample (HW Timed)

n samples

Continuous

 

thanking you

 

0 Kudos
Message 9 of 10
(3,248 Views)

Hi Labviewuser3,

 

I would look at the amount of samples that occur in between the two voltage levels.  Using continuous sampling, all you really need to do is count the number of samples that occur between your threshholds.  If you are logging the data to a file, this would be the number of rows between the data points.  In LabVIEW, you could use the Threshhold 1D Array function to determine the index where your threshhold is crossed if the data is in an array.  Just take the difference between the indexes to determine how many samples have elapsed. 

 

The difference between the timing types is as follows:

  • 1 Sample (On Demand) -- This is a software-timed operation.  That is, each time DAQmx Read is called, you will read whatever data is currently on the line (one sample).  No clock is used in this case, but rather the loop rate of your program determines when you sample data.
  • 1 Sample (HW Timed) -- Similar to the above, but this time there is a physical clock that is used to sample the data.  There is no buffer--the data will actually be read in your program when DAQmx read is called.  This is often used on real-time systems.
  • N Samples -- This mode uses hardware timing, along with a buffer.  The hardware is configured to acquire N samples, and then stop.
  • Continuous -- This mode also uses hardware timing with a buffer, but will continuously acquire until you tell it to stop.  Thus, you need to make sure to call DAQmx Read inside a loop so that you continuously read data from the buffer so it is not overwritten.  If using the DAQ Assistant, it should automatically create the loop for you.
John Passiak
0 Kudos
Message 10 of 10
(3,217 Views)