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

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

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}

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

Stops data collection.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.AI_stop()
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

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

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

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()