Engee documentation

Software management of Analog Discovery

This page shows all the available software control functions of Analog Discovery in Engee.

To work with the software control functions of Analog Discovery in Engee, install the hardware support package as specified in article. After that, perform:

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY
ANALOGDISCOVERY.WaveGenCfg

The configuration structure of the analog signal generator.

Used in ANALOGDISCOVERY.AO_config(...) to set the parameters of the generated signal.

Fields

  • Wfunction — signal type code;

  • frequency — signal frequency;

  • amplitude — signal amplitude;

  • phase — signal phase;

  • offset — DC offset;

  • similarity — the parameter of symmetry/ "similarity" of the signal.

Signal type codes (Wfunction)

Type of signal Code

Constant

0

The sine wave

1

Rectangular

2

Triangular

3

Linear ascending

4

Linear decreasing

5

Noise

6

Impulses

7

Trapezoidal

8

ANALOGDISCOVERY.AI_config(range::Int64=5, sampling_rate::Float64=20e6, buffer_size::Int64=0)::Nothing

Настраивает параметры сбора данных аналогового входного сигнала.

Аргументы

  • range::Int64=5: диапазон входного напряжения.

  • sampling_rate::Float64=20e6: частота дискретизации (Гц).

  • buffer_size::Int64=0: размер буфера сбора данных. Значение 0 обрабатывается как максимальный размер буфера (и дополнительно ограничивается возможностями устройства).

Примеры

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()

# Пример настройки: диапазон 5 В, 1 МГц, буфер 8192 отсчета
ANALOGDISCOVERY.AI_config(5, 1e6, 8192)
ANALOGDISCOVERY.AI_config(range::Int64=5, sampling_rate::Float64=20e6, buffer_size::Int64=0)::Nothing

Adjusts the data acquisition parameters of the analog input signal.

Arguments

  • range::Int64=5: input voltage range.

  • sampling_rate::Float64=20e6: Sampling rate (Hz).

  • buffer_size::Int64=0: the size of the data acquisition buffer. Meaning 0 it is treated as the maximum buffer size (and additionally limited by the device’s capabilities).

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()

# Setting example: range 5 V, 1 MHz, buffer 8192 samples
ANALOGDISCOVERY.AI_config(5, 1e6, 8192)
ANALOGDISCOVERY.AI_read(channel::Int64)::Float64

Считывает значение входного напряжения на указанном канале АЦП.

Аргументы

  • channel::Int64: номер входного канала для чтения.

Возвращаемое значение

Float64 — измеренное значение напряжения указанного канала.

Примеры

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()
ANALOGDISCOVERY.AI_config()

u = ANALOGDISCOVERY.AI_read(1)
ANALOGDISCOVERY.AI_read(channel::Int64)::Float64

Reads the value of the input voltage on the specified ADC channel.

Arguments

  • channel::Int64: the number of the input channel to read.

Return value

Float64 — the measured voltage value of the specified channel.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()
ANALOGDISCOVERY.AI_config()

u = ANALOGDISCOVERY.AI_read(1)
ANALOGDISCOVERY.AI_read_buffer(channel::Int64)::Vector{Float64}

Считывает буфер указанного канала АЦП.

Аргументы

  • channel::Int64: номер входного канала для чтения.

Возвращаемое значение

Vector{Float64} — вектор значений напряжения из буфера.

Примеры

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()
ANALOGDISCOVERY.AI_config(buffer_size=4096)

buf = ANALOGDISCOVERY.AI_read_buffer(1)
ANALOGDISCOVERY.AI_read_buffer(channel::Int64)::Vector{Float64}

Reads the buffer of the specified ADC channel.

Arguments

  • channel::Int64: the number of the input channel to read.

Return value

Vector{Float64} — a vector of voltage values from the buffer.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()
ANALOGDISCOVERY.AI_config(buffer_size=4096)

