Programming Manual UTG1000X Series
Instruments.uni-trend.com
46
/
51
%Close the VISA object
fclose(vt);
delete(vt);
clear vt;
end
Python Example
Environment: Window system, Python3.8, PyVISA 1.11.0.
Description: Access the instrument via USBTMC and TCP/IP, send "*IDN?" command on NI-VISA to
query the device information.
Steps:
1.
Install python, and then turn on Python script compiling software, create an empty test.py file.
2.
Use pip install PyVISA instruction to install PyVISA, if it cannot install, please refer to this link
(https://pyvisa.readthedocs.io/en/latest/).
3.
Source code
a)
USBTMC Example
import pyvisa
rm = pyvisa.ResourceManager()
rm.list_resources()
my_instrument = rm.open_resource('USB0::0x5345::0x1234::SN20220718::INSTR')
print(my_instrument.query('*IDN?'))
b)
TCP/TP Example
import pyvisa
rm = pyvisa.ResourceManager()
rm.list_resources()
my_instrument = rm.open_resource('TCPIP0::192.168.20.11::inst0::INSTR')
print(my_instrument.query('*IDN?'))