VISA Software Management
This page contains all the available VISA software management functions in Engee.
| 
 To work with the VISA software management functions in Engee, follow the instructions provided in article. After that, perform: 
Next, you need to create a VISA object that will be used to interact with measuring devices.: 
 | 
Methods VISA
#
EngeeDeviceManager.Devices.VISA.Visa — Type
#
EngeeDeviceManager.Devices.VISA.close_instrument — Method
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)
#
EngeeDeviceManager.Devices.VISA.close_session — Method
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()
#
EngeeDeviceManager.Devices.VISA.create_instrument — Method
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 functionvisa.get_ports(). - 
settings::PortSettings: connection parameters. If the field is set tonothing, 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 PortSettings parameters
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",
))
#
EngeeDeviceManager.Devices.VISA.create_instrument — Method
#
EngeeDeviceManager.Devices.VISA.create_session — Method
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")
#
EngeeDeviceManager.Devices.VISA.flush — Method
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 functionvisa.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")
#
EngeeDeviceManager.Devices.VISA.get_ports — Method
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
#
EngeeDeviceManager.Devices.VISA.read — Function
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 functionvisa.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
#
EngeeDeviceManager.Devices.VISA.readbinblock — Method
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 functionvisa.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
#
EngeeDeviceManager.Devices.VISA.set_settings — Method
#
EngeeDeviceManager.Devices.VISA.visatrigger — Method
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)
#
EngeeDeviceManager.Devices.VISA.write — Function
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 functionvisa.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
#
EngeeDeviceManager.Devices.VISA.writebinblock — Method
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 functionvisa.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
#
EngeeDeviceManager.Devices.VISA.writeread — Function
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 functionvisa.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 value1.0, for older devices up to1.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