How to get the duration of each pulse captured for PPM analyzer

I am trying to read a PPM signal and format it for visual analysis in the terminal window.
The problem I have is that I am struggling to find L2 documentation on available functions and entities, specifically I want to be able to trigger a function based on the duration of a pulse to determine the start of a frame.
Can anyone point me in the right direction please?

@ox141jf Thanks for writing in! If I understand correctly, you are looking for a way to trigger on a specific pulse width, is that correct? If so, you can find more information on edge/pulse triggering in the support article below. I hope that helps!

I am looking for a python function that returns pulse widths within a frame to use in creating a custom analyzer

@ox141jf I can help guide you towards the right direction. I’d still like to gather more information about what you are trying to do.

First, what kind of custom analyzer are you creating? Are you trying to create a low level analyzer using our protocol analyzer SDK below? (this is via C++)

Or are you planning to create a high level analyzer extension that sits on top of an existing low level analyzer? (this is via Python)

You also mentioned below, which is possible using our existing Trigger functionality without the need of an analyzer.

I want to be able to trigger a function based on the duration of a pulse to determine the start of a frame.

If you can let me know some more about the information requested above, as well as more information about your end goal, I can help point you towards the right direction!

I want to build a high level analyzer.
I want to be able to make logical operations happen in the HLA based on the lengths of individual pulses high/low in a frame.

For every frame produced by a low level analyzer and provided to a high level analyzer, you can access the frame start time and end time.

From these, you could do the following:

  • compute the length of the frame
  • determine the time from the start (or end) of the previous frame, and the start (or end) of the current frame, by storing the last frame as a member variable of your class.

The documentation for the Python frame class can be found here:

Note that there are two data members, start_time and end_time, of type saleae.data.GraphTime.

Documentation for the GraphTime class is above there in the same file:

The GraphTime object isn’t just a double because it needs to contain more resolution than a double allows, because they are relative to the unix epoch, but also need to hold nanosecond resolution.

To convert the distance between two GraphTime objects to a number of seconds, this should work: float(end_time - start_time)

Here is a quick example of how you might use it.

The HLA pictured computes the length of each frame, and also the time since the end of the previous frame and the start of the new frame.