LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to place time stamps without creating delays?

Hi,
 
I am measuring signals when the PFIO input is triggered. This occurs at a variable rate, but in the khz range. I need to place a time-stamp every 100ms or so on the measurements, but I am not sure how to do this without creating a 100ms delay in the program.
 
Sorry if this question seems a bit basic... I recently took a crash course in Labview to solve the current prob. I am using version 4.1 Robot Sad
 
Thanks in advance,
 
Harry
 
0 Kudos
Message 1 of 12
(4,513 Views)
Could you give a few more details, and perhaps post some code?  I think you want to timestamp when the PFI line is triggered - triggering your data acquisition.  Is this correct?  DAQmx and the MI drivers all do this automatically now using hardware timing, but it was not so easy in LV4.1.  There are ways, however (e.g. read a free-running counter on the DAQ board at each trigger).  Let me know if my presumption is correct and we can proceed.
0 Kudos
Message 2 of 12
(4,469 Views)
Hello DFGray,

You presume correctly. I would like to put a timestamp on each acquired data bit (or at the very least at 100ms intervals).

My DAQ card is the AT MIO E10.

The program I have attached works in the sense that it reads the data. But the time-stamping doesn't seem to function (though it does write something at the begining of the file).

How do I use this "free running counter" to which you have alluded?

Thank you for helping! Robot Very Happy

Message Edited by hax on 09-07-2007 10:27 AM

0 Kudos
Message 3 of 12
(4,455 Views)
The major issue is that the time your timestamp is read is not deterministic for a couple of reasons.
  1. The timestamp is created at some time before it is added to the start of the array.  The time this occurs, whether before the data acquisition or after, is not determined.  The code is parallel.  In actual practice, it will tend to be about the same offset each time (see second point below), but if you modify the code, this offset could easily change.  Note that LabVIEW 4.1 does execute the items in a diagram in a sequence.  However, you do not have much control over what that sequence is.  It tends to be the order the objects were dropped into the diagram, moderated by data flow constraints.
  2. You are relying on the OS to give you reliable timing.  Most desktop OSes have a normal jitter of about 10ms, and it could go to seconds in some cases (e.g. a large e-mail arrives).

Your solution is to use hardware timing.  Set up one of the counters on the MIO board to run freely using one of the internal clocks.  When you read your data, read the timer as well.  You may be able to synchronize this by using a buffer for the data reads and one for the timer.  It has been a long time since I used this type of board, but I think you can set it up to simultaneously acquire both counter and analog data.  You only need the first point of the counter data, which can then be converted to a timestamp based on the clock speed.  You will need to account for rollovers in the counter.
Message 4 of 12
(4,416 Views)

Hello again,

I have now got Labview 8.2!!!

Could you please let me know what I need to add to the program I have pasted in order to have time stamps on the data. I have been trying all day mucking around with the waveform functions but to no avail. Robot Mad

Thanks,

Harry

 

0 Kudos
Message 5 of 12
(4,367 Views)
You need to use a file write function that supports timestamps in the waveforms such as Export Waveforms to Spreadsheet File or Write To Measurement File. I don't think you can even get the correct Y array data written when you wire an array of waveforms to the Write to spreadsheet file.
0 Kudos
Message 6 of 12
(4,362 Views)
Thanks, I now have a file which puts the time and date on the measurements. However, what I am really trying to get is a time stamp in mili-seconds.
 
Also, I noted that the time stamp which is placed on the data is only that of the time (in hours,mins,secs) of the first point and the same time stamp is given on every subsequent point.
 
Can this be done simply?
 
 
0 Kudos
Message 7 of 12
(4,333 Views)
The dt in microseconds is in the header but if you want to include it in the time column, you need to modify the subVI that is creating the time string. Open the Export Waveforms to spreadsheet File and in the lower center part of the diagram, there is a subVI called Waveform Time to Date Time String. Open this and you will see the format string of %H:%M:%S%u. Add a number in front of the u to indicate how many decimal places you want. In LabVIEW 8.5, the format string is %H:%M:%S%6u which gives you microsecond resolution.
Message 8 of 12
(4,302 Views)
Great!!!!
 
I now have mili-second time stamps on each of the data signals that I measure. Only one more problem remains, for some reason each of my signals is labelled with the initial time, this is most frustrating.
 
How do I instruct labview to place a time-stamp on the data which is in accord with the time in which the signal occurs?
 
Thank you so much for getting me this far!
 
Robot Happy
 
I have attached a sample of the data I get which perhaps more clearly shows the problem.
0 Kudos
Message 9 of 12
(4,289 Views)

That's a bit odd. When I run the Export Waveforms to Spreadsheet File, I get this:

waveform [0]
t0 9/18/2007  22:21:00.000000
delta t 0.001000

time Y[0]
9/18/2007  22:21:00.000000 1.000000E+0
9/18/2007  22:21:00.001000 3.000000E+0
9/18/2007  22:21:00.002000 5.000000E+0

There is no delta t in the header of your file and I don't understand why though I have not used the traditional DAQ functions in quite a while. Put a waveform array indicator on your front panel and see what the dt is. You are using an external clock and from image of the diagram, there's no way to tell what the sample time is. Is it possible that it is less than 1 us?

Message Edited by Dennis Knutson on 09-18-2007 10:31 AM

0 Kudos
Message 10 of 12
(4,280 Views)