06-06-2022 10:29 PM
I am trying to make a vi that should be able to acquire continuous measurement and save data in a text file without losing a single data point. My code takes approx. 2 sec to execute while loop once and in that time it takes only one set of data that is of a given time base of 0.005s*10 (it saves 2500 points per set). This means it is losing all the data measured during the whole 2 sec. Please suggest a solution. Thanks in advance.
06-07-2022 01:01 AM
Definitely, it should be possible but we could only speculate where your implementation lacks. Please share your source code for review.
06-15-2022 04:01 AM
Dear Santhosh. thanks for the reply. Here I am attaching my code for Tektronix TBS 1202B model. Please check and suggest. Thanks for your guidance.
06-17-2022 10:58 AM
There are some ways to speed up the code, but it's highly unlikely that you will be able to "stream" all data to the pc from the scope. If that's your goal, then you should look at scope internal storage options. Your code would trigger the measurement to run for N seconds, saving all data internally on the scope. Once the measurement completes then you can download the data from the the scope and do post processing.
If you need real-time capture of one point on a trace then look at the "marker" functions. You can usually get a single marker reading buffered to internal memory back from the scope
As it stands your code is trying to download and save two trace 22500 each. Transferring 45000 pts takes time, saving that data to a file (which you open/write/close every loop) takes time, sending commands to scope to read data takes time. During all those little delays the scope is capturing data which you will miss.
A few tips to speed up what you showed.
- use shift registers to save data and only write data after the loop ends (faster, but could be memory limited)
OR
- open the file before the loop, close the file handle after the loop and only write data during the loop (slower but not saving big volume of data in memory)
- don't update a table in the loop, don't update the chart in the loop.
On another note..
- Saving a data file with an array of points from the Get Date/Time seconds doesn't seem like what you want to do. If you want to save the trace data with a timestamp to be able to replot your signal versus time later, then you need to get the time base settings from the scope and calculate the time based on that increment between points. Or just save the trace and rebuild the timestamp in what ever analysis software afterwards.
Give these suggestions a try and let us know how it goes.
Craig