Jump to content
  • 0

Collecting data at consistent time interval


Abdullah1

Question

We are looking on collecting 50us of data every 1000us. However we are able to collect 50us at random times. See attached code. Could you suggest a modification to the code or a solution to this problem. 

 

clear() 
// Set up the scope channel 2
//Scope1.Rate.value = 50000000;  // Sampling rate (50 Mz)
//Scope1.Samples.value = 2500 //
Scope1.Time.Position.value = 25e-6;
Scope1.Time.Base.value = 50e-6
Scope1.Trigger.Type.text = "Edge"; // Trigger type
Scope1.Trigger.Source.text = "Channel2"; // Trigger source
Scope1.Trigger.Condition.text = "Rising"; // Trigger condition
Scope1.Trigger.Level.value = 0.5; // 50% trigger level
Scope1.Trigger.Hysteresis.value = 0.1; // Trigger hysteresis
Scope1.Trigger.Filter.text = "Decimate"; // Trigger filter
//Scope1.Trigger.BufferSize.value = 2500 //uffer size
//Scope1.Trigger.Buffer.value = 0; // Buffer index
//Scope1.Trigger.Delay.value = 0; // Trigger delay
for(var i = 0; i < 200; i++){
    print("Recording", + (i+1) + " of 200...");
    Scope1.run();
    Scope1.wait();
    Scope1.Export("/home/SWE/Desktop/new007/new007_" + (i + 1) + ".csv");
    wait(0.01)
}
print("Finish Recording")

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @Abdullah1

Which device are you using?

With Analog Discovery 3, ADP2230, ADP3X50... notice the high precision hardware trigger datetime stamp in top of the plot.
With WaveForms app to improve the capture rate set: Update: Fastest, uncheck Noise, specify Samples, Edge Hist: Off (may work even with On), specify Buffers and Run: Buffer Stop
For Buffers you can specify +1 since the first capture(s) seems to have a bit more delay, probably due to initial memory allocations.
Make sure the Scope is not visible, like select Welcome tab, press Run button in Scope tab.
Then export data using Script tool, looping through Scope.Buffer.value, like from 2 to 101

The ADP2230, ADP3X50 have device buffering which provides ~1us capture latency. This can be enabled under the dropdown before Buffer option.
Since transfer does not influence capture latency, the View/Logging can be used to auto export captures sequentially.

image.png

image.png

image.png

image.png

image.png

 

Custom app/script can perform better than WF app if less processing is performed between captures, like 4096 samples @ 100MHz on 2 channels at 1ms
See the following example: AnalogIn_Triggers.py

image.png


 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...