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:
|
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.AnalogDiscovery — Type
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.WaveGenCfg — Method
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 |
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.AI_config — Function
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. Value0It 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)
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.AI_read — Method
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)
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.AI_read_buffer — Method
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)
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.AI_stop — Method
ANALOGDISCOVERY.AI_stop()::Nothing
Stops data collection.
Examples
using Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY
ANALOGDISCOVERY.AI_stop()
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.AO_config — Method
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)")
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.AO_stop — Method
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)
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.connect — Method
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
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.disconnect — Method
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()
#
Main.EngeeDeviceManager.Devices.ANALOGDISCOVERY.print_info — Method