Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Letting a DLL open a com port within LabView causes problems

Hi
I have a simple VI, which only have a Call Library Function attached, configured to start a Service within the DLL which Initialise a external product via RS232 commands. The DLL Function returns a Boolean value, which indicates a success/fail operation. No parameter is needed as input. When I run the VI the DLL reports �Set_Comport_Failed� which indicates that the COM port is either not present or another program use that comport. The strange thing is that I have a GUI, which uses the same DLL without any problems. When I run the VI there are no other programs using the COM port. I was told that the function I call is the first thing I have to do when the DLL is loaded. How come that there are difference
s in which program calls the DLL (GUI or LabView) and how the comport is initialised? And can anyone tell me what I have to do before I call the DLL from LabView in order to get it to work?
0 Kudos
Message 1 of 5
(3,406 Views)
Calling a DLL in LabVIEW is simple. It is possible that the error is being caused by sending the incorrect parameters to your DLL. You do not need to include header files or library files. Take a look at the hostname.vi example for LV 7.0. All you need to know is the name and location of the DLL along with the parameter list and return type. LabVIEW should not operate any different than other programming languages. Some times it is hard to figure out how to pass information from the LV API to the DLL in the case of pointers. Here is a link shows many of the different ways to pass data.

http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3E78F56A4E034080020E74861&p_node=DZ52065&p_submitted=N&p_rank=&p_answer=&p_source=External

For m
ore information on passing information from DLLs to LabVIEW check out this link. http://zone.ni.com/devzone/devzone.nsf/webcategories/E2A99E7E10D5725D862567AC004F0A53?opendocument&node=dz52048_us

Have you tried using the LabVIEW serial commands to communicate to your instrument or tested it with Measurement and Automation Explorer.

I hope this helps out,
-Joshua
0 Kudos
Message 2 of 5
(3,406 Views)

I've got exatly the same problem here with LV2011 and a .NET dll.

The com-port cannot be opened inside labview. If I use a command-line program which uses the same .dll, the com port can be opened.

Is there any solution?

0 Kudos
Message 3 of 5
(2,911 Views)

You have not provided nearly enough information. You can provide the provider of the .NET dll and what properties and methods you are calling and how. Also report what sor t of errors you are getting. Provide details on the command line program and a copy of your LabVIEW code. Hopefully someone will have used the same hardware/software and can help.

 

p.s. You do not exactly the same problem and you should have posted a new thread instead of hijacking this old one. The original thread refers to a C type dll and the call library function node.

0 Kudos
Message 4 of 5
(2,907 Views)

Hello.

Sorry, I'll open a new thread.

0 Kudos
Message 5 of 5
(2,901 Views)