durnek60 Posted July 10, 2011 Report Share Posted July 10, 2011 Hi! Could you help me to solve my DLL call problem? Please take a look at the attached images. How do I configure the parameter? Quote Link to comment
LogMAN Posted July 10, 2011 Report Share Posted July 10, 2011 (edited) Hi! Could you help me to solve my DLL call problem? Please take a look at the attached images. How do I configure the parameter? Hello, durnek60 First of all, change the string constants (SerNo / Model) of your cluster to arrays of bytes (numeric U8 in LabVIEW), since chars are arrays of bytes. The arrays must be initialized (at least 16 elements for each) or the dll will write data in places which are already in use by LabVIEW -> might cause LabVIEW to crash!!! The DWORD values should be at least U32 values. The last DWORD value (dwResrved) should be at least U32 and must be initialized like the char values. I recommend initializing the arrays using the "initialize array" VI of the array palette in LabVIEW (just to be absolutely sure). Hope that will help you. Sorry, can't help you with the configuration dialog, since I don't have an LabVIEW installation on my current system. If the problem does occur anymore you should also share the error messages and the configuration dialog of the your dll call. Greetings, LogMAN Edited July 10, 2011 by LogMAN 1 Quote Link to comment
durnek60 Posted July 10, 2011 Author Report Share Posted July 10, 2011 (edited) Hello, durnek60 First of all, change the string constants (SerNo / Model) of your cluster to arrays of bytes (numeric U8 in LabVIEW), since chars are arrays of bytes. The arrays must be initialized (at least 16 elements for each) or the dll will write data in places which are already in use by LabVIEW -> might cause LabVIEW to crash!!! The DWORD values should be at least U32 values. The last DWORD value (dwResrved) should be at least U32 and must be initialized like the char values. I recommend initializing the arrays using the "initialize array" VI of the array palette in LabVIEW (just to be absolutely sure). Hope that will help you. Sorry, can't help you with the configuration dialog, since I don't have an LabVIEW installation on my current system. If the problem does occur anymore you should also share the error messages and the configuration dialog of the your dll call. Greetings, LogMAN Hi LogMAN! Thanks for your reply! I've made the modifications but my LV crashes! When I Set the Number of Cameras parameter to 1 (only I is connected currently) my LV crashes. BTW, If I set it to zero, I've return value, in Param cluster - NumberOfCameras = 1, but the remaining fields are empty... But, as I read in the document, I have to Set the input parameter value - number of cameras Hi LogMAN! Thanks for your reply! I've made the modifications but my LV crashes! When I Set the Number of Cameras parameter to 1 (only I is connected currently) my LV crashes. BTW, If I set it to zero, I've return value, in Param cluster - NumberOfCameras = 1, but the remaining fields are empty... But, as I read in the document, I have to Set the input parameter value - number of cameras Edited July 10, 2011 by durnek60 Quote Link to comment
LogMAN Posted July 10, 2011 Report Share Posted July 10, 2011 Hi LogMAN! Thanks for your reply! I've made the modifications but my LV crashes! When I Set the Number of Cameras parameter to 1 (only I is connected currently) my LV crashes. BTW, If I set it to zero, I've return value, in Param cluster - NumberOfCameras = 1, but the remaining fields are empty... But, as I read in the document, I have to Set the input parameter value - number of cameras OK, according to the dll manual (as I read it) you have to change your cluster to an array of cluster which has the same number of elements, as the number of cameras at your system (1 element in your case). you can receive the number of cameras using the function "is_GetNumberOfCameras ()" of the dll (but for now the constant is much easier). If that does not solve the problem, try the following: Change the "number of cameras" value from U32 to I32 --> depends on how LONG values are represented in the dll. You might also try changing the data handle from "handle by value" to "pointer of handle" In the dll configuration dialog there is a tab named "Error checking", just set it's property to maximum to receive error messages from LabVIEW. LabVIEW might show an interesting message pointing to the particular problem. Note: It's recommend to change the error checking back to normal before finishing the project, maximum error checking might cause problems later. 1 Quote Link to comment
durnek60 Posted July 10, 2011 Author Report Share Posted July 10, 2011 OK, according to the dll manual (as I read it) you have to change your cluster to an array of cluster which has the same number of elements, as the number of cameras at your system (1 element in your case). you can receive the number of cameras using the function "is_GetNumberOfCameras ()" of the dll (but for now the constant is much easier). If that does not solve the problem, try the following: Change the "number of cameras" value from U32 to I32 --> depends on how LONG values are represented in the dll. You might also try changing the data handle from "handle by value" to "pointer of handle" In the dll configuration dialog there is a tab named "Error checking", just set it's property to maximum to receive error messages from LabVIEW. LabVIEW might show an interesting message pointing to the particular problem. Note: It's recommend to change the error checking back to normal before finishing the project, maximum error checking might cause problems later. Hello! I can't belive it, what causes the LV crash. I've tired with LV8.6 without any result.... Same faulire, and no error log... I did what u suggested, but I dont know how to go on... Any ideas? Quote Link to comment
LogMAN Posted July 10, 2011 Report Share Posted July 10, 2011 Hello! I can't belive it, what causes the LV crash. I've tired with LV8.6 without any result.... Same faulire, and no error log... I did what u suggested, but I dont know how to go on... Any ideas? Wow, that's a hard nut... Just as precaution: Create a second "initilize array" for the CHAR of "Model", I don't know if LabVIEW handles the array correctly. dwCameraID should be U32 Also switch back "number of cameras" to U32. Everything else seems good to me... You should play around a bit, especially with the configuration dialog of the dll. There are some options about the threading (UI thread / ... thread) - The data format (Handle by value / Pointer to handles) is also interesting. Has anybody more experience in calling dll files with structures??? Quote Link to comment
ned Posted July 11, 2011 Report Share Posted July 11, 2011 As you already discovered, you will not get the results you expect by embedding a LabVIEW array in a cluster and passing that to the DLL, because LabVIEW does not handle arrays the way that a DLL does. You will need to use the LabVIEW memory manager functions to allocate space for the array of UEYE_CAMERA_INFO, bundle the pointer into a cluster, pass that cluster to the DLL, copy the data from the pointer location into a LabVIEW array, and dispose of the pointer. Modify the attached code so that it calls your DLL correctly (I do not have your DLL so I could not fill in the name and path to it), then try it. I don't know if it will work, but if not it should be very close. is_GetCameraList.vi 1 Quote Link to comment
Jordan Kuehn Posted July 11, 2011 Report Share Posted July 11, 2011 On an unrelated note, what is your end application? It appears to me that you are having trouble getting the ueye drivers to work in LabVIEW. I have done this for use with an Edmund Optics camera and there were a few subtleties I discovered. If this information would be relevant to you, just let me know and I'll explain here in the forum. 1 Quote Link to comment
durnek60 Posted July 11, 2011 Author Report Share Posted July 11, 2011 On an unrelated note, what is your end application? It appears to me that you are having trouble getting the ueye drivers to work in LabVIEW. I have done this for use with an Edmund Optics camera and there were a few subtleties I discovered. If this information would be relevant to you, just let me know and I'll explain here in the forum. Dear jkuehn My end application is to create an LV SW that handles uEye cameas. Thats all.! I've all the uEye drivers, and works very well, and ActiveX too. But my basic problem is, how to know how many and what kind of cameras are connected to my PC. Non of uEye - Labview vis, and ActiveX methods return this value for me, so I have 2 solution left.: When a EventonNewDevice - ActiveX event is generated, I have to init and exit all camera ID,s form 0 - 254 in order to get the valid camera. I think it is very bad and slow solution.... and if I already have an opened camera that causes any further problems. So my second method is how to get the cameras is reading keys from registry. I made a VI that reads the regisry H_Key_Local_machine\.....\uEye\Enum and Parameters to get how many cameras are available. Any more functions work well in LV, but this and I think one of the most important function is_GetCameraList does not! Thats why I need some help! If u have any suggestion, please! As you already discovered, you will not get the results you expect by embedding a LabVIEW array in a cluster and passing that to the DLL, because LabVIEW does not handle arrays the way that a DLL does. You will need to use the LabVIEW memory manager functions to allocate space for the array of UEYE_CAMERA_INFO, bundle the pointer into a cluster, pass that cluster to the DLL, copy the data from the pointer location into a LabVIEW array, and dispose of the pointer. Modify the attached code so that it calls your DLL correctly (I do not have your DLL so I could not fill in the name and path to it), then try it. I don't know if it will work, but if not it should be very close. Dear Ned! I've tried your VI! Replaced the missing parameter path from dll, but nothing happens. Anyway, As I set the Number of cameas not zero nothing happens. But, the Param result cluster (that u unwired) contains number of cameras output is valid. Because I set number of cameras input parameter 0, the result is 1, and I have 1 camera connected. Sadly, on the second or the third trial, my LV crashes all the time! but generates error log. lvlog2011-07-11-10-01-55.txt Quote Link to comment
Jordan Kuehn Posted July 11, 2011 Report Share Posted July 11, 2011 durnek60: I think the first thing that would come to my mind would be the second approach you have taken, gathering the data from the registry. I have not spent any time with the dll files and cannot help much with those. I'll think about it and see if another approach comes to mind. 1 Quote Link to comment
ned Posted July 11, 2011 Report Share Posted July 11, 2011 Note that this discussion is cross-posted and continued on the dark side. Quote Link to comment
durnek60 Posted July 11, 2011 Author Report Share Posted July 11, 2011 Note that this discussion is cross-posted and continued on the dark side. Thanks to everyone Who tried to help me!!!! A solution has posted on NI forum! Thanks to everyone! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.