Programming Manual UTG1000X Series
Instruments.uni-trend.com
42
/
51
' At this point we now have a session open to the USB TMC instrument.
' We will now use the viWrite function to send the device the string "*IDN?",
' asking for the device's identification.
status = viWrite(instrsesn, "*IDN?", 5, retCount)
If (status < VI_SUCCESS) Then
resultTxt.Text = "Error writing to the device."
status = viClose(instrsesn)
GoTo NextFind
EndIf
' Now we will attempt to read back a response from the device to
' the identification query that was sent. We will use the viRead
' function to acquire the data.
' After the data has been read the response is displayed.
status = viRead(instrsesn, Buffer, MAX_CNT, retCount)
If (status < VI_SUCCESS) Then
resultTxt.Text = "Error reading a response from the device." + CStr(i + 1)
Else
resultTxt.Text = "Read from device: " + CStr(i + 1) + " " + Buffer
EndIf
status = viClose(instrsesn)
Next i
' Now we will close the session to the instrument using
' viClose. This operation frees all system resources.
status = viClose(defaultRM)
usbtmc_test = 0
EndFunction
b)
TCP/IP Example
PrivateFunction tcp_ip_test(ByVal ip AsString) AsLong
Dim outputBuffer AsString * VI_FIND_BUFLEN
Dim defaultRM AsLong
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