LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with implementing a 32 resp. 64-bit dll to LabView 2013 13.0f2

Solved!
Go to solution

Sorry for my late answer, but I had to do a practical lab course during the last weeks.

 

I tried to get used to C by working through a tutorial. I will test if my new "skills" helped and will post the new VI as soon as possible.

 

Thank you very much for your help!

0 Kudos
Message 11 of 15
(847 Views)

As the ReadPositionFunction did not work after many tries, I wanted to test a even simpler and more basic function, the "FindDevices"-Function.

 

I used the Dll-Wizard to create an appropriate VI. The problem is even this VI does not work and constantly gives Error 1097.

Although I think that a number of type "long" in C means that it has 4 bytes or 32 bits, I tried out to change representation of "DeviceCount"  in every way from 8-bit-unsigned to 64-bit signed. I also changed the Calling convention to WINAPI, only to see if that is the problem. But it did not help. Next (just to try out), I changed the "Pass Type" from "Pointer to Value" to "Value", even if the header implies that the function refers to a pointer (if I got the "&" right).

 

So what can I do now, to get this most basic VI to work?

 

To be sure that the VI is not broken, I also tried the "SelectDevices"-Function. In this case, I don't get any error message. However, I am not sure ,how the function return is supposed to return "True" if it is a 32-bit integer, but a string did not change the result either.

 

 

PS: Is there maybe any option to include a working .exe in LV? 😉

Download All
0 Kudos
Message 12 of 15
(803 Views)

I only have LabVIEW 2011 on this computer so can't look at it for the the moment. Those functions are all a bit troublesome since they use the C++ reference parameter syntax, which by all compilers I know of should be simply implemented as pointer parameter but there is no guarantee for that.

 

However, a first trial would be a Call Library Function Node with one parameter.

 

return value: int32

1st parameter: int32 passed as pointer to value

 

if this still gives you an error 1097 the only other thing I can think of would be to try and change the calling convention. If neither of these helps then the function is not callable through the Call Library Node.

 

A boolean is indeed just true and false but depending on the definition is always at least a byte. The C++ bool is generally implemented as byte where the value 0 is false and anything else is true, but C/C++ explicitedly does not define the exact size of its datatypes but leaves that decision to the compiler builder. The WinAPI BOOL is a 32 bit integer with the same semantics. Other APIs can define their own boolean definition which can be anything that the underlying C compiler can implement as addressable identity (meaning for almost all modern CPU architectures it needs to be at least a single byte or more. Some CPU architectures for instance have a performance penalty for byte accesses that are not aligned to their natural register size).

Rolf Kalbermatter
My Blog
0 Kudos
Message 13 of 15
(794 Views)

My present VI uses

Return Value: Int 32

1st Parameter: Int 32, passed as pointer to value  (both Types are "numeric")

 

I tried to use first "C" and then "stdcall(WINAPI)" as Calling convention, but i got the error 1097.

Message 14 of 15
(782 Views)
Solution
Accepted by topic author MrKSE

So finally I implemented the device in LabView.

I used the trinamic motor control language via VISA Write/Read. I did not know that this motor used that language, but in the end the vendor told me.

 

Thank you for your help!

Message 15 of 15
(744 Views)