LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using DLL in LV for a serial com

Hi,

I'm trying to implement in LV a software involving a pan-tilt-zoom motor control, which works with a pretty large communication protocol but have C++ written DLL.

I have tested the DLL with a c++ program, and it works fine, but when I try to use it in LV it doesn't work at all!

 

To start with, i'm trying to run a basic program, with 2 vis from the dll:

 

The first VI (Init.vi) Configures the serial com port receiving the name (for example COM4) and the baudrate (9600) and returns the handler for the port

The second (TiltUp.vi) vi receives the handle, and sends the packet through the port

 

The problem is that the first Init.vi doesn't seem to initialize the port. I'm using C calling convention for every vi, and running them in the UI thread.

Do you have any idea of what could be my problem? It is possible to configure and get the port handler any other way in LV?

 

Thank you very much!

Download All
0 Kudos
Message 1 of 6
(3,136 Views)

LabVIEW has built-in serial port functions.

I'd start with those before trying to use a DLL.

0 Kudos
Message 2 of 6
(3,082 Views)

nyc escribió:

LabVIEW has built-in serial port functions.

I'd start with those before trying to use a DLL.


I know, but i was trying to use the c++ library to avoid the entire protocol coding in LV...

 

I will modify the library to avoid the entire implementation of the protocol.. but using the VISA Serial lib Smiley Frustrated

 

Thank you nyc! Smiley Wink

0 Kudos
Message 3 of 6
(3,079 Views)

If the DLL already works you shold not have a big problem using functions that pass strings and numerics.  I have had to use DLL's with serial calls in them.  

 

Are you getting any error messages, symptoms ?  Have you tried using STD call convention?

 

-------
Mark Ramsdale
-------
0 Kudos
Message 4 of 6
(3,074 Views)

Did you write those VIs or did you use the Import Shared Library Wizard? If you wrote them yourself and you're asking us to verify, then you have to provide more information, such as the header file for the DLL so we can see the function prototypes, and the exact way you have configured the CLFN functions. As it is, none of that information is available from the screenshots you provided, so we cannot tell you what is right or what is wrong.

0 Kudos
Message 5 of 6
(3,061 Views)

Yes, that vis were made using Shared Library Wizard.

I solved the problem writing a simplified version of my library: A collection of functions that return the data packet, and using all the LabView serial com library to configure, write and receive that packets

 

Thank you very much for your support 🙂

0 Kudos
Message 6 of 6
(3,042 Views)