Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visa32.dll Matlab direct entry

Don't see why one should need Matlab insturment control toolbox when the Visa32.dll should be able to be called and used in Matlab directly.  Help start this off please.

 

loadlibrary('C:\WINDOWS\system32\visa32.dll','C:\Program Files\IVI Foundation\VISA\WinNT\include\visa.h','alias','visa32');

 

not sure what to do with defaultRm

 

Must be something like

 

calllib('visa32', 'viOpenDefaultRM', defaultRm)

 

calllib('visa32', 'viOpen', defaultRm, 'GPIB0::22::INSTR', 0,0, vi)

 

Can't figure it out and need help from a matlab and C guru.  Shouldn't be hard for someone that knows matlab and C real well.

0 Kudos
Message 1 of 4
(4,993 Views)

Hi Brian,

 

I don't know to call the DLL from MATLAB, but you should be able to run C code from MATLAB.  There all several C examples that ship with VISA that you may want to take a look at.  They use the C API for NI-VISA, they don't call into the DLL directly.

 

Regards,

 

Todd V

National Instruments
Applications Engineer
NI Prototyping Community
0 Kudos
Message 2 of 4
(4,972 Views)

Yes I know about c and Matlab.  Doesn't work for for two reasons.  1) C requires MexFunctions (yuck)  2) Matlab changes how the Mex Functions work sometimes between versions.

 

I feel that Direct DLL calls are the only sensible way to do this.  I know it is possible because I've seen it done with straight GPIB.  For example see the link below

http://code.google.com/p/ni-gpib-matlab-wrappers/wiki/dll_loading

 

I want to do the same with VISA but there are some C to matlab topics I am not sure I understand.  I know that somone out there who knows C & matlab can help me a little here.

 

I can almost get a session open.  I watch it in Ni-Spy.

 

 

 

Message Edited by Brian Bidwell on 02-25-2010 04:52 PM
0 Kudos
Message 3 of 4
(4,959 Views)

Hi Brian,

 

I would recommend posting to a MATLAB forum for this issue.  Hopefully someone can help you on this here, but you can probably get more help on using MATLAB on their forums.

 

Regards,

 

Todd V

National Instruments
Applications Engineer
NI Prototyping Community
0 Kudos
Message 4 of 4
(4,949 Views)