UNI-T MSO/UPO2000 Series Programming Manual page 148

Digital phosphor oscilloscope
Table of Contents

Advertisement

Programming Manual
' Now we will open VISA sessions to all USB TMC instruments.
' We must use the handle from viOpenDefaultRM and we must
' also use a string that indicates which instrument to open. This
' is called the instrument descriptor. The format for this string
' can be found in the function panel by right clicking on the
' descriptor parameter. After opening a session to the
' device, we will get a handle to the instrument which we
' will use in later VISA functions. The AccessMode and Timeout
' parameters in this function are reserved for future
' functionality. These two parameters are given the value VI_NULL.
For i = 0 To numInstrs
If (i > 0) Then
status = viFindNext(findList, instrResourceString)
EndIf
status = viOpen(defaultRM, instrResourceString, VI_NULL, VI_NULL, instrsesn)
If (status < VI_SUCCESS) Then
resultTxt.Text = "Cannot open a session to the device " + CStr(i + 1)
GoTo NextFind
EndIf
' 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
Instruments.uni-trend.com
MSO/UPO2000 Series
148 / 156

Advertisement

Table of Contents
loading

Table of Contents