11-01-2011 03:10 PM
I've attached a zip file with the entire workspace for the drivers, including the test program that I wrote (MotionStageTest.exe). I've also included the IVI Store xml file for the computer; I think that the fact that it didn't have the proper entries was what was giving you your errors. No I'm not particularly checking for errors in either the MCP_ReturnAvailableControllers () or MCP_Scan_Stages () routines, but I am single-stepping through them in the debugger, and get no errors anywhere. (I added checks after making the .zip file, and discovered none that way either). The errors in the STAGE_InitWithOptions () driver call (line 110) are consistant, however. If I make the call before MCP_Scan_Stages() there is no error, if I call it afterwards there is the error.
_
11-02-2011 12:36 AM
Hi
I can't compile your MotionStageTest.prj as NVESD_Utilities.h file is lost. Please give me a complete project.
11-02-2011 09:02 AM
Sorry about that.
11-02-2011 03:53 PM
Ok, I've figured it out - but it doesn't make any sense.
I found ConfigStoreExample.zip. (http://digital.ni.com/public.nsf/allkb/F25F9B0E8DA4BB2386256DEF00729F81 ).
I should be using "IviConfig_DisposeHandle (ConfigStoreHandle)" at the end of MCP_Scan_Stages() instead of "IviConfig_Close();
The problem is that IviConfig_Close() returns 0 (indicating no error) and causes things to crash, while IviConfig_DisposeHandle() returns -1074130400 (bad handle) and lets things work fine. If I compile the project found in ConfigStoreExample it also returns this value (that program simply ignores it). Go figure.
11-04-2011 12:41 AM
I am sorry but when I compiled, I got
Failed to open external module.
Aborted load of library "c:\Program Files\Level 1\Bin\NVESD_Utilities_dbg.lib"
11-04-2011 04:12 AM
Hi pblase,
I am doing research about IviConfig_DisposeHandle function, I will give you my research result when I find the problem.
11-11-2011 03:26 AM
Hi pblase,
The code (IviConfig_DisposeHandle(csHandle))in our example is wrong, as in IVI-3.5 specification section 5.2.3:
"The user must not pass a handle of type IviConfigStoreHandle as the value of the Handle parameter. The user may pass a handle of any other type. If a handle of type IviConfigStoreHandle is passed as the value of the Handle parameter, this function will return the Invalid Handle error. "
Since the IviConfigStoreHandle in this example is created by the IVI Engine, you must not call IviConfig_Close() on it. The IVI Engine will do that on process terminate. So, our modification of this example will be just deleting this line of code, leaving the IVI Engine closes the csHandle.
I hope this may be helpful for you. Also thanks for your help to find the problem.
11-14-2011 09:38 AM
Ok. I just hate to leave handles open.
Paul