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 — A parameter of symmetry/"similarity" of the signal.

Signal type codes (Wfunction)

Signal type Code

Constant

0

Sine wave

1

Rectangular

2

Triangular

3

Linear increasing

4

Linear decreasing

5

Noise

6

Pulses

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. Value 0 It is processed as the maximum buffer size (and is 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 value of the voltage 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} — 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 analog signal on the specified channel.

Arguments

  • channel::Int64: The number of the output channel to set.

  • 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 usage of functions AO_* and AI_* it is necessary to call connect().

Return value

Int64 — status code:

  • 0 — 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 device Analog Discovery and releases resources. When the connection is closed, signal generation and data capture stop.

Examples

using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY

ANALOGDISCOVERY.disconnect()