Difference between revisions of "Oscilloscopes"

From sigrok
Jump to navigation Jump to search
 
Line 40: Line 40:
It is only used to set this value; getting it will just return the previously set value. Defaults to 0, meaning continuously grab frames until told to stop.
It is only used to set this value; getting it will just return the previously set value. Defaults to 0, meaning continuously grab frames until told to stop.


{{config_key|1=Previously set value|2=Number of frames to capture (default 0 = unlimited)|3=NA}}
{{config_key|type=uint64|get=Previously set value.|set=Number of frames to capture (default 0 = unlimited.)}}


=== SR_CONF_NUM_TIMEBASE ===
=== SR_CONF_NUM_TIMEBASE ===
The number of divisions an oscilloscope has across its horizontal (time) axis. This corresponds to the areas marked off by the vertical lines on the graticule of the device's display. Even on headless oscilloscopes, this concept still exists; for example the SR_CONF_TIMEBASE setting is meaningless without this number.
The number of divisions an oscilloscope has across its horizontal (time) axis. This corresponds to the areas marked off by the vertical lines on the graticule of the device's display. Even on headless oscilloscopes, this concept still exists; for example the SR_CONF_TIMEBASE setting is meaningless without this number.


{{config_key|1=Static number, fixed per model|2=NA|3=NA}}
{{config_key|type=int32|get=Static number, fixed per model.}}


=== SR_CONF_TIMEBASE ===
=== SR_CONF_TIMEBASE ===
The duration of sampling a single horizontal (time) division during acquisition. The number of divisions is returned by SR_CONF_NUM_TIMEBASE, so multiplying that number by this duration gives a measure of the effective samplerate of a single frame.


{{config_key|type=A tuple of (uint64, uint64) representing the timebase as <i>(p, q)</i> of a rational number.|get=Previously set value, or reasonable default for that device.|set=The new timebase.|list=A list of supported timebases for this model, in the form of an array of the normal <i>(p, q)</i> type.}}





Latest revision as of 15:09, 20 January 2014

This page documents the config keys are various other info needed to write a libsigrok frontend for controlling oscilloscopes.

Frame-based

Generally oscilloscopes work by triggering on either the signal under measurement, or some external trigger. The device then measures as much as its internal buffer can hold. When the buffer is full, the device stops measurement and sends its buffer over to the libsigrok driver. This transfer represents a frame's worth of data. The driver converts this data to the libsigrok internal analog format and sends it out to the frontend like this:

Packet type Payload
SR_DF_FRAME_BEGIN
SR_DF_ANALOG analog data
SR_DF_ANALOG...
SR_DF_FRAME_END

The oscilloscope then restarts acquisition, sometimes after prodding by the driver. The data received from an oscilloscope is thus not contiguous from one frame to the next: in between there is a period where no measurements are done by the device.

Streaming

Some devices can act as continuously streaming oscilloscopes, with no framing involved. Notably FX2-based devices with an analog frontend, such as the Nexus-Computing OsciPrime, work this way.


Config keys

A libsigrok driver for an oscilloscope implements all or some subset of the following config keys.

SR_CONF_OSCILLOSCOPE

Denotes a device that can act as an oscilloscope, i.e. measure voltage over time on one or more analog channels, and send those measurements out to the frontend as analog values.

SR_CONF_LIMIT_FRAMES

Frame-based oscilloscopes implement this key set to the number of frames to capture and send out, between SR_DF_FRAME_BEGIN and SR_DF_FRAME_END packets.

It is only used to set this value; getting it will just return the previously set value. Defaults to 0, meaning continuously grab frames until told to stop.

Type uint64
Get Previously set value.
Set Number of frames to capture (default 0 = unlimited.)
List NA

SR_CONF_NUM_TIMEBASE

The number of divisions an oscilloscope has across its horizontal (time) axis. This corresponds to the areas marked off by the vertical lines on the graticule of the device's display. Even on headless oscilloscopes, this concept still exists; for example the SR_CONF_TIMEBASE setting is meaningless without this number.

Type int32
Get Static number, fixed per model.
Set NA
List NA

SR_CONF_TIMEBASE

The duration of sampling a single horizontal (time) division during acquisition. The number of divisions is returned by SR_CONF_NUM_TIMEBASE, so multiplying that number by this duration gives a measure of the effective samplerate of a single frame.

Type A tuple of (uint64, uint64) representing the timebase as (p, q) of a rational number.
Get Previously set value, or reasonable default for that device.
Set The new timebase.
List A list of supported timebases for this model, in the form of an array of the normal (p, q) type.