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:
Next, you need to create a VISA object that will be used to interact with measuring devices.:
|
Methods VISA
#
EngeeDeviceManager.Devices.VISA.close_instrument
-
visa.get_ports(visa::Any)visa.close_instrument(port)Releases the bus for a device connected via the VISA specification.
Arguments
-
port::String: the port of the device connected via the VISA specification. Can be obtained using the functionvisa.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
visa.close_session()
Closes the VISA session.
Arguments
None (the method is called from a 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
visa.create_instrument(port)
visa.create_instrument(port, settings)
Creates an instance of a device connected via the specified port.
Arguments
-
port::String: the port of the device connected via the VISA specification. Can be obtained using thevisa.get_ports()function. -
settings::PortSettings: connection parameters. If the field is set tonothing, the default driver/device value 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
where:
-
baud_rate: baud rate via the COM interface. -
chunk_size: the size of the read block (chunk). (Some serial devices do not support large chunk sizes. If you encounter problems, reduce the value of the parameterchunk_size). -
write_termination: the character(s) marking the end of the byte sequence for writing, for example"\r",\n,\r\n. -
read_terminator: the end-of-byte-sequence termination character(s) for reading, for example"\n"or\r\n. -
CR: the carriage return control character ("\r") during stream-based writing/reading. -
LF: the line feed control character ("\n") during stream-based writing/reading.
Examples
# Creating a device instance the traditional way
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",
))
#
EngeeDeviceManager.Devices.VISA.create_session
visa.create_session(backend)
Creates a session for working with VISA.
Arguments
backend::String: a hardware implementation of the VISA specification, for example, "@py" or "@ni".
Examples
visa = VISA.Visa()
visa.create_session("@py")
#
EngeeDeviceManager.Devices.VISA.flush
visa.flush(port, flush_type)
Clears the device’s I/O buffer.
Arguments
-
port::String: the port of a device connected via the VISA specification. Can be obtained using the functionvisa.get_ports(). -
flush_type::String: the type of clear operation. 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
visa.get_ports()
Retrieves a list of available physical ports.
Arguments
None (the method is called from a VISA object).
Examples
visa = VISA.Visa()
visa.create_session("@py")
ports = visa.get_ports().data
#
EngeeDeviceManager.Devices.VISA.read
visa.read(port, termination)
Reads data from the device.
Arguments
-
port::String: the port of the device connected via the VISA specification. Can be obtained using the functionvisa.get_ports(). -
termination::String: the device-specific end-of-read character. If not defined, leave it 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
visa.readbinblock(port, size)
Reads binary data from the device.
Arguments
-
port::String: the port of the device connected via the VISA specification. Can be obtained using the functionvisa.get_ports(). -
size::Int64: the buffer size 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.visatrigger
visa.visatrigger(port)
Sends interrupt commands to the device.
Arguments
port::String: the port of the device connected via the VISA specification. Can be obtained 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
visa.write(port, message, termination)
Writes messages to the device.
Arguments
-
port::String: the port of the device connected via the VISA specification. Can be obtained using the function . -
message::String: a message containing an SCPI command. For example:"RST;:SYSTEM:LOCK OFF"to reset the settings. -
termination::String: the device-specific end-of-write character. If not defined, leave it 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
visa.writebinblock(port, message)
Writes binary data to the device.
Arguments
-
port::String: the port of the device connected via the VISA specification. Can be obtained using the functionvisa.get_ports(). -
message::Vector{UInt8}: binary data to be written. 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
visa.writeread(port, message, delay)
Writes to the device and reads the response.
Arguments
-
port::String: the port of the device connected via the VISA specification. Can be obtained using the functionvisa.get_ports(). -
message::String: a message containing an SCPI command. For example:":CHAN1:BASE:WAV?"will return the signal type on the first channel. -
delay::Float64: the delay before receiving a response from the device (the optimal value is1.0; for older devices, up to1.5). For more details on response delay, please refer to the documentation for your device.
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