11-14-2011 02:15 PM
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?
11-14-2011 03:26 PM - edited 11-14-2011 03:26 PM
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?
11-15-2011 10:41 AM
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...
11-15-2011 01:45 PM
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?
11-15-2011 02:21 PM
I am looking to send string commands to the device and read back parameters from on board functions over USB.
11-16-2011 10:06 AM
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!
11-16-2011 09:07 PM
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 |
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???
11-17-2011 08:20 AM
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?
11-18-2011 08:01 AM - edited 11-18-2011 08:02 AM
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.
11-20-2011 02:29 PM
here is what i have