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 » Tue Nov 20, 2018 5:32 pm

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
Site Admin
Site Admin
Posts: 2845
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: How to poll ps4000aIsReady (4824)

Post by Hitesh » Wed Nov 21, 2018 9:40 am

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,
Hitesh

Technical Support Engineer

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

Re: How to poll ps4000aIsReady (4824)

Post by jonasenderlin » Wed Nov 21, 2018 5:38 pm

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
Site Admin
Site Admin
Posts: 2845
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: How to poll ps4000aIsReady (4824)

Post by Hitesh » Thu Nov 22, 2018 9:43 am

Hi Jonas,

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

Regards,
Hitesh

Technical Support Engineer

Post Reply