Listing d.2 – BNC 1201 - 6 1/2 Digit Digital Multimeter User Manual

Page 167

Advertising
background image

168

Using CONFigure with a Math Operation

The following example uses CONFigure with the dBm math operation.

The CONFigure command gives you a little more programming

flexibility than the MEASure? command. This allows you to

“incrementally” change the multimeter’s configuration. The example is

is shown in Visual Basic.

Creating the Application

Create a new Visual Basic project as follows:

1. Create a new Standar.EXE project.

2. To set the startup object for a Windows Application to Sub Main

3. Add New Module, Declare a Sub Main().

LISTING D.2. THE CONFigure FUNCTION.

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub main()

Rem #########################################
Rem
Rem Using NI-VISA library visa32.dll
Rem
Rem Set sample count 5 configuration and
Rem read the trigger
Rem
Rem #########################################

Dim stat As ViStatus
Dim dfltRM As ViSession
Dim sesn As ViSession
Dim fList As ViFindList
Dim desc As String * VI_FIND_BUFLEN
Dim nList As Long
Dim ret As Long
Dim readin As String * 128
Dim i As Integer ' Array index

stat = viOpenDefaultRM(dfltRM)
If (stat < VI_SUCCESS) Then
'Rem Error initializing VISA ... exiting
MsgBox "USBTMC resource not found.", vbExclamation, "1201 multimeter
device test"
Exit Sub
End If

Rem Find all 1201 USBTMC instruments in the system
stat = viFindRsrc(dfltRM, "USB[0-9]*::0x164E::0x0FA3::?*INSTR", fList,
nList, desc)

Advertising