All the elements in buffer are always ZERO using Labview.

Post your LabVIEW discussions here
Post Reply
DRShawn
Newbie
Posts: 0
Joined: Thu Sep 15, 2022 1:22 pm

All the elements in buffer are always ZERO using Labview.

Post by DRShawn »

Hi,

During my usage of 5242D, I program the code using Labview. It seems all work well but when I call the function ps5000aGetValues, the elements in buffer array are always all zeros, I mean all the elements in buffer array is "0". I could make sure all there is no error code appeared on PICO_STATUS. I use block mode (not rapid block mode).
Could you please give any comments for this issue?

Many thanks!
Attachments
Pico_tech.vi
(55.38 KiB) Downloaded 172 times

AndrewA
PICO STAFF
PICO STAFF
Posts: 401
Joined: Tue Oct 21, 2014 3:07 pm

Re: All the elements in buffer are always ZERO using Labview.

Post by AndrewA »

Hi,

The issue here is due to passing a LabVIEW array into the our dll functions ps5000aSetDataBuffers() and then expecting the array to update with data from the scope, after calling another function. Is against LabVIEW coding convenient.
Also it easy to make this mistake in other programming languages, passing managed memory buffers instead of unmanaged buffers.
Unfortunately I think most of our examples break this rule but still work by chance.
We have redone the ps5000a streaming example to address this issue.
But you can use the new memory buffer vi created for this for your code. I have attached a modified version of your code, and seem run correctly.
It uses our new buffer vi's at https://github.com/picotech/picosdk-ni-labview-shared
The data types for buffers input to ps5000aSetDataBuffers are changed as pictured-
datatypesforSetDataBuffers.png
We are plan to update all the streaming example possibly some of the block/rapid block examples to use these new functions.

I assume you have looked at our ps5000a examples on github-
https://github.com/picotech/picosdk-ni- ... er/ps5000a
Attachments
Pico_tech_NewBuffers.vi
(61.19 KiB) Downloaded 180 times
Regards Andrew
Technical Specialist

Post Reply