Instructions

Table Of Contents
Chapter 3 Programming Examples RIGOL
RSA5000 Programming Guide 3-11
Visual Basic 6.0 Programming Example
Enter the Visual Basic 6.0 programming environment, and perform the following procedures.
1. Build a standard application program project (Standard EXE), and name it "DemoForRSA".
2. Open Project Add File…. Search for the visa32.bas file from the include folder in the
installation path of NI-VISA, and then add the file to the project. The visa32.bas module contains all
VISA functions and constant statements.
Then, add the Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) statement
into the visa32.bas module; or you can also create a new module to declare the Sleep function.
3. Add the Label, Text, and Button controls. The layout interface for adding controls is as follows:
4. Encapsulate the read and write operations of VISA.
1) Encapsulate the write operation of VISA for easier operation.
'-----------------------------------------------------------
'Function Name: InstrWrite
'Function: Send command to the instrument
'Input: rsrcName,instrument(resource) name
strCmd,Command
'-----------------------------------------------------------
Public Sub InstrWrite(rsrcName As String, strCmd As String)
Dim status As Long
Dim dfltRM As Long
Dim sesn As Long