SIGLENT
SSG5000X Programming Guide 139
Write a function Usbtmc_test:
Private
Function
Usbtmc_test()
As
Long
' This code demonstrates sending synchronous read & write commands
' to an USB Test & Measurement Class (USBTMC) instrument using
' NI-VISA
' The example writes the "*IDN?\n" string to all the USBTMC
' devices connected to the system and attempts to read back
' results using the write and read functions.
' The general flow of the code is
' Open Resource Manager
' Open VISA Session to an Instrument
' Write the Identification Query Using viWrite
' Try to Read a Response With viRead
' Close the VISA Session
Const
MAX_CNT = 200
Dim
defaultRM
As
Long
Dim
instrsesn
As
Long
Dim
numlnstrs
As
Long
Dim
findList
As
Long
Dim
retCount
As
Long
Dim
status
As
Long
Dim
instrResourceString
As
String
* VI_FIND_BUFLEN
Dim
Buffer
As
String
* MAX_CNT
Dim
i
As
Integer
' First we must call viOpenDefaultRM to get the manager
' handle. We will store this handle in defaultRM.
status = viOpenDefaultRM(defaultRM)
If
(status < VI_SUCCESS)
Then
resultTxt.Text = "Could not open a session to the VISA Resource Manager!"
Usbtmc_test = status
Exit
Function
End
If
' Find all the USB TMC VISA resources in our system and store the
' number of resources in the system in numInstrs.
status = viFindRsrc(defaultRM, "USB?*INSTR", findList, numlnstrs, instrResourceString)
If
(status < VI_SUCCESS)
Then
resultTxt.Text = "An error occurred while finding resources."
viClose(defaultRM)
Usbtmc_test = status
Exit
Function
Содержание SSG5000X Series
Страница 1: ...SSG5000X Series Signal Generator Programming Guide PG0805X E01A...
Страница 14: ...SIGLENT 14 SSG5000X Programming Guide...
Страница 131: ...SIGLENT SSG5000X Programming Guide 131...
Страница 152: ...SIGLENT 152 SSG5000X Programming Guide To close the normal telnet window type Quit and press Enter...