Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5565

How to use viOpenDefaultRM() to open default resource manager via visual basic

$
0
0

hi all ,

my OS is windows 7 64 bit , and i want to control Tektronix oscilloscope via visual basic 6.

I installed NI-visa 17 driver and in installed path "....\IVI Foundation\VISA\WinNT\Include" i found visa32.bas . 

Then two questions :

1. what should i  input when i call function ViOpenDefaultRM(sesn&)    ?

    in NI-visa help i see this parameters is unique logical identifier to a default resource manager        session and direction is out . but how should I know this session and its value ?

     and the direction  --out is mean this parameters is transfered by address , right ?

 

 

2. in NI-VISA help  write if i want to use data type ViSession , ViStatus and so on ,l need to         reference visa32.dll file in system32 content. but when i reference this file , i was informed that :

bad reference. Could not load file or assembly "file :////C:\windows\System32\visa32.dll" or one of its dependencies. The module was expected to contain an assembly manifest. 

 

so do i really need to reference this visa32.dll ?

if so , why i can not reference this file successfully ?

and when i change language to vb.net , also can not reference this file

Option Explicit
'#Uses "C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Include\visa32.bas"
'#Language "WWB.NET"
Sub Main
  '@TODO: enter code here

Const MAX_CNT = 200
Dim state As Long
Dim dfltRM As Long
Dim sesn As Long
Dim retCount As Long
Dim buffer As String
Rem Begin by initializing the system
state = viOpenDefaultRM(0)
If (state < VI_SUCCESS) Then
Rem Error initializing VISA...exiting
Exit Sub

End If

.

 

 

 


Viewing all articles
Browse latest Browse all 5565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>