Using NI-VIsa in Matlab without Instrument Control Toolbox

10 visualizaciones (últimos 30 días)
Simon
Simon el 2 de Oct. de 2024
Respondida: Simon el 3 de Oct. de 2024
I am trying to establish a Visa session in Matlab without the Instrument Control Toolbox.
Either via COM-Interface or .NET reference. However neither seems to work.
I tried creating COM-Servers with the same DLLs that are used in MS Excel to create a Visa Session (GlobMgr.dll and BasFormIO.dll). I have tried every ProgID i could find in the DLLs but none works. Because every time I run the file Matlab just crashes, logging Access violation detected at "Time I ran the file". However, if i try to create a COM-Server of an own created object it works fine.
So maybe i can't create COM-Interfaces from DLLs or I use the wrong ProgIDs?
visaObj = actxserver('VISA.GlobalRM');
formIO = actxserver('VISA.BasicFormattedIO');
As for the .NET references I added the Ivi.Visa DLL which should already add all dependencies it needs with it. Matlab even tells me Assembly Ivi.Visa.Interop has alread been added from Ivi.Visa.Interop.dll when i try to add it too.
asm1 = NET.addAssembly('C:\Windows\assembly\GAC_MSIL\Ivi.Visa\7.2.0.0__a128c98f1d7717c1\Ivi.Visa.dll');
asm2 = NET.addAssembly('C:\Program Files\IVI Foundation\VISA\VisaCom64\Primary Interop Assemblies\Ivi.Visa.Interop.dll');
I can import the namespaces I need which would be.
import Ivi.Visa.*
import NationalInstruments.Visa.*
import Ivi.Visa.interop.*
import NationalInstruments.Common.*
But as soon as I try to use functions from them Matlab says "Error using Ivi.Visa.Interop.ResourceManager: No constructior 'Ivi.Visa.Interop.ResourceManager' with matching signature found."
rm = ResourceManager();
Which is odd because obviously it understood, that the resource manager is in the Ivi.Visa.Interop namespace.
Has anyone encountered a similar issue and managed to fix it?
  1 comentario
Walter Roberson
Walter Roberson el 2 de Oct. de 2024
Complete guess:
Maybe the ResourceManager call needs to be passed a parameter?

Iniciar sesión para comentar.

Respuestas (1)

Simon
Simon el 3 de Oct. de 2024
I figured out the .NET part:
Don't make an instance of the resource manager. Instead directly open a session like so:
session = GlobalResourceManager.Open("YourResource");
Also you only have to load the Ivi.Visa assembly and don't need to import the namespaces. Then you can read and write with
session.RawIO.Write()
session.RawIO.ReadString()
However I still have not figured out the correct ProgId to implement the same functionality via COM.

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by