EasyManua.ls Logo

Anritsu MS2026C - Visual Basic

Anritsu MS2026C
410 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Example Visual Basic
MS20xxC PM PN: 10580-00306 Rev. E A-5
A-3 Visual Basic
This function can be called in a Visual Basic program. It sends the *IDN? query to the
instrument and returns the byte count and ASCII response string.
Rem This example is based on Example 2-1 from the NI-VISA User Manual.
Public Sub IdnMain(ByVal address As String, ByRef byteCount As String,
ByRef returnBytes As String)
Const BUFFER_SIZE = 200
Dim stat As ViStatus
Dim dfltRM As ViSession
Dim sesn As ViSession
Dim retCount As Long
Dim buffer As String * BUFFER_SIZE
Rem ***Include visa32.dll as a reference in your project.***
Rem Begin by initializing the system
stat = viOpenDefaultRM(dfltRM)
If (stat < VI_SUCCESS) Then
Rem Error initializing VISA...exiting
MsgBox “Can't initialize VISA”
Exit Sub
End If
Rem Open communication with Device
Rem NOTE: For simplicity, we will not show error checking
Rem TODO: Add error handling.
stat = viOpen(dfltRM, address, VI_NULL, VI_NULL, sesn)

Table of Contents

Related product manuals