VISA software control
This page shows all available VISA software control functions in Engee.
To work with the VISA software control functions in Engee, follow the instructions given in the article engee-hardware/integration-with-hardware.adoc#hardware-installation. Afterwards, it is necessary to create a VISA object that will be used to interact with the measuring instruments:
|
VISA
methods
#
EngeeDeviceManager.Devices.VISA.close_instrument
— Method
VISA.close_instrument(visa::Any, port::String)
Releases the bus for an instrument connected via VISA specification.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the device connected via the VISA specification. Can be obtained with the functionVISA.get_ports(visa::Any)
.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
VISA.create_instrument(visa, port)
VISA.close_instrument(visa, port)
#
EngeeDeviceManager.Devices.VISA.close_session
— Method
VISA.close_session(visa::Any)
Closes the VISA session.
Arguments
visa::Any
: VISA specification object. The command visa = VISA.Visa()
is used to create the object.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
VISA.close_session(visa)
#
EngeeDeviceManager.Devices.VISA.create_instrument
— Method
VISA.create_instrument(visa::Any, port::String)
Creates an instance of the instrument connected on the specified port.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the instrument connected via the VISA specification. Can be obtained with the functionVISA.get_ports(visa::Any)
.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
VISA.create_instrument(visa, port)
#
EngeeDeviceManager.Devices.VISA.create_session
— Method
VISA.create_session(visa::Any, backend:String)
Creates a session for working with VISA.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
backend::String
: hardware implementation of the VISA specification, e.g."@py"
or"@ni"
.
Examples
VISA.create_session(visa, "@py")
#
EngeeDeviceManager.Devices.VISA.flush
— Method
VISA.flush(visa::Any, port::String, flush_type::String)
Clears the I/O buffer of the instrument.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the instrument connected via VISA specification. Can be obtained with the functionVISA.get_ports(visa::Any)
. -
flush_type::String
: purge type. For example:"flush_write_buffer"
or"flush_transmit_buffer"
.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
VISA.create_instrument(visa, port)
VISA.flush(visa, port, "flush_write_buffer")
#
EngeeDeviceManager.Devices.VISA.get_ports
— Method
VISA.get_ports(visa::Any)
Gets a list of available physical ports.
Arguments
visa::Any
: VISA specification object. The command visa = VISA.Visa()
is used to create the object.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
#
EngeeDeviceManager.Devices.VISA.read
— Function
VISA.read(visa::Any, port::String, termination::String)
Reads data from the instrument.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the instrument connected via the VISA specification. Can be obtained with the functionVISA.get_ports(visa::Any)
. -
termination::String
: instrument-specific read termination character. If not defined, leave empty""
.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
read_result = VISA.read(visa, port, "").data
#
EngeeDeviceManager.Devices.VISA.readbinblock
— Method
VISA.readbinblock(visa::Any, port::String, size::Int64)
Reads binary data from the instrument.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the instrument connected via VISA specification. Can be obtained using the functionVISA.get_ports(visa::Any)
. -
size::Int64
: buffer size for reading bytes, for example:8
.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
bytes = VISA.readbinblock(visa, port, 8).data
#
EngeeDeviceManager.Devices.VISA.visatrigger
— Method
VISA.visatrigger(visa::Any, port::String)
Sends interrupt commands to the device.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the instrument connected via the VISA specification. Can be obtained with the functionVISA.get_ports(visa::Any)
.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
VISA.visatrigger(visa, port)
#
EngeeDeviceManager.Devices.VISA.write
— Function
VISA.write(visa::Any, port::String, message::String, termination::String)
Records messages in the instrument.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the instrument connected via the VISA specification. Can be retrieved using the functionVISA.get_ports(visa::Any)
. -
message::String
: message with SCPI command. For example:"RST;:SYSTEM:LOCK OFF"
to reset. -
termination::String
: instrument specific write termination character. If not defined, you must leave blank""
.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
VISA.create_instrument(visa, port)
numbytes = VISA.write(visa, port, "*RST;:SYSTEM:LOCK OFF", "").data
#
EngeeDeviceManager.Devices.VISA.writebinblock
— Method
VISA.writebinblock(visa::Any, port::String, message::Vector{UInt8})
Writes binary data to the device.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the instrument connected via the VISA specification. It can be obtained with the functionVISA.get_ports(visa::Any)
. -
message::Vector{UInt8}
: binary data to be written. For example:[0x01, 0x00]
.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
numbytes = VISA.writebinblock(visa, port, [0x01, 0x00]).data
#
EngeeDeviceManager.Devices.VISA.writeread
— Function
VISA.writeread(visa::Any, port::String, message::String, delay::Float64)
Writes in the instrument and reads the answer.
Arguments
-
visa::Any
: VISA specification object. The commandvisa = VISA.Visa()
is used to create the object . -
port::String
: port of the instrument connected via the VISA specification. Can be retrieved using the functionVISA.get_ports(visa::Any)
. -
message::String
: message with SCPI command. For example:":CHAN1:BASE:WAV?"
will return the signal type in channel one. -
delay::Float64
: delay to receive a response from the instrument (optimal value1.0
, for older instruments up to1.5
). For more information about the response delay, please refer to the documentation of the instrument you are using.
Examples
VISA.create_session(visa, "@py")
ports = VISA.get_ports(visa).data
port = last(ports)
writeread_result = VISA.writeread(visa, port, ":CHAN1:BASE:WAV?", 1.2).data