I'm trying to make an use the Picoscope 4424 through the SDK, to provide the same functionality as the Picoscope 3000 series SDK provided. For my purposes, I only need to use Block mode. I am able to do everything, including setting the trigger and receiving the data from the Picoscope, however I haven't found the equivalent ability as the picoscope 3000's delay option in ps3000_set_trigger(). I see that there is a ps4000SetTriggerDelay, that accepts a ulong for a delay, however this is not seeming to be the same thing as what the 3000 provided. Unfortunately the only example that mentions a delay in percentages is in PS4000con.c:965. This however doesn't seem to actually tell how to do it, nor does it confirm how it is done. I also notice the use of a function called ps4000SetEts, which is nowhere in the programming manual. Is there a more extensive manual available for these 16 undocumented functions, or are these experimental? If someone could help me, I would be very greatful.
ps4000SetTriggerChannelConditions, ps4000SetTriggerChannelProperties, and ps4000SetTriggerChannelDirections specify the rules by which a trigger will occur. These do not specify how to set a delay as to how much data occurs before the trigger vs. the amount of data that is displayed after the trigger. For example from the PicoScope 3000 series:
ps3000_set_trigger (
short handle,
short source,
short threshold,
short direction,
short delay,
short auto_trigger_ms )
Where the delay is a number from -100% to +100%.
The document that I have been referencing is ps4000pg.en.pdf with a date of 8/18/2009 1:04PM. This document does not cover the following methods referenced from the sample code:
In addition to wanting to set the delay, I was also wondering if there is a way to set a int buffer for the times as used in the PS3000 function getTimesAndValues. I suppose that I could generate this myself, if I had to, but it was nice having the scope tell me when the trigger occurred (the time of value 0), esp. since it varied by a little bit.
I believe some of the functions in the example program might be leftovers from a version for the ps3000,ps5000 range. For example the ps4000 does not have a signal generator so those functions are not available for the ps4000.
The trigger point within a capture is set by the noOfPreTriggerSamples and noOfPostTriggerSamples arguments to the function ps4000RunBlock.
The trigger delay is set separatly with the ps4000SetTriggerDelay function. The trigger delay is the time from the real trigger event to the point within the capture.
Insted of using getTimesAndValues, I think you need to use ps4000GetTriggerTimeOffset.
That solved that problem, however I think that I have found a bug in the driver. It had been causing me grief for the last few days.
In the past on the 3000 series scopes, I never used the "getTimebase" function, because I calculated all other information on my own. Which this is fine, because that is only supposed to be the way to determine what timebase to use. You are supposed to specify the timebase in the "runblock" method. Given that you did everything correctly, it should work as normal.
In the 4000 series, you MUST use the "getTimebase" method, because otherwise (maybe always) it completely ignores the argument "timebase" in the runblock command. The second bug, is if you use the getTimebase function, make sure that you set the oversample to 1. If you set it to 0, the function will return a 0 or PICO_OK, but the data that is returned is non-sense.
Thank you for your post, I have examined the PS4000 driver and can confirm that the oversample bug does exist. This has now been fixed and will be available in the next sdk release, unfortunately I have not got a time scale for this release.
However, I can not reproduce the bug you reported when not calling GetTimebase and calling RunBlock the timebase variable being ignored. There is no correlation between these two functions. The GetTimebase will check the settings that you have passed and validate the timebase and other settings you wish to use. When calling the RunBlock the parameter values that you call this function with will be validated again and the PS4000 set to sample at this rate. If you are having further problems with the timebase and RunBlock please provide further information, eg, number of channels set, timebase, no of samples, oversample etc.
could you please let me know how Ican use "ps4000GetTriggerTimeOffset64" in rapid block mode using PS4000?
I tried this function however, it gave me some starnge numbers.
how should I specify timeUnits in this function?
I really appreciate if you provide me with a code to capture trigger time for in rapid block mode with lets say 120 waveforms.