LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add date/time to digital Change Detection events

All,

I'm new to Labview and would like to know how to append time and date to digital input state change before storing the data into a TDMS file?

I modified a sample vi to incude storing the data but I've not been able to find an example that is not way beyond my current knowledge base.

 

0 Kudos
Message 1 of 5
(3,543 Views)

You might get more attention on this if you save it in an older version than 2015. Either that, or sharing a Snippet will at least allow anyone to see the code.

 

Since I have 2014, I can only speculate. If you already have the code set up to do the saving to TDMS, you can record the date/timestamp along with the datapoint by converting it to a string and then writing it the same way as the data.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 5
(3,528 Views)

Thanks for the suggestion and help. The snippet is attached.

0 Kudos
Message 3 of 5
(3,518 Views)

Just to save everyone some time I've included a snippet of the program as presented.

Snippet.png


 

Now thas out of the way I have to admit that I have never used the 'DAQmx Configure Logging.vi' before. But from a cursory look over the help file it would seem that it is not able to include logging of timestamps. The best option here might be to ignore the DAQmx version completely if you want to include the timestamps and go on using the proper TDMS file write.

 

[EDIT] After reading over the TDMS write help file this point of interest came up:

Digital waveform

Caution  When you write analog or digital waveforms to a new channel, LabVIEW includes the timestamp information in the waveforms. However, when you append analog or digital waveforms to an existing channel, LabVIEW might discard the timestamp information in the new waveforms.

So if you simply create a TDMS, create a new channel and write the waveform to it, then it should include the timestamp information as well.

0 Kudos
Message 4 of 5
(3,516 Views)

I don't think there is anything wrong with using the built in logging to capture time information.  The problem you maybe experiencing is that the time information is stored as a property of the channel, instead of being it's own channel.  So when you read the file you don't get a time for each sample.  Instead you get a time for the first sample, and the amount of time between each sample.  So with a little math you can figure out the time stamp that each sample was taken.  If you really want this to be it's own channel you can do that as a post processing step where you add a Time channel.

0 Kudos
Message 5 of 5
(3,460 Views)