My aim is to get a waveform sampled at 7.8125 MHz using the oversampling feature in order to enhance vertical resolution.
Therefore, I tried to set the sampling frequency to 125 MHz, and use oversample=16.
I connected channel A to a 120 kHz sinusoidal waveform generator. We have a picoscope ps4227.
However, the code copied below does not work.
-When I try with oversample=1, everything works fine: the period of the digitized signal in outputvaluesA that I measure manually, by visualizing the waveform, is what is expected (i.e. 1e9/120e3/interval samples)
-The values returned by getTimebase are as expected (interval=1.0e9f/fs, and maxsample is divided by 16 compared to oversample=1)
-The period of the digitized signal in outputvaluesA that I measure manually is 1e9/120e3/(interval/16) samples (the same number of sample as with oversample=1), and not 1e9/120e3/interval, as expected
- The vertical resolution is not enhanced (still 12 bits)
Therefore, it appears that oversample=16 acts as expected for the function GetTimebase, however for the function RunBlock oversample=16 gives exactly the same data as what would have been obtained with oversample=1.
Is something missing or wrong in the code? Does our picoscope have ths oversampling feature?
Also, we noticed that in the last version of the SDK (10.5.019), the functions ps4000SetSimpleTrigger and ps4000IsReady are missing from the .lib file (an error is sent by the linker). We worked this around by using the 3 other trigger functions and the callback for RunBlock, it works fine but it is less convenient.
Code: Select all
fs=250e6/pow(2,nFs)/oversample; //targeted sampling frequency (after subsampling): 7812500 Hz
nsample = ceil(wfm_duration*fs);
ps4000GetTimebase(handle, nFs, nsample, &interval, oversample, &maxsample, 0);
printf("Interval %d ns (%f ns obtained using nFs and oversample)\n", interval,1.0e9f/fs);
outputvaluesA = (short *) malloc(nsample*sizeof(short));
outputvaluesB = (short *) malloc(nsample*sizeof(short));
status = ps4000SetDataBuffer(handle, PS4000_CHANNEL_A, outputvaluesA, nsample);
status = ps4000SetDataBuffer(handle, PS4000_CHANNEL_B, outputvaluesB, nsample);
status = ps4000RunBlock( handle, 0, nsample, nFs, oversample, NULL, 0, readycallback, NULL);
while (ready == 0) //ready is set to 1 when readycallabck is called
status = ps4000GetValues(handle, 0, &nsample, 1, RATIO_MODE_NONE, 0, &overflow);