07-01-2011 07:58 AM
Hello guys,
I am trying to create a labview code that is able to acquire data from a IF2004 board (Micro-Epsilon). This is done calling the functions from the dll provided by the manufacturer.
However I've come to the point where I need to call a function, passing a pointer to a Boolean, and after it is done, read the value of the same Boolean. I looked some examples and tried to accomplish that by using the moveBlock function, but all I am getting is the 1097 error and don't know how to proceed.
The DLL function prototype is
int32_t OptoPCI_DAQ_HalfReady(uint16_t id, int32_t *HalfReady);
The Labview code written is as it follows, with the DLL and the MoveBlock function
What should I do so as to solve this problem? Thanks in advance for any help.
Solved! Go to Solution.
07-01-2011 08:25 AM
You should not need MoveBlock at all, just pass the value by pointer rather than by value in the Call Library Function Node configuration screen.
07-01-2011 08:28 AM
If the prototype is uint16 (by value) and int32 (by pointer) your dll call should only have these 2 parameters. Probably the boolean value is encoded as int32 since this must be passed as pointer.
See if the returned I32 value is what you want.
07-01-2011 09:43 AM
Exactly as said the Boolean is encoded as the int32 variable (I forgot to explain that).
I tried to just read the variable at the terminal "Half Ready out" but got no success, the value read is just equal to the one wired to "Half Ready" as an input.
Then I assumed that this value was an address and therefore used the MoveBlock function, but as a result i got the error presented above.
07-01-2011 10:02 AM - edited 07-01-2011 10:04 AM
Did you configure the dll call to pass the I32 as "Pointer to Value"? And did you remove the boolean parameter?
I agree with Nathan that you should not need MoveBlock at all.
07-01-2011 10:04 AM
Well, I imported the library, since I also have the header file, so Labview did all the configurations. Just checked your suggestion and is in that way that the function is configured, the int32 is a pointer.
07-01-2011 10:12 AM
If what you wrote in your first post is really the prototype then I don't think the LV import wizard created the call you showed in your first post.
int32_t OptoPCI_DAQ_HalfReady(uint16_t id, int32_t *HalfReady);
would have
Is your dll node configured like that now?
07-01-2011 10:19 AM
This prototype is actually the prototype showed by the library node and everything seems to be configured as you said.
So, from what I am understanding so dar, the problem is related to the declaration of the variable?
07-01-2011 10:25 AM
The error 1097 is thrown by the OptoPCI... function, not by MoveBlock, I guess.
Did you try to switch the Calling convention (stdcall / C)?
07-01-2011 10:29 AM
No, I didn't. I'll try that soon and I'll post the results here.
Thank you for the help so far.