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

Structure of the analogue signal generator configuration.

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

Fields

  • Wfunction — signal type code;

  • frequency — signal frequency;

  • amplitude — signal amplitude;

  • phase — signal phase;

  • offset — DC offset;

  • similarity — signal symmetry/‘similarity’ parameter.

Signal type codes (Wfunction)

Signal type Code

Constant

0

Sine

1

Rectangular

2

Triangular

3

Linear rising

4

Linear falling

5

Noise

6

Pulses

7

Trapezoidal

8

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

Configures the data acquisition parameters for the analogue input signal.

Arguments

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

  • sampling_rate::Float64=20e6 : sampling frequency (Hz).

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

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.connect()

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

Reads the input voltage value on the specified ADC channel.

Arguments

  • channel::Int64 : the input channel number 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 input channel number to read from.

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

Configures and starts the generation of an analogue signal on the specified channel.

Arguments

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

  • config::ANALOGDISCOVERY.WaveGenCfg : the 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 wave
    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 : output channel number to disable.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

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

Establishes a connection with the Analog Discovery device.

Before using the AO_* and AI_* functions, you must call connect().

Return value

Int64 — status code:

  • 0 — connection established successfully;

  • -1 — connection failed;

  • 2 — the device is already connected.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

status = ANALOGDISCOVERY.connect()

if status == 0 || status == 2
    # You can operate 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()