LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using an external DLL with "Call Library Function"

Hi!
I am trying to use an external DLL which is used from Visualbasic & Delphi:
http://www.keb.de/common/tools/KEBCOMDriver.zip
the protKEB.dll accesses the serial port to control an KEB frequency
inverter.
Unfortunatly there is no prototype header file for the DLL (no help on that
from KEB).
I only have a VisualBasic example program which works with the DLL.
(Unfortunatly I am no Visual basic expert)
To initialize the com port I have to use the function: setprotproperties &
getprotproperties

they are declared as:
'Setting the protocol properties
'ctrl is a pointer to a data structure of type tProtProperty
Declare Sub setprotproperties Lib "protkeb.DLL" (ctrl As Any)

'Reading the protocol properties
'ctrl is a pointer to a data structure of type tProtProperty
'the desired protocol is entered in ctrl.prottype before calling
Declare Sub getprotproperties Lib "protkeb.DLL" (ctrl As Any)

and tProtProperty is:

Public Type tProtProperty
ProtType As Long 'Type of Protocol (tProt)
TimeOut As Long 'ALL protocols
Baudrate As Long 'ANSI, HSP5
Comport As Long 'ANSI, HSP5
Flag As Long 'ANSI, HSP5: 01 = Sendslow
/ IP: 01 = UDP
Port As Long 'IP:Port number
Txtlen As Byte 'IP : length of following
text or 0
txt As String * 100 'IP : IP-Address or name
(maximum length)
End Type

I already tried to use a cluster with tProtProperty entries as an Input for
the function
setprotproperty in a call library function with:
Parameter Type : Adapt to type
Data Format: Pointer to Handle
but I always get an "exception within external code....."

What am I doing wrong?
How does a cluster & a "call library function node" look like that works?

Any help is really appreciated!

thanks
tom
--
,-Thomas Kerberger Physikalisch-Technische Bundesanstalt-.
| Abbestr.2-12 D-10587 Berlin fon: +49-30-3481338 |
| mailto:thomas.kerberger@ptb.de fax: +49-30-3481386 |
`--------Labor 7.33 Messung thermischer Energie---------'
0 Kudos
Message 1 of 2
(3,038 Views)
Thomas,

LabVIEW cannot call a DLL that has structures directly, you will need to create either a wrapper DLL or CIN that will take in all of the data individually construct the structure, and send it to the DLL function.
For more information on what a cluster looks like in native code, I would suggest creating a simple cluster, creating a Call Library Function Node on the block diagram with a cluster input. Then right-click on the Call Library Function Node and choose "Create .c file". This will generate the data structure for the cluster and give you a better feel for it. I would then suggest going to the Using External Code in LabVIEW manual that can be found in the LabVIEW Bookshelf (Start»Programs»National Instruments»LabVIEW 6»LabVIEW Manuals or »LabV
IEW 6.1»Search the LaBVIEW Bookshelf).

There is also the following: Developer Zone: Passing a Variety of Data Types from DLL to LabVIEW.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 2
(3,038 Views)