qmi.instruments.mcc.usb1808x

Instrument driver for the Measurement Computing USB-1808X DAQ.

Classes

MCC_USB1808X(context, name, unique_id)

Instrument driver for the Measurement Computing USB-1808X DAQ.

class qmi.instruments.mcc.usb1808x.MCC_USB1808X(context: QMI_Context, name: str, unique_id: str)

Instrument driver for the Measurement Computing USB-1808X DAQ.

This driver implements only a subset of the features of the USB-1808X. Only programmatic read/write access to DIO pins and analog input/output is supported. Advanced features such as timers, counters, triggering, scanning, waveforms etc. are not yet supported.

static list_instruments() List[str]

Return a list of unique_ids of connected devices.

open() None

Connect to the instrument hardware.

When this method returns, the instrument must be ready for interaction via calls to instrument-specific methods.

Subclasses can extend this method to implement instrument-specific initialization. If they do, they should call super().open() as a last statement.

close() None

Close the connection to the instrument hardware and release associated resources.

When this method returns, the instrument must not be used again unless it is first re-opened by calling the open() method.

Subclasses can extend this method if they have specific resources to close. If they do, they should call super().close() as a last statement.

get_idn() QMI_InstrumentIdentification

Read instrument type and version and return a QMI_InstrumentIdentification instance.

get_dio_num_channels() int

Return the number of digital input/output channels.

get_dio_direction() List[bool]

Return the configured direction (input or output) for each digital channel.

Returns:

List of directions, where directions[i] is True if channel i is configured for output, or directions[i] is False if channel i is configured for input.

set_dio_direction(channel: int, output: bool) None

Configure an digital channel as input or output channel.

Parameters:
  • channel – Digital channel index (0 .. nchan-1).

  • output – True to configure the channel for output; False to configure the channel for input.

get_dio_input_bit(channel: int) bool

Read input levels of the digital channels.

Parameters:

channel – Digital channel index (0 .. nchan-1).

Returns:

True if the input signal is high, False if the signal is low.

set_dio_output_bit(channel: int, value: bool) None

Set a digital output channel to the specified level.

The digital channel must be configured in output mode (see set_dio_direction) before using this function.

Parameters:
  • channel – Digital channel index (0 .. nchan-1).

  • value – True to set the output high, False to set the output low.

get_ai_num_channels() int

Return the number of analog input channels.

get_ai_ranges() List[str]

Return the supported analog input ranges.

Ranges have names such as “UNI2VOLTS” for 0 .. 2 Volt or “BIP10VOLTS” for -10 .. +10 Volt..

get_ai_value(channel: int, input_mode: str, analog_range: str) float

Read the input voltage of an analog input channel.

Parameters:
  • channel – Analog input channel index (0 .. nchan-1).

  • input_mode – Input mode, “SINGLE_ENDED” or “DIFFERENTIAL”.

  • analog_range – Name of the input range to use for the channel.

Returns:

Input level in Volt.

get_ao_num_channels() int

Return the number of analog output channels.

get_ao_ranges() List[str]

Return the supported analog output ranges.

Ranges have names such as “UNI2VOLTS” for 0 .. 2 Volt or “BIP10VOLTS” for -10 .. +10 Volt..

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

set_ao_value(channel: int, analog_range: str, value: float) None

Set an analog output channel to the specified voltage.

Parameters:
  • channel – Analog output channel index (0 .. nchan-1).

  • analog_range – Name of the output range to use for the channel.

  • value – Output level in Volt.

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.