09-30-2017 03:01 AM
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
.
10-02-2017 10:13 AM
If you installed NI-VISA after you installed VB.NET, it should include example programs.
Take a look at those.
10-16-2017
07:25 AM
- last edited on
11-16-2024
04:55 PM
by
Content Cleaner
visa32.dll is a Windows shared library, it is not a NET assembly (even if the file extension is the same) so you cannot reference it directly in a NET project.
For VB.NET you have the following options:
- use VISA-NET interface assembly provided by NI: https://www.ni.com/en/support/documentation/supplemental/15/national-instruments-visa--net-library.h...
- use my library : https://www.codeproject.com/Articles/1166996/Multithreaded-communication-for-GPIB-Visa-Serial-i
- import the functions you need from visa32.dll, you can look at the code in VisaDevice.vb in my library to see how to do it