How to poll ps4000aIsReady (4824)

Post your MATLAB discussions here
Post Reply
jonasenderlin
Newbie
Posts: 0
Joined: Fri Oct 05, 2018 9:12 am

How to poll ps4000aIsReady (4824)

Post by jonasenderlin »

Hello,

I'm want to use the picoscope 4824 for data aqustion in my project.
For this I need to execute some code while waiting for trigger.

In line of 195 of your PS4000A_ID_BLOCK_EXAMPLE.m you have the following comment:

Code: Select all

% This example uses the _runBlock_ function in order to collect a block of
% data - if other code needs to be executed while waiting for the device to
% indicate that it is ready, use the _ps4000aRunBlock_ function and poll
% the _ps4000aIsReady_ function.

% Capture a block of data:
%
% segment index: 0 (The buffer memory is not segmented in this example)

[status.runBlock] = invoke(blockGroupObj, 'runBlock', 0);
Unfortunately I don't know how to execute the function in matlab to poll it.
In your guideline for programmer the function is described very well, but unfortunately the implementation in Matlab is not explained.

I tried the following line without success:

Code: Select all

[status.runBlock] = get(ps4000aDeviceObj, 'ps4000aIsReady', 0);
Can you please help me and tell my how to call the function in matlab right?

Thanks in advance and best regards,
Jonas

Hitesh

Re: How to poll ps4000aIsReady (4824)

Post by Hitesh »

Hi Jonas,

If you are using the runBlock() function this starts the acquisition and then polls the underlying driver until it indicates that data is available.

If you need to execute code between starting the data acquisition and the device completing data collection you need to do something like:

Code: Select all

isReady = 0;

[status.ps4000aRunBlock] = invoke(blockGroupObj, 'ps4000aRunBlock', 0);

% Execute some code

% Poll the Instrument Driver until the device is ready

while isReady == 0

  [status, isReady] = invoke(blockGroupObj, 'ps4000aIsReady', 0);
  pause(0.005);

end
Hope this helps,

jonasenderlin
Newbie
Posts: 0
Joined: Fri Oct 05, 2018 9:12 am

Re: How to poll ps4000aIsReady (4824)

Post by jonasenderlin »

Hi,

thank you very much for you support.
It works fine when i don't use the status varable which is provided by the function.
The status which is provided by the isRead function is always 0, so I replaced it.

Best regards,
Jonas

Hitesh

Re: How to poll ps4000aIsReady (4824)

Post by Hitesh »

Hi Jonas,

Good to hear that it is working. The status code of 0 is expected.

Regards,

NewbeeFOB
Newbie
Posts: 0
Joined: Sun Sep 06, 2020 3:17 am

Re: How to poll ps4000aIsReady (4824)

Post by NewbeeFOB »

when I use your code snippet, I get an error message when in the while polling loop :

Error using icgroup/invoke (line 40)
OBJ is an invalid object.

Error in GetData (line 227)
isReady = invoke(blockGroupObj, 'ps4000aIsReady', 0);

Post Reply