Specifications

Chapter 16 193
ESA/PSA Programming Examples
Using Visual Basic® 6 to Transfer Binary Trace Data
ESA/PSA Programming Examples
’’ declarations needed to make VISA calls from Visual Basic.
’’ To add this module to your project in VB 6, from the menu, select
’’ Project->Add Module, select the Existing tab, and browse to the
’’ directory containing the VB Declaration file, select visa32.bas, and
’’ press Open.
’’
’’ The name and location of the VB declaration file depends on which
’’ operating system you are using. Assuming the standard VISA directory
’’ of C:\Program Files\VISA or the standard VXIpnp directory of
’’ C:\VXIpnp, the visa32.bas file can be located in one of the following:
’’
’’ \winnt\agvisa\include\visa32.bas - Windows NT/2000/XP
’’ \winnt\include\visa32.bas - Windows NT/2000/XP
’’ \win95\include\visa32.bas - Windows 95/98/Me
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
bintrace.bas
The following example program is written for the PSA and ESA Series
Spectrum Analyzers. It queries the IDN string from the instrument
and then reads the trace data in Spectrum Analysis mode in binary
format (Real,32 or Real,64 or Int,32). The data is then stored to a
file "bintrace.txt".
Binary transfers are faster than the default ASCII transfer mode,
because less data is sent over the bus.
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
Option Explicit
Private Sub Main()
Declare Variables used in the program
Dim status As Long VISA function status return code
Dim defrm As Long Session to Default Resource Manager
Dim vi As Long Session to instrument
Dim strRes As String * 100 Fixed length string to hold *IDN? Results
Dim x As Integer Loop Variable
Dim output As String output string variable
Dim ArrayPtr(1) As Long Array of Pointers