Engee documentation

VISA Software Management

This page contains all the available VISA software management functions in Engee.

To work with VISA software management functions in Engee, follow the instructions given in article. After that, perform:

using Main.EngeeDeviceManager.Devices.VISA

Next, you need to create a VISA object that will be used to interact with measuring devices.:

visa = VISA.Visa()

Methods VISA

visa.close_instrument(port)

Releases the bus for the device connected via the VISA specification.

Arguments

port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports().

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.create_instrument(port)
visa.close_instrument(port)
visa.close_instrument(port)

Освобождает шину для прибора, подключенного через спецификацию VISA.

Аргументы

port::String: порт прибора, подключенного через спецификацию VISA. Можно получить с помощью функции visa.get_ports().

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.create_instrument(port)
visa.close_instrument(port)
visa.close_session()

Закрывает сессию работы с VISA.

Аргументы

Отсутствуют (метод вызывается от объекта VISA).

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.close_session()
visa.close_session()

Closes the VISA session.

Arguments

Missing (the method is called from the VISA object).

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.close_session()
visa.create_instrument(port)
visa.create_instrument(port, settings)

Creates an instance of the device connected on the specified port.

Arguments

  • port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports().

  • settings::PortSettings: connection parameters. If the field is set to nothing, then the default value of the driver/device is used.

Structure PortSettings

Base.@kwdef mutable struct PortSettings
        baud_rate::Union{Int64, Nothing} = nothing
        chunk_size::Union{Int64, Nothing} = nothing
        write_termination::Union{String, Nothing} = nothing
        read_terminator::Union{String, Nothing} = nothing
        CR::Union{String, Nothing} = nothing
        LF::Union{String, Nothing} = nothing
end

here:

  • baud_rate: the transmission rate via the COM interface.

  • chunk_size: the size of the read block (chunk). (Some serial devices do not support large chunk values. If problems occur, decrease the parameter value. chunk_size).

  • write_termination: the end-of-byte sequence completion character(s) for writing, for example "\r", \n, \r\n.

  • read_terminator: the end-of-byte sequence completion character(s) for reading, for example "\n" or \r\n.

  • CR: carriage return control symbol ("\r") when writing/reading streams.

  • LF: line feed control character ("\n") when writing/reading streams.

Examples

# Classic device instance creation
visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.create_instrument(port)

# Creating an instance with parameters PortSettings
visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)

visa.create_instrument(port, VISA.PortSettings(
    baud_rate = 115200,
    chunk_size = 256,
    write_termination = "\r\n",
    read_terminator  = "\n",
    CR = "\r",
    LF = "\n",
))
visa.create_session(backend)

Creates a session for working with VISA.

Arguments

backend::String: hardware implementation of the VISA specification, for example, "@py" or "@ni".

Examples

visa = VISA.Visa()
visa.create_session("@py")
visa.create_session(backend)

Создает сессию для работы с VISA.

Аргументы

backend::String: аппаратная реализация спецификации VISA, например, "@py" или "@ni".

Примеры

visa = VISA.Visa()
visa.create_session("@py")
visa.flush(port, flush_type)

Clears the I/O buffers of the device.

Arguments

  • port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports().

  • flush_type::String: type of cleaning. For example: "flush_write_buffer" or "flush_transmit_buffer".

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.create_instrument(port)
visa.flush(port, "flush_write_buffer")
visa.flush(port, flush_type)

Очищает I/O буфера прибора.

Аргументы

  • port::String: порт прибора, подключенного через спецификацию VISA. Можно получить с помощью функции visa.get_ports().

  • flush_type::String: тип очистки. Например: "flush_write_buffer" или "flush_transmit_buffer".

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.create_instrument(port)
visa.flush(port, "flush_write_buffer")
visa.get_ports()

Получает список доступных физических портов.

Аргументы

Отсутствуют (метод вызывается от объекта VISA).

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
visa.get_ports()

Retrieves the list of available physical ports.

Arguments

Missing (the method is called from the VISA object).

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
visa.read(port, termination)

Reads data from the device.

Arguments

  • port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports().

  • termination::String: A device-specific read completion symbol. If it is not defined, then it should be left empty. "".

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
read_result = visa.read(port, "").data
visa.read(port, termination)

