Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get a timestamp for each daq counter measurement?

Hello, I am currently using DAQmx to read a PWM signal and calculate the pulse width using the implicit timer. Is it possible to also get the timestamp of each pulse width measurement? I have been able to do this with an analog signal by using a waveform output, but I can't figure out how to do this with a counter measurement. Thanks in advance for the help!

0 Kudos
Message 1 of 6
(8,891 Views)

I think that you have asked a great question. Something that many engineers may not be aware of is that the DAQ device itself does not actually create the time stamp. It is created by the comptuer system when the data is retreived from the DAQ card. Because of this, the time stamp is actually delayed by a significant amount. This delay may be less than the resolution for time stamps (one millisecond) but it can sometimes be greater than that. This Knowledge Base article discusses it this in more detail: http://ae.natinst.com/public.nsf/web/searchinternal/5d42ccb17a70a06686256dba007c5eea?OpenDocument

 

If your pulses are closely spaced, the generating a timestamp for each aquisition is not practical. But, if your pulses are spread apart by a significant amount (more than 0.1 seconds or so depending on the specifics) then the timestamp might be accurate enough to be practical. One way to do that with counters would be to use the Get Date/Time in Seconds VI in LabVIEW just after the DAQmx Read VI. Then, once the Counter Input measurement is complete, LabVIEW will create that timestamp very quickly afterward. Please notice that there will be some time delay between the completion of the read and the creation of the time stamp.

 

Jeremy P. 

Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(8,878 Views)

I figured this would be the case when using a separate timestamp block with each DAQmx Read block. The pulses I am reading are between 1 and 2ms - is there a way to get a more accurate timing value? Is there a way to get a count number reading with every pulse width measurement directly from the DAQ instead of getting a timestamp from the system?

 

Thank you for your help!

0 Kudos
Message 3 of 6
(8,871 Views)

I believe what you want to use is the CI Pulse Time Channel. This will measure the high and low time of each period. You can configure it to return N Samples of high/low pairs. I would recommend that you try this out and test it to make sure that it doesn't skip any pulses. Here is a link to another forum post in which another user did something similar. http://forums.ni.com/t5/Counter-Timer/Implicit-pulse-measurement-and-Digital-Input-on-X-series/m-p/1...

 

Jeremy P,

Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(8,857 Views)

You didn't mention what hardware you are using but CI Pulse Time only works on STC3 devices (like X Series or cDAQ).  For other devices, you can do something similar with a Semi-Period task, which will return a sample for each high and low time (the cumulative sum of semi-period times would be computed in software and is the timestamp relative to the start of the task).

 

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 6
(8,849 Views)

Thanks, John, for clarifying that. I forgot to mention that important detail.

 

Jeremy P.

Applications Engineer
National Instruments
0 Kudos
Message 6 of 6
(8,834 Views)