Programming Manual UTG900E Series
Instruments.uni-trend.com
Dim instrsesn AsLong
Dim status AsLong
Dim count AsLong
' First we will need to open the default resource manager.
status = viOpenDefaultRM(defaultRM)
If (status < VI_SUCCESS) Then
resultTxt.Text = "Could not open a session to the VISA Resource Manager!"
tcp_ip_test = status
ExitFunction
EndIf
' Now we will open a session via TCP/IP device
status = viOpen(defaultRM, "TCPIP0::" + ip + "::inst0::INSTR", VI_LOAD_CONFIG, VI_NULL, instrsesn)
If (status < VI_SUCCESS) Then
resultTxt.Text = "An error occurred opening the session"
viClose(defaultRM)
tcp_ip_test = status
ExitFunction
EndIf
status = viWrite(instrsesn, "*IDN?", 5, count)
If (status < VI_SUCCESS) Then
resultTxt.Text = "Error writing to the device."
EndIf
status = viRead(instrsesn, outputBuffer, VI_FIND_BUFLEN, count)
If (status < VI_SUCCESS) Then
resultTxt.Text = "Error reading a response from the device." + CStr(i + 1)
Else
resultTxt.Text = "read from device:" + outputBuffer
EndIf
status = viClose(instrsesn)
status = viClose(defaultRM)
tcp_ip_test = 0
EndFunction
LabVIEW Example
Condition: Windows System & LabVIEW.
Description: Access the device through the USBTMC and TCP/IP, and send "*IDN?" command in NI-VISA
to check the device information.
Steps
1. Open the LabVIEW software, and newly create a VI file.
2. Add the control, right-click the last interface, select and add the VISA resource name, input error,
output error and some indicators.
3. Open the frame interface, right-click the VISA resource name, select and add the following functions in
the VISA interface of popup menu: VISA Write, VISA Read, VISA Open, and VISA Close.
4. The VISA session of USBTMC device is opened by VI, writing "*IDN?" command to the device and reads
back the response value. The VISA session will be closed by VI when the communication is finished, as