Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

plot and save digital waveform

The easiest way to add timestamps would be to add it to the 2D array before it is sent to the "Array to Spreadsheet String.vi". You simply just have to append to the first index of the 2D array your 1D array of timestamps. Since your 2D array is actually U8 values, I would recommend converting it to DBLs before appending the timestamp array to it. This way you have better resolution for the timestamps.

Before I just do this for you, I want to give you a shot at it 🙂 . Hint #1, to convert a 2D array of U8s to another type, use one of the conversion VIs from the numeric palette. Hint #2, you have already learned how to add data to an array from early posts.

Don't stay stuck for too long. Reply as soon as you have something either working or semi-working. Be sure to attach your VIs to the reply as well if they are not working.

 

0 Kudos
Message 11 of 13
(1,152 Views)
I've tried to add a time (duration since start in ms) to an array and then add the array to the 2d array. Unfortunetely I don't get it working 😞 no timestamp is added in first column showing the time at the instant 😞

I'll attach my workspace and a snapshot.

thanks alot /Bachman
Download All
0 Kudos
Message 12 of 13
(1,145 Views)

The way you are creating your timestamp array is not even close to what you described to me that you wanted. So let us start there. You did get the combining array part correct Smiley Happy .

It is incorrect to use theTick Count VI to create a timestamp array. The Tick Count VI will return to you the computers clock time in seconds at the point when it is executed. It is in no way representative of your data's timestamps. You are also only getting 3 tick counts in your VI, one for each of the 3 signals. I don't think this is what you wanted. Have you discovered probes yet. It is a debugging feature of LabVIEW that lets you see the data on a wire during execution. Right Click on any wire and select Probe. This will be useful in helping you find out where you are making programming mistakes. If you know what data you want on a wire, and it is not there, you then know that whatever logic put data on that wire must be wrong.

I assumed that you wanted a timestamp that reflects when each sample occured relative to some start time (probably zero seconds). You will need to create this array of timestamps by using the period of your acquisition sample rate, and buiding up an array of values [0, dT, dT x 2, dT x 3, dT x 4, etc]. The 1D array needs to be the same size as the number of total samples in your collected waveform. As difficult as that sounds, it is very easy to program this in LabVIEW. You can do this with a for loop that runs the same number of times as your waveform's sample count. Inside this loop, multiply the index (blue box in bottom left) by the dT (period) of your acquisition rate. Pass the result out of your for loop, and you will have your 1D timestamp array (be sure auto-indexing is turned on for the output). If you know the period by heart, you can just use a numeric constant. If you don't know it, then you can also get the dT component from one of your Digital Waveforms.

You've almost got it. You'll be a labVIEW expert in no time Smiley Wink

 

 

0 Kudos
Message 13 of 13
(1,140 Views)