07-10-2012 03:00 AM - edited 07-10-2012 03:07 AM
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!
07-10-2012 08:11 AM
LabVIEW has built-in serial port functions.
I'd start with those before trying to use a DLL.
07-10-2012 08:18 AM
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
Thank you nyc!
07-10-2012 08:53 AM
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?
07-10-2012 04:03 PM
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.
07-12-2012 06:59 AM
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 🙂