Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I save a digital waveform with timestamps for each sample?

Solved!
Go to solution

I am generating a digital stimulus and capturing the digital response using HSDIO 6552. The captured response is either digital data or digital waveform.

 

I want to save the digital captured response and save it to a spreadsheet file showing the timestamp for each sample. How can I go from a digital waveform to a spreadsheet that contains all samples and the timestamps for each sample?

 

 

 

0 Kudos
Message 1 of 10
(6,019 Views)

Hi there,

 

Can you tell me what programming language are you using for your application? Are you using LabVIEW or a text based language? Besides this can you tell me at what speeds are you acquiring and generating your digital data?

 

Regards,
Efrain G.
National Instruments
Visit http://www.ni.com/gettingstarted/ for step-by-step help in setting up your system.
0 Kudos
Message 2 of 10
(5,993 Views)

Efrain,

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

Efrain,

 

I am using LabView 8.6 and am generating and acquiring data at 50 KHz (20 us sample). I will be operating at different data rates also.

 

I am able to convert the digiital waveform to string and save the digital data to a spreadsheet, but I am not able to save the time stamp data into this spreadsheet. To save the digital waveform to a spreadsheet, I am taking the Digital Waveform, sending it to the GET WAVEFORM COMPONENTS to convert it to digital data. The Digital Data is then fed to the DIGITAL DATA COMPONENETS to convert the digital data to Unsigned 2-D array. from Here I use the WRITE TO SPREADSHEET FILE.vi to save the data values to the spreadsheet.

 

I am having a hard time obtaining the timestamp for each sample. I want to add the timestamp to each sample.

 

To obtain the timestamp, I am using the Digital Waveform and feeding it to the DWDT GET WAVEFORM TIME ARRAY. This creates a 1-D array of time stamps. To save this 1-D array of time stamps, I use the EXPORT WAVEFORMS TO SPREADSHEET FILE.VI. The 1-D array of time stamps is the correct timestamp, but when I save this time stamp to a spreadsheet, the time stamp is not correct. n the spreadsheet, it shows a time stamp of 12/31/1903, not the current time stamp. This method of saving the timestamp does not provide the proper time stamp.

 

Another method I use to obtain the time stamp is I take the Digital Waveform and convert it to an analog waveform using the DWDT DIGITAL TO ANALOG.VI. I take the analog waveform and save it using the EXPORT WAVEFORM TO SPREADSHEET FILE.VI. This saves the analog waveform to a text file (or spreadsheet) along with the correct timestamp. In this case, the timestamp is correct, but I do not want an analog version of my digital data.

 

How can I add the correct timestamp to my digital sampled data?

 

 

Thank you,

 

Roger

0 Kudos
Message 4 of 10
(5,942 Views)

Hi Roger,

 

So when you say: "The 1-D array of time stamps is the correct timestamp, but when I save this time stamp to a spreadsheet, the time stamp is not correct." do you mean that by saving this timestamp, it is effectively modified?

 

It might be a good idea to post your code so that we can take a look at it.

Regards,
Efrain G.
National Instruments
Visit http://www.ni.com/gettingstarted/ for step-by-step help in setting up your system.
0 Kudos
Message 5 of 10
(5,918 Views)

Efrain,

 

1)That is correct. The timestamp is being modified when it is saved to a file.

 

I am taking the captured DIGITAL WAVEFORM and feeding it to the DWDT GET WAVEFORM TIME ARRAY.VI. I take this output and send it to two places. One is an INDICATOR that is displayed in the front panel view of LabView. On the LabView front panel display, the time stamps are displayed correct, with the right date and time. The other place I send the time array is to EXPORT WAVEFORMS TO SPREADSHEET FILE.VI. This saves the time stamp to a file. However, this is where the time stamp is being modified. When I open the file, the time stamps in the file are 12/31/1903.

 

2) Should EXPORT WAVEFORM TO SPREADSHEET FILE.VI be able to save the digital waveform to a file along with the correct time stamps? 

 

I am currently unable to post my code or send in a picture. Hope you can still help.

 

Thanks,

 

Roger

 

0 Kudos
Message 6 of 10
(5,883 Views)

Your explanation does not make any sense since it is impossible to wire the output of Get Waveform Array directly to Export Waveforms to Spreadsheet File. The export waveforms function will only accept an analog waveform as an input.

 

Please post your code when you are able.

0 Kudos
Message 7 of 10
(5,858 Views)

Roger,

 

I would encourage you to post your code as well, but another thing you might try would be to take the array of digital data and timestamp array and convert them into a 2D array of string and then write that to the spreadsheet file to see if that helps at all. This might look a little different in Excel when opened though. Again, posting your code would be best.

0 Kudos
Message 8 of 10
(5,833 Views)

Attached are three files of my example code.

 

What I am able to do so far is I am capturing the digital data and saving it to a spreadsheet. This is shown in

Fig1_2D Digital Data.jpg. This is the digital data only with no timestamp.

 

Now I want to add the time stamp to each digital sample. Figure 2 and 3 show my code on how I am trying to do

that.

 

Fig2_Time Array.jpg shows I am using the DWDT GET WAVEFORM TIME ARRAY and exporting this to a spreadsheet file.

The TIME ARRAY.txt files shows the time array output is 12/31/1903. I use the EXT to change the TIME ARRAY to

extended number.

 

Fig3_Analog Waveform.jpg shows I am using the DIGITAL TO ANALOG.VI to convert the digital waveform to an anlalog

waveform. When I save the analog waveform using the EXPORT WAVEFORM TO SPREADSHEET FILE vi, you can see the time

stamp is corret date/time. However, doing this I end up with an analog waveform.

 

I want the time stamp as shown in FIG3_ANALOG WAVEFORM.JPG and the digital data as shown in FIG2_2D DIGITAL

DATA.JPG in one file.


Appreciate the help,

Roger

0 Kudos
Message 9 of 10
(5,614 Views)
Solution
Accepted by topic author R_Rod

Comvert digital to analog is just the wrong function. And when you converted to U8, you just threw away the timing information. Try the code below. It puts the date/time in a single column. If you want two columns, its an easy mod.

 

0 Kudos
Message 10 of 10
(5,575 Views)