Programming Manual UTG1000X Series
Instruments.uni-trend.com
40
/
51
VB Example
Environment: Window system, Microsoft Visual Basic 6.0.
Description: Access the instrument via USBTMC and TCP/IP, and send "*IDN?" command on
NI-VISA to query the device information.
Steps
:
1.
Open Visual Basic software and create a new standard application program project.
2.
Set the project environment that can adjust NI-VISA library, press Existing tab of Project>>Add
Existing Item, in file "include" of NI-VISA installment path to find file visa32.bas and add this file, as
shown in the following figure.
3.
Source code
a)
USBTMC Example
PrivateFunction usbtmc_test() AsLong
' 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 AsLong
Dim instrsesn AsLong
Dim numlnstrs AsLong
Dim findList AsLong