Читает данные с прибора.

Аргументы

  • port::String: порт прибора, подключенного через спецификацию VISA. Можно получить с помощью функции visa.get_ports().

  • termination::String: символ завершения чтения, специфичный для прибора. Если не определен, то нужно оставить пустым "".

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
read_result = visa.read(port, "").data
visa.readbinblock(port, size)

Reads binary data from the device.

Arguments

  • port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports().

  • size::Int64: the size of the buffer for reading bytes, for example: 8.

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
bytes = visa.readbinblock(port, 8).data
visa.readbinblock(port, size)

Читает бинарные данные с прибора.

Аргументы

  • port::String: порт прибора, подключенного через спецификацию VISA. Можно получить с помощью функции visa.get_ports().

  • size::Int64: размер буфера для считывания байт, например: 8.

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
bytes = visa.readbinblock(port, 8).data
visa.visatrigger(port)

Sends interrupt commands to the device.

Arguments

port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports().

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.visatrigger(port)
visa.visatrigger(port)

Подает команды прерывания в прибор.

Аргументы

port::String: порт прибора, подключенного через спецификацию VISA. Можно получить с помощью функции visa.get_ports().

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.visatrigger(port)
visa.write(port, message, termination)

Writes messages to the device.

Arguments

  • port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports(visa::Any).

  • message::String: message with the SCPI command. For example: "RST;:SYSTEM:LOCK OFF" to reset the settings.

  • termination::String: A device-specific recording completion symbol. If it is not defined, then it should be left empty. "".

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.create_instrument(port)
numbytes = visa.write(port, "*RST;:SYSTEM:LOCK OFF", "").data
visa.write(port, message, termination)

Записывает сообщения в прибор.

Аргументы

  • port::String: порт прибора, подключенного через спецификацию VISA. Можно получить с помощью функции visa.get_ports(visa::Any).

  • message::String: сообщение со SCPI командой. Например: "RST;:SYSTEM:LOCK OFF" для сброса настроек.

  • termination::String: символ завершения записи, специфичный для прибора. Если не определен, то нужно оставить пустым "".

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
visa.create_instrument(port)
numbytes = visa.write(port, "*RST;:SYSTEM:LOCK OFF", "").data
visa.writebinblock(port, message)

Writes binary data to the device.

Arguments

  • port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports().

  • message::Vector{UInt8}: binary data for writing. For example: [0x01, 0x00].

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
numbytes = visa.writebinblock(port, [0x01, 0x00]).data
visa.writebinblock(port, message)

Записывает бинарные данные в прибор.

Аргументы

  • port::String: порт прибора, подключенного через спецификацию VISA. Можно получить с помощью функции visa.get_ports().

  • message::Vector{UInt8}: бинарные данные для записи. Например: [0x01, 0x00].

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
numbytes = visa.writebinblock(port, [0x01, 0x00]).data
visa.writeread(port, message, delay)

Записывает в прибор и читает ответ.

Аргументы

  • port::String: порт прибора, подключенного через спецификацию VISA. Можно получить с помощью функции visa.get_ports().

  • message::String: сообщение со SCPI командой. Например: ":CHAN1:BASE:WAV?" вернет тип сигнала в первом канале.

  • delay::Float64: задержка для получения ответа с прибора (оптимальное значение 1.0, для старых приборов до 1.5). Подробнее о задержке отклика читайте в документации используемого прибора.

Примеры

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
writeread_result = visa.writeread(port, ":CHAN1:BASE:WAV?", 1.2).data
visa.writeread(port, message, delay)

Writes the answer to the device and reads it.

Arguments

  • port::String: the port of the device connected via the VISA specification. You can get it using the function visa.get_ports().

  • message::String: message with the SCPI command. For example: ":CHAN1:BASE:WAV?" returns the type of signal in the first channel.

  • delay::Float64: delay for receiving a response from the device (optimal value 1.0, for older devices up to 1.5). For more information about the response delay, see the documentation of the device you are using.

Examples

visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
port = last(ports)
writeread_result = visa.writeread(port, ":CHAN1:BASE:WAV?", 1.2).data