Running ps6000GetValuesTriggerTimeOffsetBulk64

Post your MATLAB discussions here
Post Reply
gerardtouma
User
User
Posts: 4
Joined: Sun Dec 02, 2018 1:32 am

Running ps6000GetValuesTriggerTimeOffsetBulk64

Post by gerardtouma » Wed Dec 12, 2018 4:06 am

Hi,

I am trying to run the function ps6000GetValuesTriggerTimeOffsetBulk64 on Maltab 2017b. I am using windows 7.

My code is the following:
FromSegmentIndex = 1;
ToSegmentIndex = 100;
times = zeros(ToSegmentIndex-FromSegmentIndex+1,1);
timeUnits = ps6000Enuminfo.enPS6000TimeUnits.PS6000_FS;
[status, timeUnits] = calllib ('ps6000', 'ps6000GetValuesTriggerTimeOffsetBulk64', ps6000DeviceObj.unithandle, times, timeUnits, FromSegmentIndex, ToSegmentIndex);

However, Matlab is crashing everytime i run this (when executing the ps6000GetValuesTriggerTimeOffsetBulk64 function). It executes when the size of times is only 2 (2 waveforms), andthe times array contains only two zeros (I expect a non-zero offset in fento-seconds).

I am attaching the crash log as a text file.
Please let me know how to fix this, as it is very important for me to get it running.

Thanks,
Gerard
Attachments
crash_log.rtf
(12.95 KiB) Downloaded 42 times

cappandy
Newbie
Posts: 0
Joined: Thu Dec 13, 2018 3:45 pm

Re: Running ps6000GetValuesTriggerTimeOffsetBulk64

Post by cappandy » Thu Dec 13, 2018 4:17 pm

Hi gerardtouma,

I have got the same issue.
However, it does not crush if I define timesUnits as an array of the similar size to the acquired number of segments, though it still gives all zeros.

gerardtouma
User
User
Posts: 4
Joined: Sun Dec 02, 2018 1:32 am

Re: Running ps6000GetValuesTriggerTimeOffsetBulk64

Post by gerardtouma » Thu Dec 13, 2018 10:06 pm

Just a kind reminder to answer this question.

Thanks.

Martyn
Site Admin
Site Admin
Posts: 3505
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Running ps6000GetValuesTriggerTimeOffsetBulk64

Post by Martyn » Fri Dec 14, 2018 7:35 am

times, an array of integers.
On exit, this will hold the time offset for each requested segment index. times[0] will hold the time offset for fromSegmentIndex, and the last times index will hold the time offset for toSegmentIndex. The array must be long enough to hold the number of times requested.

Depending upon your trigger set up and the signal you are measuring the values returned will often be 0, meaning that the trigger event actually occured at the sample point.
Martyn
Technical Support Manager

gerardtouma
User
User
Posts: 4
Joined: Sun Dec 02, 2018 1:32 am

Re: Running ps6000GetValuesTriggerTimeOffsetBulk64

Post by gerardtouma » Fri Dec 14, 2018 7:01 pm

Hi cappandy and Martyn,

Thank you both for the reply. I really need to make this function work, since my application relies mostly on the 'relative' timing of signals (I am post processing, doing averaging and delay & sum).

1) Cappandy: Regarding the size of timesUnits, the documentation says it is a single uint32 value, instead of an array. I will try defining it as an array as well (as large as the acquired number of acquired segments).
2) Martyn: I am actually aware of this, but the issue is that with proper function calling, Matlab is still crashing every time I run the function.

Update on the issue:
I also ran this variation for the code (pointers notation):
FromSegmentIndex = 1;
ToSegmentIndex = 50;
timesPtr = libpointer('int64Ptr', zeros(ToSegmentIndex-FromSegmentIndex+1, 1, 'int64'));
timeUnitsPtr = libpointer('uint32Ptr', zeros(1, 1, 'uint32'));
[status.trigtimeoff] = calllib ('ps6000', 'ps6000GetValuesTriggerTimeOffsetBulk64', ps6000DeviceObj.unithandle, timesPtr, timeUnitsPtr, FromSegmentIndex, ToSegmentIndex);

And this did not work yet.
Somehow, it does not crash if ToSegmentIndex = 2 (times is of size 2), but the values are still 0.

Thanks.

gerardtouma
User
User
Posts: 4
Joined: Sun Dec 02, 2018 1:32 am

Re: Running ps6000GetValuesTriggerTimeOffsetBulk64

Post by gerardtouma » Tue Dec 18, 2018 2:42 pm

Hi cappandy,

Thank you for your advice, it helps. The documentation for PS6000 shows timesUnits as a single value, however as you said using it as an array solves the problem (documentation should be modified).

Regarding the 0 values, I was getting all 0 values when triggering on the AUX channel. However, when triggering on chA (or B, C, D), the data is non zero and makes sense (shows the drift in the clocks).

Unfortunately, this means that we will lose a data channel out of the 4 to be able to compensate for the trigger offset which is not ideal.

It would be great if anyone from the PicoTechnology engineering team can clarify this for us? At least to me, this is a very important feature to have in any oscilloscope and I was hoping not having to sacrifice a data channel to compensate clock drifts.

Looking forward to hear back.
Thanks.

NeilH
PICO STAFF
PICO STAFF
Posts: 61
Joined: Tue Jul 18, 2017 8:28 am

Re: Running ps6000GetValuesTriggerTimeOffsetBulk64

Post by NeilH » Wed Dec 19, 2018 8:36 am

Hi

Below is a code snippet showing how to call the ps6000GetValuesTriggerTimeOffsetBulk64 function within MATLAB in reference to our PS6000 Rapid Block Example;

Code: Select all

FromSegmentIndex = 1;
ToSegmentIndex = numCaptures;
timesPtr = libpointer('int64Ptr', zeros(ToSegmentIndex-FromSegmentIndex+1, 1, 'int64'));
timeUnitsPtr = libpointer('uint32Ptr', zeros(ToSegmentIndex-FromSegmentIndex+1, 1, 'uint32'));
[status.trigtimeoffset] = calllib ('ps6000', 'ps6000GetValuesTriggerTimeOffsetBulk64', ps6000DeviceObj.unithandle, timesPtr, timeUnitsPtr, FromSegmentIndex, ToSegmentIndex);
This function will only give values back if you use one of the standard channels as it requires that the data is captured to fit to where exactly the trigger threshold occurred in relation to the trigger point and as the EXT channel uses a comparator circuit rather than an ADC it doesn't capture any data itself so this API function doesn't return any meaningful values.

I know I am working through this on a support ticket gerardtouma but i thought I would also put this information here as well.
Neil
Technical Support Engineer

Post Reply