buf = ANALOGDISCOVERY.AI_read_buffer(1)
ANALOGDISCOVERY.AI_stop()::Nothing

Останавливает сбор данных.

Примеры

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.AI_stop()
ANALOGDISCOVERY.AI_stop()::Nothing

Stops data collection.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.AI_stop()
ANALOGDISCOVERY.AO_config(channel::Int64, config::ANALOGDISCOVERY.WaveGenCfg)::Int64

Настраивает и запускает генерацию аналогового сигнала на указанном канале.

Аргументы

  • channel::Int64: номер выходного канала для настройки.

  • config::ANALOGDISCOVERY.WaveGenCfg: конфигурация генерируемого сигнала.

Возвращаемое значение

Int64 — код статуса:

  • 0 — успешно;

  • -1 — сбой настройки.

Примеры

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()

cfg = ANALOGDISCOVERY.WaveGenCfg(
    1,        # Wfunction: синус
    1000.0,   # frequency, Hz
    1.0,      # amplitude
    0.0,      # phase
    0.0,      # offset
    0.5       # similarity
)

status = ANALOGDISCOVERY.AO_config(1, cfg)
status == 0 || error("AO_config failed (status=$status)")
ANALOGDISCOVERY.AO_config(channel::Int64, config::ANALOGDISCOVERY.WaveGenCfg)::Int64

Adjusts and starts the generation of an analog signal on the specified channel.

Arguments

  • channel::Int64: the number of the output channel to configure.

  • config::ANALOGDISCOVERY.WaveGenCfg: configuration of the generated signal.

Return value

Int64 — status code:

  • 0 — successful;

  • -1 — configuration failure.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()

cfg = ANALOGDISCOVERY.WaveGenCfg(
    1,        # Wfunction: sine
    1000.0,   # frequency, Hz
    1.0,      # amplitude
    0.0,      # phase
    0.0,      # offset
    0.5       # similarity
)

status = ANALOGDISCOVERY.AO_config(1, cfg)
status == 0 || error("AO_config failed (status=$status)")
ANALOGDISCOVERY.AO_stop(channel::Int64)::Nothing

Отключает генерацию сигнала на указанном канале.

Аргументы

  • channel::Int64: номер выходного канала для отключения.

Примеры

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.AO_stop(1)
ANALOGDISCOVERY.AO_stop(channel::Int64)::Nothing

Disables signal generation on the specified channel.

Arguments

  • channel::Int64: the number of the output channel to disconnect.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.AO_stop(1)
ANALOGDISCOVERY.connect()::Int64

Устанавливает соединение с устройством Analog Discovery.

Перед использованием функций AO_* и AI_* необходимо вызвать connect().

Возвращаемое значение

Int64 — код статуса:

  • 0 — подключение установлено успешно;

  • -1 — сбой подключения;

  • 2 — устройство уже подключено.

Примеры

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

status = ANALOGDISCOVERY.connect()

if status == 0 || status == 2
    # можно работать с устройством
else
    error("Не удалось подключиться к Analog Discovery (status=$status)")
end
ANALOGDISCOVERY.connect()::Int64

Establishes a connection with the Analog Discovery device.

Before using the functions AO_* and AI_* it is necessary to call connect().

Return value

Int64 — status code:

  • 0 — the connection was established successfully;

  • -1 — connection failure;

  • 2 — the device is already connected.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

status = ANALOGDISCOVERY.connect()

if status == 0 || status == 2
    # you can work with the device
else
    error("Не удалось подключиться к Analog Discovery (status=$status)")
end
ANALOGDISCOVERY.disconnect()::Nothing

Закрывает соединение с подключенным устройством Analog Discovery и освобождает ресурсы. При закрытии соединения останавливаются генерация сигналов и захват данных.

Примеры

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.disconnect()
ANALOGDISCOVERY.disconnect()::Nothing

Closes the connection to the connected Analog Discovery device and releases resources. When the connection is closed, signal generation and data capture stop.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.disconnect()