ps4000SetDataBufferBulk is used as many times as there are data captures. ps4000GetValuesBulk is used once, and the data is passed using LabVIEW reference to the Channel A Buffer indicator. This VI is used inside the SDK's PS4000 Rapid Block Example.
The VI runs without crashing, however there is a problem in the content of the produced data: It seems that each data capture is shifted by one sample.
Capture 0 is fine,
Capture 1 is shifted by 1 point, its first data point being the last data point of capture 0 , or a wrap of the last point in the same data set.
...
Capture i is shifted by i point, its first data point being the last data point of capture i-1, or a wrap of the last point in the same data set:
So for a 800 pts long square wave, with 400 points as pre-trigger, 400 pts as post triggers it would look like this:
capture 0:
capture 20: 20 samples lag
capture 255: 255 samples lag
Of note too, the Overflow array at the output of the GetValueBulk shows an array containing 1s ( 1,1,1,1...).
I then tried the same code but with the ps3000.dll with a pico 3206a and it works as expected, that is all the bulk captures come out with no lag (which I suspect is an overflow) . The overflow array still shows ( 1,1,1,1...) with the ps3000.dll .
Finally, the ps3000 rapid block example does not use the "SetDataBufferBulk" call , but rather the "SetDataBuffer" call, while the ps4000.dll use the "SetDataBufferBulk"... which is somewhat confusing. The ps3000aSetDataBuffer has a
"waveform" input which would suggest it is in fact doing a bulk setting of the buffer.... Confused yet?
Any idea of what is going wrong? It looks like either the ps4000SetDataBufferBulk or the ps4000GetValuesBulk creates/reads out the data with a lag or a wrap of 1 sample for each requested data capture ...
Thx for checking this out.
L.
PS:
The standard example for Rapid Block produces the expected data with the expected signal for all data captures, all identical to Capture 0 plot above, and this is what is expected. However, not taking advantage of the ps4000GetValuesBulk, it takes 1.5 sec to obtain the data instead of ~ 30 ms. This is why I want to use the ps4000GetValuesBulk instead of calling the GetValues multiple times.
Ok, I applied a temp. fix that may be helpful. It builds on the previous example using LV DataReference and correct the "Wrap" by re-shifting each capture by one sample. As a result if one wants to acquire 100 samples, 10times (ncapture = 10), one should set the buffer to 100+10 samples. Then shift each capture i by i samples.
The VI is attached, and a screen shot shows how to use it.