08-08-2011 06:47 AM
Hi,
I am trying to read Data from a frame grabber card in my PCIe slot. When I call the "Initialize" function from the .dll I got with the card I always get the error 1097. 1097 means that the function called threw an error. When I run the program that came with the frame grabber, the frame grabber still works.
If I simply omit the "initialize" function call and continue with the function, that would be called after the "Initialize" function, LabVIEW crashes(Program shuts down without any warning).
I also got a LabVIEW program that uses the dll which was supposed to work. But here I get the same error.
Do you have any idea what normally causes this behaviour and how I can solve this Problem?
Solved! Go to Solution.
08-09-2011 02:00 AM - edited 08-09-2011 02:03 AM
Yesterday I got it to run without error (LabVIEW errors that is). But the Get_Error function of the dll returned an error. I don't quite know, what to think now, because yesterday I wrote to the phytec support and they told me, that the Framegrabber isn't supported by LabVIEW anymore. Can this be right? How can it all run on LV 8 and suddenly on 2010 it ain't working anymore?
Now, this isn't my most urgent problem, because another problem popped up:
Neither the program that came with the frame grabber nor the VI I wrote yesterday will start. When I open the VI LabVIEW freezes for a few seconds and then it just shuts down without warning.
08-09-2011 07:49 AM
Hello,
it sounds that something has crashed LabView on your PC. Try to go to the system control where all the programms are listed which are installed on your system. Then open National Instruments. Now a new window is opend where you can choose your LabView Version. After that click on repair.
Maybe this will solve your problem. If not I think that you need to reinstall LabView.
For your problem with your frame grabber there are several options you can do.
1. You can programm yourself a driver for the hardware from Phytec.
2. Ask Phytec which version of LabView is supported. Then you install the old version and use this for your device.
3. You buy a device from National Instruments. Then you can be sure that it will be supported. Also in the future.
4. Search a driver for your device on http://www.ni.com/devzone/idnet/.
Regards
08-09-2011 08:28 AM
Thanks for the reply.
Since repairing LabVIEW alone didn't help at all, I repaired everything from NI. When I replaced the apparently broken dll with the original one, I could at least start my main.vi again.
Your suggestions sound good, but:
1.: No, I can't. I could start, but that's about as far as I'd get.
2.: When asking them, they told me LabVIEW was no longer supported and erased the VI from their server... Really nice people...
3.: If you know one: Consider it bought. I'd be glad if you could tell me which NI card can record the signals from 4 cameras simultaneously. I haven't found one, maybe I overlooked it.
4.: Neither the company Phytec nor the PCI Grabber came up with any ansers at all.
08-09-2011 11:25 AM
Are you sure that you are calling the DLL function with the correct parameters? If you post your code, along with the DLL documentation and header (.h) file - or a link to them - we might be able to help find the problem.
08-09-2011 11:45 AM
I second nathans post. Error 1097 is almost always an error in configuring the Call Library Node right. And in some cases there is no right way to configure and you need a wrapper DLL to convert between what the Call Library Node allows and what your DLL requires. The reason that it sometimes works and other times not, is in fact that it never really works, but sometimes the error that gets caused can not be detected by the OS and LabVIEW does not get an according exception. This can change depending on LAbVIEW version, runtime or development system and even recompilation of the code after small seemingly unrelated changes to the application.
08-10-2011 12:52 AM
The thing is:
I don't have many options left to configure e.g.: there's one function called void initialize (uint_16t nDevNo) so I call it configuring it accordingly. The only thing I could change is the calling convention. When I set it to C I got the 1097 error. When I set it to stdcall I think it destroyed the dll. I had to replace it to make the VI start again.
When I looked at the dll before I baught the grabber card, I paid attention if there were any "funny" variables, like unions, structs or Arrays of pointer to union of struct, because I had Problems with stuff like that before. The dll is really simple basically, so I don't quite get why it shouldn't work. As you said: the reason it sometimes works and sometimes not is because it never really works...
Today I am going to send back the frame grabber and order another one that's supposed to work with DirectShow... Hopefully that turns out better.
08-10-2011 01:40 AM - edited 08-10-2011 01:44 AM
@jak888 wrote:
The thing is:
I don't have many options left to configure e.g.: there's one function called void initialize (uint_16t nDevNo) so I call it configuring it accordingly. The only thing I could change is the calling convention. When I set it to C I got the 1097 error. When I set it to stdcall I think it destroyed the dll. I had to replace it to make the VI start again.
When I looked at the dll before I baught the grabber card, I paid attention if there were any "funny" variables, like unions, structs or Arrays of pointer to union of struct, because I had Problems with stuff like that before. The dll is really simple basically, so I don't quite get why it shouldn't work. As you said: the reason it sometimes works and sometimes not is because it never really works...
Today I am going to send back the frame grabber and order another one that's supposed to work with DirectShow... Hopefully that turns out better.
Well a frame grabber surely has more complex functions than "void initialize(unsigned short)". How would you get otherwise the grabbed image in LabVIEW. If this function alone already bombs (sorry for the old Mac reference), well then this DLL surely is worthless. It could be that you need to pass a valid device number of course, but such a simple function that attempts to corrupt memory when passed an invalid parameter is simply rubbish.
Usually the problem starts with other functions. And it's not only the problem with the complicated data types. A simple byte array can cause that error too. Lets assume you have instructed the frame grabber to return an image of 1024 * 800 pixels in RGB 8 bit format. When you call the grab function, it will want to write the image data into a memory buffer. And someone needs to provide that buffer. And LabVIEW not having mind reading capailities can not do that for you. So you need to know how the function will try to store the image data in the buffer. Each pixel would require at least 3 bytes. Maybe 4 if they store it in RGBx format, since that is easier to align in memory. Then the grabber may also add a border around the image. This could be anything from 0 to several pixels on each side. And last but not least it may add a header with image information before the image pixels.
So you get x + (1024 + y) * (800 + y) * 3 or 4 bytes. This buffer needs to be allocated by you on the diagram and passed to the DLL function.If you happen to not allocate that buffer or make it a few bytes to small the DLL function will attempt to write into memory that has not been allocated for that purpose. It could not be allocated at all for the current process in which case the CPU will raise an exception, and LabVIEW will report the 1097 errror or it could be allocated for something else in LabVIEW and sooner or later LabVIEW trips over that corrupted memory and does something weird or crashes, causing itself an exception that could cause the 1097 error. Sometimes the error only makes itself apparent when you close LabVIEW and it tries to properly deallocate all its memory blocks, stumbling eventually over some corrupted memory pointer your DLL has caused.
A frame grabber may support different image formats so your grab function would also need to be flexible enough to account for that too.This all is why writing a frame grabber interface for LabVIEW (or any other programming language) is usually a much sought something but seldom gets done by anyone in a way that really works.
08-10-2011 02:34 AM
Hello,
The best way to find out which is the hardware you need is when you contact National Instruments.
Here is the link where you can find a telephone number or an email address:
http://sine.ni.com/apps/utf8/nicc.call_me?loc=en-DE
Regards
08-10-2011 02:52 AM - edited 08-10-2011 02:55 AM
Unless the OP wants to use some digital interface, there is no NI hardware anymore, that is recommended for use in new applications. NI has discontinued all analog frame grabbers or at least put them into "not recommended for new applications".