Hi,
Using a PS5000a and Pico 6:
I don't really know why when I assign the sampling rate the pico does it automatically to something else. What does the pico do actually? In my application I insert the sampling interval in milisec:
Let's say
PicoScope works by first setting the time across the screen, in this example 5ms/div so 50msecs. You then select the desired number of samples you would like to get in this time window, in this case 10kSamples. The software then works out the closest number of samples that can actually be achieved in this time frame with the actual PicoScope hardware you have, in your case in can collect 10kSamples.
These figures give a sample interval of 5usecs and a sample rate of 200 kSamples/sec as shown in the right hand window.
So you have one fixed parameter, time across screen, one desired parameter, number of samples, and one calculated parameter, sample rate.
When you write your own applications you do not have the need to fix the time first, so have greater flexibility in what you can set.
I see from the Pico that Pico always shows 10 Divs. Do we by writing own program using pico sdk get the same amount of divs?
The way Pico calculates the frequency and sampling interval is :
(number of divs)*(the type of Div)/(number of sampling point) which will be ( for 10 div and 5 ms/Div and 1000 sampling points)
I have seen that the number of samples vary in the loop and is not always the same. I really want to know how you succeed to have same amount of sample points and same number of time divs. That is crucial for me to know.
If you wish to have 10 divisions on the screen, then it is down to you and your application. It has nothing to do with the SDK. The PicoScope 6 application is replicating the look of a bench top scope which is one of the reasons why we do this.
It does cause extra overheads, in that you have to calculate out sample interval that will work for the given screen time, and that can be achieved with the chosen hardware.
The other part is that in PicoScope 6 it is not full streaming. It is a block collection mode that allows you to see the data whilst it is being collected if the collection time is long.
You are getting a bit confused due to some of the terms you have in your import file, this is the actually one from GitHub
[DllImport(_DRIVER_FILENAME, EntryPoint = "ps5000aRunStreaming")]
public static extern uint RunStreaming(
short handle,
ref uint sampleInterval,
ReportedTimeUnits sampleIntervalTimeUnits,
uint maxPreTriggerSamples,
uint maxPostPreTriggerSamples,
short autoStop,
uint downSamplingRatio,
RatioMode downSampleRatioMode,
uint overviewBufferSize);
No mention of SampleCount.
The driver will collect the Pre and Post trigger samples and store them in an internal buffer which can be read out after the block has been collected.
The overviewBuffer is where the driver places the collected data, downsampled if required, that is being drawn on the screen as the collection progresses.
Honestly I would forget trying to exactly replicate the PicoScope 6 functionality for streaming, it is unique for our purpose, and code your application to do exactly what it needs to do. Copying PicoScope 6 is like trying to code with your hands tied behind your back, which is why you are having difficulty understanding this.
Thank you very much for your response,
Can you please answer what the div selection ( for instance 5ms/div) does to the sampling? Is the division length defined somewhere in streaming?
5ms/div means that we put dashed lines across the screen at 5msec intervals. As there are ten divisions we have a Collection Time of 50msecs which is the important part.
Payam30 wrote:
The way Pico calculates the frequency and sampling interval is :
(number of divs)*(the type of Div)/(number of sampling point) which will be ( for 10 div and 5 ms/Div and 1000 sampling points)
As I have said, don't worry about divisions, that is purely a PicoScope display thing. Instead just use sample interval and number of samples, then time will look after itself.