LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

open visa sessions for controlling external dlls

I need to open a VISA session to pass a session reference into a call library fucntion that calls the vendors instrument functions.  I currently see no way to do this using the call library or visa open function.  Does anybody know how to proceed when you have a non NI instrument that has a dll wiht it that you need to control over USB serially? 

0 Kudos
Message 1 of 18
(3,356 Views)

Can you elaborate - you're saying that you don't see any way to do this, but you're asking us to do it without providing any specific info. We need at least the function declaration of the dll to which you need to pass the reference. Otherwise, there's no way of know what the dll expects. If you don't have it, if you tell us the device you're using or a better description of the system we might be able to find the relevant docs. Also, I don't understand where USB comes into play. Is the device a USB to serial converter?

0 Kudos
Message 2 of 18
(3,349 Views)

I have a dll that contains this function.  It is within a dll.  I merely want to get it to work by opening a session to the USB Devicve and writing and reading what I have to.  Please help...

 

 

0 Kudos
Message 3 of 18
(3,337 Views)

Hi id,

 

You need to supply more information about what you are trying to accomplish.  Does your .dll handle the communication with the USB device or are you looking to send String commands to the USB device using our VISA Read and Write commands?

Regards,

Mike Altmann
Product R&D
NI
0 Kudos
Message 4 of 18
(3,324 Views)

I am looking to send string commands to the device and read back parameters from on board functions over USB.

0 Kudos
Message 5 of 18
(3,316 Views)

Hi id,

 

Here is a link to a tutorial on how to setup communication with a third party USB device using LabVIEW and NI-VISA.  This tutorial will show you the steps you need to walk through to start communication with your USB device.  Here is a link on how to reference .DLLs using LabVIEW.

 

Good luck with your project!

Regards,

Mike Altmann
Product R&D
NI
0 Kudos
Message 6 of 18
(3,304 Views)

Mike,

 

First thanks for your help but I have been in both those docs before.  My issue is that I have an instrument vendor that has a dll with functions like this:

 

ViStatus _VI_FUNC Instr_autoConnectToFirst(ViPSession vi)
{
  return(Instr_autoConnectToAll(vi,1,NULL));
}

 

that is written using some of the variables in the VISA library...

 

When I go to look up what datatypes these variables are in the VISA specifications so I can hopefully create inpuits on a call library function in Labview,  I get descriptions like this:

 

 

Type ViStatus

This is the operational return status. It returns either a completion code or an error code as follows.

 

Completion Codes

Description

VI_SUCCESS

Attribute value set successfully.

VI_WARN_NSUP_ATTR_STATE

Although the specified attribute state is valid, it is not supported by this implementation.

 

Error Codes

Description

VI_ERROR_INV_SESSION
VI_ERROR_INV_OBJECT

The given session or object reference is invalid (both are the same value).

VI_ERROR_NSUP_ATTR

The specified attribute is not defined by the referenced session, event, or find list.

VI_ERROR_NSUP_ATTR_STATE

The specified state of the attribute is not valid, or is not supported as defined by the session, event, or find list.

VI_ERROR_ATTR_READONLY

The specified attribute is read-only.

VI_ERROR_RSRC_LOCKED

Specified operation could not be performed because the resource identified by vi has been locked for this kind of access.

 

 

 

 I do not see how I get the IO defined for passing and returning data to these external library calls.

 

 

Any ideas???

 

0 Kudos
Message 7 of 18
(3,291 Views)

Hi id,

 

What kind of calls does this DLL make to the VISA library?  Your DLL may be make the USB calls for you.  Could you post the .DLL and its header file?  Does the 3rd party company have any documentation as well?  With the .DLL and header file we can try and work out what parameters we have to pass and return.  Correct me if I'm wrong but I think that problem lies in figuring out what needs to be passed to the functions in the DLL.  Are you calling this .DLL with LabVIEW?

 

 

Regards,

Mike Altmann
Product R&D
NI
0 Kudos
Message 8 of 18
(3,283 Views)

Configure that parameter as a unsigned 32bit integer (passed as pointer reference because of the P in ViPsession) and wire up the LabVIEW VISA session to that parameter. The LabVIEW Call Library Node will take care to extract the embedded VISA session handle from the VISA Resource and pass it to the function.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 18
(3,269 Views)

here is what i have

0 Kudos
Message 10 of 18
(3,248 Views)