EasyManuals Logo

UNI-T UTG900E Series Programming Manual

UNI-T UTG900E Series
41 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #31 background imageLoading...
Page #31 background image
Programming Manual UTG900E Series
Instruments.uni-trend.com
31 / 41
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
Dim retCount AsLong
Dim status AsLong
Dim instrResourceString AsString *VI_FIND_BUFLEN
Dim Buffer AsString * MAX_CNT
Dim i AsInteger
' 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
ExitFunction
EndIf
' 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
ExitFunction
EndIf
' 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

Table of Contents

Other manuals for UNI-T UTG900E Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the UNI-T UTG900E Series and is the answer not in the manual?

UNI-T UTG900E Series Specifications

General IconGeneral
BrandUNI-T
ModelUTG900E Series
CategoryPortable Generator
LanguageEnglish

Related product manuals