LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RT, calling serial port using a C-DLL?

Is it possible in RT to directly call the serial port (not using VISA or Serial) using a C-DLL?
I have existing C-code for a xmodem protocol and I'd like to build a DLL from this.

Greetings,

VDB
0 Kudos
Message 1 of 9
(3,683 Views)

You can call a C DLL from Labview using the Call Library Function Node found in the Advanced function palette.  There are many things to be aware of.  Like an int in C is a I16 in Labview and such.  You cannot pass Labview strings into a C DLL without first converting the string into an array of bytes(U8).  Clusters and C-structures don't quite match up, some things to learn here also.  Go to the NI website and search for "DLL".  You will see links to many white papers and such that can get you started.

I am assuming that RT has the same Call Library Function Node function call available as regular Labview.

If you are having problems, list your DLL parameters and I will try to match them up to Labview types.

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 9
(3,670 Views)

You can call a C DLL from Labview using the Call Library Function Node found in the Advanced function palette.  There are many things to be aware of.  Like an int in C is a I16 in Labview and such.  You cannot pass Labview strings into a C DLL without first converting the string into an array of bytes(U8).  Clusters and C-structures don't quite match up, some things to learn here also.  Go to the NI website and search for "DLL".  You will see links to many white papers and such that can get you started.

I am assuming that RT has the same Call Library Function Node function call available as regular Labview.

If you are having problems, list your DLL parameters and I will try to match them up to Labview types.

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 9
(3,670 Views)
The problem is not the usage of the DLL, it's the low level direct access to the serial registers without using VISA.

VDB
0 Kudos
Message 4 of 9
(3,659 Views)

How low-level?  If you're thinking of calling Win32 API, you _might_ be able to since RT's OS, ETS, by Phar Lap does support a _sub_set_ of Win32 API.

-Khalid

PS:  Why do you want to do this?  I.e., what's the reason for not using VISA... just curious... 

0 Kudos
Message 5 of 9
(3,655 Views)
Hi,

low level = port in, port out. The code I already have is communicating with the serial port on this level.

VDB
0 Kudos
Message 6 of 9
(3,654 Views)

I am afraid I do not know if that'll work or not.  The sure-shot way would be to test it out.

-Khalid

0 Kudos
Message 7 of 9
(3,637 Views)
If the code you already have is making DLL calls for low level functions and it is working, there should be no difference who or what is making the DLL calls.  Whether you use VB or C or Labview as the top level program, it should work the same.
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 9
(3,634 Views)

Right, but the issue is whether this low-level DLL itself will work on RT. 

-Khalid

Message Edited by Khalid on 03-22-2006 10:03 AM

0 Kudos
Message 9 of 9
(3,632 Views)