Digital input instrument

The DigitalIn instrument provides multiple channels of digital input on devices that support it, such as the Analog Discovery, Analog Discovery 2, and Digital Discovery. It provides the functionality normally associated with a stand-alone logic analyzer.

Todo

This section is missing some important information:

  • A discussion about the different acquisition modes;

  • A description of how the status variables behave in the different acquisition modes;

  • A discussion of the precise meaning of all settings.

Using the digital input instrument

To use the DigitalIn instrument you first need to initialize a DwfLibrary instance. Next, you open a specific device. The device’s DigitalIn instrument can now be accessed via its digitalIn attribute, which is an instance of the DigitalIn class.

For example:

from pydwf import DwfLibrary
from pydwf.utilities import openDwfDevice

dwf = DwfLibrary()

with openDwfDevice(dwf) as device:

    # Get a reference to the device's DigitalIn instrument.
    digitalIn = device.digitalIn

    # Use the DigitalOut instrument.
    digitalIn.reset()

The DigitalIn instrument state machine

The DigitalIn instrument is controlled by a state machine. As a measurement is prepared and executed, the instrument goes through its various states.

The current state of the instrument is returned by the digitalIn.status() method, and is of type DwfState.

The figure below shows the states used by the DigitalIn instrument and the transitions between them:

