05-07-2012 08:29 AM
Hi Norbert,
thanks for all your effort, but the DLL I/O seems to not be included in the NI I/O Trace. It is done through "CallExternalLibraryNode", not a VISA. Not even a USB-traffic scanner would help me, I guess, because the data does not seem to "reach" the USB interface.
I feel the strong urge to throw not only the PC out of the window, but also light it on fire^^
Regards,
Pedro
05-07-2012 09:09 AM
Pedro,
i think you would get lots of kudos for that video on youtube 😄
Well, obviously we have the following situation:
a) The DLL does not return an error to the calling code, in your case the wrapper VIs
b) The USB port does not send out anything
c) You have no tool available to make sure if the command was put on the output buffer of the USB port at all
d) Using other callers than LV seem to work quite stable
e) Testing different setups of the CLFN (UI thread/any thread) and timings did not change the behavior
This is indeed an aweful situation.
Just for brain storming:
- What about encapsulating the given code in a wrapper DLL (ANSI C)?
- What if the DLL gets unloaded after "Connect" and before "Write"? Could this result in such an issue? Does "Write" have any error information available if the connection is valid at all?
Norbert
05-07-2012 09:14 AM
Hi Norbert,
The DLL I'm using is already a wrapper of a C++ DLL, sorry if that didn't come out clearly. Or do you mean a wrapper for the wrapper?
header file excerpt from the write definition: Returns: Nonzero, if data has been successfully written to the device; otherwise zero. , so yeah, that's my return value.
What do you mean with the DLL getting unloaded?
Thanks heaps for your help so far!
Regards,
Pedro
05-07-2012 09:45 AM
I hope GetVersionAnswer isn't updated in the sub vi's?
/Y
05-08-2012 02:34 AM
Hi Yamaeda,
I'm not quite sure as to what you mean with GetVersionAnswer being updated. Can you please explain this a little more in detail?
Regards,
Pedro
05-08-2012 04:12 AM
You use the GetVersionAnswer in the loop, but if it's changed in some of the sub-vi's you'll get the wrong value.
/Y
05-08-2012 04:20 AM
Nope, that does not happen. Thanks for the input though. Any more suggestions?
Regards,
Pedro
05-08-2012 05:47 AM
With visa i generally use a small wait between writing and reading, like 100ms, maybe you need it with the USB also?
/Y
05-08-2012 05:50 AM
Already tried waiting, that did not work out. Funny fact: whenever it didn't work, it won't work until I restart LabView and then not everytime as well. But if it worked, it worked until I shut down LabView again. Some memory allocation problems maybe?
The programmer of the DLL and the wrapper DLL will look into this problem this week as well, I'll keep you updated, in case someone else encounters a similar problem.
Regards,
Pedro
05-08-2012 06:07 AM
It sounds alot like the problems i had with an ActiveX object. If the program got errors so the object wasn't closed properly it got stuck in memory and required a restart of LV to clear out.
/Y