digraph { rankdir=LR; // nodes node [color="#243f60"; fillcolor="#4581bd"; style="filled"]; st_ready [label="Ready"]; st_configure [label="Configure"]; st_prefill [label="Prefill"]; st_armed [label="Armed"]; st_running [label="Running"]; st_done [label="Done"]; // edges edge [color="#4579b8"]; st_ready -> st_configure [label="Reconfigure?", style="dashed"]; st_configure -> st_ready [style="dashed"]; st_ready -> st_prefill [label="Start?"]; st_configure -> st_prefill[label="Start?", style="dashed"]; st_prefill -> st_armed; st_armed -> st_running[label="Trigger?"]; st_running -> st_done; }

States of the DigitalIn instrument

The DigitalIn states are used as follows:

  1. Ready

    In this preparatory state, instrument settings can be changed that specify the behavior of the instrument in the coming measurement. If the auto-configure setting of the device is enabled (the default), setting changes will automatically be transferred to the device. If not, an explicit call to the digitalIn.configure() method with the reconfigure parameter set to True is needed to transfer updated settings to the device.

    Once the instrument is properly configured, an acquisition can be started by calling the digitalIn.configure() with the start parameter set to True. This will start the first stage of the acquisition by entering the Prefill state.

  2. Configure

    This state is entered momentarily when a setting is being pushed to the device, either by changing the setting while auto-configure is enabled, or by an explicit call to digitalIn.configure() with the reconfigure parameter set to True. The settings inside the device will be updated, and the device will immediately thereafter go back to the Ready state, unless the start parameter to digitalIn.configure() was set to True.

  3. Prefill

    This state marks the beginning of an acquisition sequence. During the Prefill state, input samples will be acquired until enough samples are buffered for the instrument to be ready to react to a trigger.

    This state is only relevant if the trigger position has been configured in such a way that the measurement must also yield sample values prior to the moment of triggering.

    Once enough samples are received for the instrument to be able to react to a trigger, it proceeds to the Armed state.

  4. Armed

    In this state the instrument continuously captures samples and monitors the configured trigger input. As soon as a trigger event is detected, the instrument proceeds to the Running state.

  5. Running

    In this state the instrument continues capturing samples until the acquisition is complete. Completion is reached when the acquisition buffer has filled up in Single mode, or when the recording length has been reached in Record mode. When completion is reached, the instrument proceeds to the Done state.

  6. Done

    This state indicates that a measurement has finished.

    From this state, it is possible to go back to the Ready state by performing any kind of configuration, or to start a new acquisition with the same settings..

DigitalIn instrument API overview

The DigitalIn instrument is quite complicated; 62 methods are provided to control its behavior. Below, we categorize all methods and shortly introduce them. Detailed information on all methods can be found in the DigitalIn class reference that follows.

Instrument control

Like all instruments supported by the Digilent Waveforms library, the DigitalIn instrument provides reset(), configure(), and status() methods.

The reset() method resets the instrument.

The configure() method is used to explicitly transfer settings to the instrument, and/or to start a configured operation.

The status() method retrieves status information from the instrument. Optionally, it can also retrieve bulk data, i.e. digital input samples. The method returns the current DwfState of the DigitalIn instrument; to obtain more elaborate status information, one of the methods in the next two sections must be used.

Instrument control (3 methods)

control operation

type/unit

methods

reset instrument

n/a

reset()

configure instrument

n/a

configure()

request instrument status

DwfState

status()

Status variables

When executing the status() method, status information is transferred from the DigitalIn instrument to the PC. Several status variables can then be retrieved by using the methods listed below.

Status variables (7 methods)

status value

type/unit

method

timestamp

tuple [s]

statusTime()

auto-triggered flag

bool

statusAutoTriggered()

samples left in acquisition

int [samples]

statusSamplesLeft()

samples valid count

int [samples]

statusSamplesValid()

buffer write index

int [samples]

statusIndexWrite()

recording status

tuple [samples]

statusRecord()

compressed status

tuple [samples]

statusCompress()

Status data retrieval

Executing the status() method with the read_data parameter set to True transfers captured samples from the instrument to the PC. The samples can then be retrieved using the methods listed here.

Bulk status data retrieval (5 methods)

status data

type/unit

methods

get sample data (without buffer offset)

[bytes]

statusData()

get sample data (with buffer offset)

[bytes]

statusData2()

get compressed sample data (without buffer offset)

[bytes]

statusCompressed()

get compressed sample data (with buffer offset)

[bytes]

statusCompressed2()

get sample noise (with offset)

[bytes]

statusNoise2()

Acquisition timing settings

The acquisition settings control the timing of the digital data acquisition process.

Acquisition timing settings (7 methods)

setting

type/unit

methods

internal clock

float [Hz]

internalClockInfo()

clock source

DwfDigitalInClockSource

clockSourceInfo() , –Set() , –Get()

divider

int [-]

dividerInfo() , –Set() , –Get()

Acquisition settings

The acquisition settings control various aspects of the digital data acquisition process.

Acquisition settings (17 methods)

setting

type/unit

methods

acquisition mode

DwfAcquisitionMode

acquisitionModeInfo() , –Set() , –Get()

bits

int [-]

bitsInfo()

sample format

int [bits]

sampleFormatSet() , –Get()

input order

bool

inputOrderSet()

buffer size

int [samples]

bufferSizeInfo() , –Set() , –Get()

sample mode

DwfDigitalInSampleMode

sampleModeInfo() , –Set() , –Get()

sample sensible

int

sampleSensibleSet() , –Get()

trigger prefill

int [samples]

triggerPrefillSet() , –Get()

Instrument trigger configuration

The following methods are used to configure the trigger of the DigitalIn instrument. The trigger source is fully configurable; the DigitalIn instrument can use its own trigger detector for triggering, but it is also possible to use a different trigger source. For that reason, we distinguish between the methods that configure the instrument trigger in this section, and the methods that configure the DigitalIn trigger detector that are discussed below.

Instrument trigger configuration (11 methods)

setting

type/unit

methods

trigger source

DwfTriggerSource

triggerSourceInfo() , –Set() , –Get()

trigger slope

DwfTriggerSlope

triggerSlopeSet() , –Get()

trigger position

float [s]

triggerPositionInfo() , –Set() , –Get()

trigger auto-timeout

float [s]

triggerAutoTimeoutInfo() , –Set() , –Get()

Note

The triggerSourceInfo() method is obsolete. Use the generic DwfDevice.triggerInfo() method instead.

Trigger detector configuration

The DigitalIn trigger detector is highly configurable. Unfortunately, its documentation is sparse, so some experimentation is needed to figure out how it works.

Todo

Figure out and explain how the DigitalIn trigger detector works.

Trigger detector configuration (7 methods)

setting

type/unit

methods

trigger

bit masks

triggerInfo() , –Set() , –Get()

trigger reset

to be documented

triggerResetSet()

trigger count

to be documented

triggerCountSet()

trigger length

to be documented

triggerLengthSet()

trigger match

to be documented

triggerMatchSet()

Counter functionality

Counter configuration (4 methods)

setting

type/unit

methods

counter configuration counter status

float [s], int [-] float [s], float [Hz], int [-]

counterInfo() , –Set() , –Get() counterStatus()

Miscellaneous settings

The mixed setting is obsolete, undocumented, and not understood.

Todo

Figure out what the mixed setting does.

Miscellaneous settings (1 method)

operation

type/unit

method

mixed

bool

mixedSet()

DigitalIn reference

class DigitalIn

The DigitalIn class provides access to the digital input (logic analyzer) instrument of a DwfDevice.

Attention

Users of pydwf should not create instances of this class directly.

It is instantiated during initialization of a DwfDevice and subsequently assigned to its public digitalIn attribute for access by the user.

reset() None

Reset the DigitalIn instrument parameters to default values.

If autoconfiguration is enabled, the reset values will be used immediately.

Raises:

DwfLibraryError – An error occurred while executing the reset operation.

configure(reconfigure: bool, start: bool) None

Configure the instrument and start or stop the acquisition operation.

Parameters:
  • reconfigure (bool) – If True, the instrument settings are sent to the instrument.

  • start (bool) – If True, an acquisition is started. If False, an ongoing acquisition is stopped.

Raises:

DwfLibraryError – An error occurred while executing the configure operation.

status(read_data_flag: bool) DwfState

Get the DigitalIn instrument state.

This method performs a status request to the DigitalIn instrument and receives its response.

The following methods can be used to retrieve DigitalIn instrument status information as a result of this call, regardless of the value of the read_data_flag parameter:

The following methods can be used to retrieve bulk data obtained from the DigitalIn instrument as a result of this call, but only if the read_data_flag parameter is True:

Parameters:

read_data_flag (bool) – Whether to read data.

Returns:

The current state of the instrument.

Return type:

DwfState

Raises:

DwfLibraryError – An error occurred while executing the status operation.

statusTime() Tuple[int, int, int]

Get the timestamp of the current status information.

Returns:

A three-element tuple, indicating the POSIX timestamp of the status request. The first element is the POSIX second, the second and third element are the numerator and denominator, respectively, of the fractional part of the second.

In case status() hasn’t been called yet, this method will return zeroes for all three tuple elements.

Return type:

Tuple[int, int, int]

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusAutoTriggered() bool

Check if the current acquisition is auto-triggered.

Returns:

True if the current acquisition is auto-triggered, False otherwise.

Return type:

bool

Raises:

DwfLibraryError – An error occurred while retrieving the auto-triggered status.

statusSamplesLeft() int

Retrieve the number of samples left in the acquisition, in samples.

Returns:

In case a finite-duration acquisition is active, the number of samples remaining to be acquired in the acquisition.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusSamplesValid() int

Retrieve the number of valid data samples.

Returns:

The number of valid samples in the buffer.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusIndexWrite() int

Retrieve the buffer write index.

This is needed in ScanScreen acquisition mode to display the scan bar.

Returns:

The buffer write index.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusRecord() Tuple[int, int, int]

Get the recording status.

Returns:

A three-element tuple containing the counts for available, lost, and corrupt data samples, in that order.

Return type:

Tuple[int, int, int]

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusCompress() Tuple[int, int, int]

Get the recording status (compress version).

Returns:

A three-element tuple containing the counts for available, lost, and corrupt data samples, in that order.

Return type:

Tuple[int, int, int]

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusData(count: int, sample_format: int | None = None) ndarray

Retrieve the acquired data samples from the DigitalIn instrument.

Parameters:
  • count (int) – Sample count.

  • sample_format (int) – If not specified, the current value is queried using sampleFormatGet().

Returns:

a 1D numpy array of 8, 16, or 32-bit unsigned words.

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusData2(offset: int, count: int, sample_format: int | None = None) ndarray

Retrieve the acquired data samples from the DigitalIn instrument.

Parameters:
  • count (int) – Sample count.

  • sample_format (int) – Either 8, 16 or 32 bits per sample. If not specified, the current value is queried using sampleFormatGet().

Returns:

a 1D numpy array of 8, 16, or 32-bit unsigned words.

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusCompressed(count_bytes: int) ndarray

Retrieve the compressed data samples from the DigitalIn instrument.

Todo

Figure out the data format.

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusCompressed2(first_sample: int, count_bytes: int) ndarray

Retrieve the acquired data samples from the DigitalIn instrument.

Todo

Figure out the data format.

Raises:

DwfLibraryError – An error occurred while executing the operation.

statusNoise2(first_sample: int, count_bytes: int) ndarray

Get the noise data from the DigitalIn instrument.

Todo

Figure out the data format.

Raises:

DwfLibraryError – An error occurred while executing the operation.

internalClockInfo() float

Get the DigitalIn internal clock frequency, in Hz.

Returns:

The internal clock frequency, in Hz.

Raises:

DwfLibraryError – An error occurred while executing the operation.

clockSourceInfo() List[DwfDigitalInClockSource]

Get a list of valid clock sources for the DigitalIn instrument.

Returns:

A list of valid clock sources.

Return type:

List[DwfDigitalInClockSource]

Raises:

DwfLibraryError – An error occurred while executing the operation.

clockSourceSet(clock_source: DwfDigitalInClockSource) None

Set the DigitalIn instrument clock source.

Parameters:

clock_source (DwfDigitalInClockSource) – The clock source to be selected.

Raises:

DwfLibraryError – An error occurred while executing the operation.

clockSourceGet() DwfDigitalInClockSource

Get the DigitalIn instrument clock source.

Returns:

The currently configured DigitalIn clock source.

Return type:

DwfDigitalInClockSource

Raises:

DwfLibraryError – An error occurred while executing the operation.

dividerInfo() int

Get the DigitalIn instrument maximum divider value.

Returns:

The maximum valid divider value that can be configured.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

dividerSet(divider: int) None

Set the DigitalIn instrument divider value.

Parameters:

divider – The divider value to be configured.

Raises:

DwfLibraryError – An error occurred while executing the operation.

dividerGet() int

Get the current DigitalIn instrument divider value.

If the clock source is internal, the DigitalIn sample frequency will be equal to internalClockInfo() divided by dividerGet().

Returns:

The currently configured divider value.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

acquisitionModeInfo() List[DwfAcquisitionMode]

Get a list of valid DigitalIn instrument acquisition modes.

Returns:

A list of valid acquisition modes for the DigitalIn instrument.

Return type:

List[DwfAcquisitionMode]

Raises:

DwfLibraryError – An error occurred while executing the operation.

acquisitionModeSet(acquisition_mode: DwfAcquisitionMode) None

Select the DigitalIn acquisition mode.

Parameters:

acquisition_mode (DwfAcquisitionMode) – The acquisition mode to be selected.

Raises:

DwfLibraryError – An error occurred while executing the operation.

acquisitionModeGet() DwfAcquisitionMode

Get the currently selected DigitalIn acquisition mode.

Returns:

The currently selected acquisition mode.

Return type:

DwfAcquisitionMode

Raises:

DwfLibraryError – An error occurred while executing the operation.

bitsInfo() int

Get the number of DigitalIn bits.

Returns:

The number of digital input bits available.

Raises:

DwfLibraryError – An error occurred while executing the operation.

sampleFormatSet(num_bits: int) None

Set the DigitalIn sample format (i.e., number of bits).

Parameters:

num_bits (int) – The number of bits per sample (8, 16, or 32).

Raises:

DwfLibraryError – An error occurred while executing the operation.

sampleFormatGet() int

Get the DigitalIn sample format (i.e., number of bits).

Returns:

The currently configured number of bits per sample (8, 16, or 32).

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

inputOrderSet(dio_first: bool) None

Select the DigitalIn order of values stored in the sampling array.

If dio_first is True, DIO 24…39 are placed at the beginning of the array followed by DIN 0…23.

If dio_first is False, DIN 0…23 are placed at the beginning followed by DIO 24…31.

This method is valid only for the Digital Discovery device.

Parameters:

dio_first (bool) – Whether the DIO pins come before the DIN pins.

Raises:

DwfLibraryError – An error occurred while executing the operation.

bufferSizeInfo() int

Get the DigitalIn instrument maximum buffer size.

Returns:

The maximum valid buffer size.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

bufferSizeSet(buffer_size: int) None

Set the DigitalIn instrument buffer size.

Parameters:

buffer_size (int) – The buffer size to be configured.

Raises:

DwfLibraryError – An error occurred while executing the operation.

bufferSizeGet() int

Get the currently configured DigitalIn instrument buffer size.

Returns:

The currently configured buffer size.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

sampleModeInfo() List[DwfDigitalInSampleMode]

Get the valid DigitalIn instrument sample modes.

Returns:

A list of valid sample modes.

Return type:

List[DwfDigitalInSampleMode]

Raises:

DwfLibraryError – An error occurred while executing the operation.

sampleModeSet(sample_mode: DwfDigitalInSampleMode) None

Set the DigitalIn instrument sample mode.

Parameters:

sample_mode (DwfDigitalInSampleMode) – The sample mode to be configured.

Raises:

DwfLibraryError – An error occurred while executing the operation.

sampleModeGet() DwfDigitalInSampleMode

Get the DigitalIn instrument sample mode.

Returns:

The currently configured sample mode.

Return type:

DwfDigitalInSampleMode

Raises:

DwfLibraryError – An error occurred while executing the operation.

sampleSensibleSet(compression_bits: int) None

Set the DigitalIn instrument sample sensible setting.

Todo

Figure out what this setting does.

Parameters:

compression_bits (int) – (unknown)

Raises:

DwfLibraryError – An error occurred while executing the operation.

sampleSensibleGet() int

Get the DigitalIn instrument sample sensible setting.

This setting is only used in Record mode.

It select the signals to be used for data compression in record acquisition mode.

Todo

Figure out what this setting does.

Returns:

The sample sensible setting.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerPrefillSet(samples_before_trigger: int) None

Set the DigitalIn instrument trigger prefill setting, in samples.

This setting is only used in Record mode.

It determines the number of samples to acquire before arming in Record acquisition mode. The prefill is used for recording with a trigger to make sure that at least the required number of samples are collected before arming.

Todo

Figure out what this setting does, precisely.

Parameters:

samples_before_trigger (int) – The prefill count, in samples.

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerPrefillGet() int

Get the DigitalIn instrument trigger prefill setting, in samples.

Returns:

The trigger prefill count, in samples.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerSourceInfo() List[DwfTriggerSource]

Get the valid DigitalIn instrument trigger sources.

Warning

This method is obsolete.

Use the generic DeviceControl.triggerInfo() method instead.

Returns:

A list of valid trigger sources.

Return type:

List[DwfTriggerSource]

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerSourceSet(trigger_source: DwfTriggerSource) None

Set DigitalIn instrument trigger source.

Parameters:

trigger_source (DwfTriggerSource) – The trigger source to be configured.

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerSourceGet() DwfTriggerSource

Get the currently selected instrument trigger source.

Returns:

The currently selected instrument trigger source.

Return type:

DwfTriggerSource

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerSlopeSet(trigger_slope: DwfTriggerSlope) None

Select the DigitalIn instrument trigger slope.

Parameters:

trigger_slope (DwfTriggerSlope) – The trigger slope to be selected.

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerSlopeGet() DwfTriggerSlope

Get the currently selected DigitalIn instrument trigger slope.

Returns:

The currently selected DigitalIn instrument trigger slope.

Return type:

DwfTriggerSlope

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerPositionInfo() int

Get DigitalIn trigger position info.

Returns:

The maximum number of samples after the trigger.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerPositionSet(samples_after_trigger: int) None

Set DigitalIn instrument desired trigger position.

Parameters:

samples_after_trigger (int) – The number of samples after the trigger.

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerPositionGet() int

Get DigitalIn instrument trigger position.

Returns:

The currently configured number of samples after the trigger.

Return type:

int

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerAutoTimeoutInfo() Tuple[float, float, int]

Get DigitalIn instrument trigger auto-timeout range, in seconds.

Returns:

The range and number of steps of the auto-timeout setting.

Return type:

Tuple[float, float, int]

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerAutoTimeoutSet(auto_timeout: float) None

Set DigitalIn instrument trigger auto-timeout value, in seconds.

Parameters:

auto_timeout (float) – The auto-timeout value to be configured, in seconds.

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerAutoTimeoutGet() float

Get DigitalIn instrument trigger auto-timeout value, in seconds.

Returns:

The currently configured trigger auto-timeout value, in seconds.

Return type:

float

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerInfo() Tuple[int, int, int, int]

Get DigitalIn detector trigger info.

Return the pins that support the different types of triggering. Each integer is a bitmask, representing pins that can be used as low level, high level, rising edge, and falling edge triggers.

Returns:

Digital pins that can be used as low level, high level, rising edge, and falling edge triggers, respectively.

Return type:

Tuple[int, int, int, int]

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerSet(level_low: int, level_high: int, edge_rise: int, edge_fall: int) None

Set DigitalIn trigger detector conditions.

The level_low and level_high settings effectively mask trigger detection events to clock cycles where the selected pins are low or high, respectively.

The edge_rise and edge_fall indicate channels where the specific type of transition on any of the included channels will lead to a trigger event, ar least if the level conditions specified by the level_low and level_high settings are satisfied.

Parameters:
  • level_low (int) – The channels that are required to be low for a trigger event to occur (bitfield).

  • level_high (int) – The channels that are required to be high for a trigger event to occur (bitfield).

  • edge_rise (int) – The channels where a rising edge will cause a trigger event (bitfield).

  • edge_fall (int) – The channels where a falling edge will cause a trigger event (bitfield).

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerGet() Tuple[int, int, int, int]

Get the configured DigitalIn trigger detector settings.

Returns:

The currently configured level_low, level_high, edge_rise, and edge_fall settings.

Return type:

Tuple[int, int, int, int]

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerResetSet(level_low: int, level_high: int, edge_rise: int, edge_fall: int) None

Configure DigitalIn trigger detector reset condition.

Parameters:
  • level_low (int) – The channels that are required to be low for a reset to occur (bitfield).

  • level_high (int) – The channels that are required to be high for a reset to occur (bitfield).

  • edge_rise (int) – The channels where a rising edge will cause a reset (bitfield).

  • edge_fall (int) – The channels where a falling edge will cause a reset (bitfield).

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerCountSet(count: int, restart: int) None

Set the DigitalIn trigger detector count.

Todo

Figure out what this setting does.

Parameters:
  • count (int) – The event count.

  • restart (int) – (to be documented)

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerLengthSet(min_length: float, max_length: float, sync_mode: int) None

Set the DigitalIn trigger detector length.

Todo

Figure out what this setting does.

Parameters:
  • min_length (float) – (to be documented)

  • max_length (float) – (to be documented)

  • sync_mode (int) –

    Synchronization mode:

    • 0 — Normal.

    • 1 — Timing: the min_length parameter specifies the bit length and the max_length parameter specifies the timing length.

      Used for UART, CAN protocols.

    • 2 — PWM: the min_length parameter specifies the sampling time and the max_length parameter specifies the timing length.

      Used for 1-wire protocols.

Raises:

DwfLibraryError – An error occurred while executing the operation.

triggerMatchSet(pin: int, mask: int, value: int, bit_stuffing: int) None

Set DigitalIn trigger detector match.

Todo

Figure out what this setting does.

Configure the deserializer. The bits are left shifted. The mask and value should be specified accordingly, in MSB-first order.

Parameters:
  • pin (int) – The pin to be deserialized.

  • mask (int) – The mask pattern.

  • value (int) – The bit pattern.

  • bit_stuffing (int) – The bit stuffing count.

Raises:

DwfLibraryError – An error occurred while executing the operation.

counterInfo() Tuple[int, float]

Get DigitalIn counter info.

counterSet(duration: float) None

Set DigitalIn counter duration.

counterGet() float

Get DigitalIn counter duration.

counterStatus() Tuple[float, float, int]

Get DigitalIn counter status.

mixedSet(enable: bool) None

Set mixed state.

Warning

This method is obsolete.

Todo

Figure out what this setting does.

Parameters:

enable (bool) – (to be documented)

Raises:

DwfLibraryError – An error occurred while executing the operation.

property device

Return the DwfDevice instance of which we are an attribute.

This is useful if we have a variable that contains a reference to a DwfDevice attribute, but we need the DwfDevice itself.

Returns:

The DwfDevice instance that this attribute belongs to.

Return type:

DwfDevice