LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use C/C++ code with ComapctRio 9104 RT controller?

Hi,
I am new to the use of CompactRIo.I have Compactrio 9104/9004 device.I want to use C/C++ code with the 9104 RT controller i.e. after i have written that code can i download into that the CRio 9104 target.If it can be done can anybody explain please?

Regards,
Vishnu
0 Kudos
Message 1 of 11
(5,092 Views)
Hi Vishnu,

I am assuming you are talking about the cRIO-9014 controller.  The cRIO-901x series controllers run VxWorks where C/C++ code can be compiled to .out files.  This is opposed to the cRIO-900x series controllers which run Pharlap and run C/C++ code compiled into .dll files.  Both .out and .dll files are called 'shared library' files, which can be called from LabVIEW.  More information about compiling .out files can be found by following the links below.

Calling External Code on cRIO-9010 Series Controllers
Developing Shared Libraries for the cRIO-901x and Other VxWorks Targets

For more information on calling shared library code from LabVIEW, consult LabVIEW Help » Fundamentals » Calling Code Written in Text-Based Programming Languages » Concepts » Using External Code in LabVIEW, and NI Developer Zone: An Overview of Accessing DLLs or Shared Libraries from LabVIEW.

Please let me know if you have any other questions, thanks Vishnu!

Regards,
Erik J.
Applications Engineer
National Instruments
Message 2 of 11
(5,064 Views)
Hi,
I am sorry i said to you the wrong controller number, the controller i am using is the Crio 9004 and the chasis is 9104.Can i use C/C++ code with the 9004 embedded controller, if so please tell me how to do that?

Thanks,
Vishnu
0 Kudos
Message 3 of 11
(5,033 Views)
Hi Vishnu,

The cRIO-9004 controller can run C/C++ code, but the code must be first compiled into a DLL.  You would need to call the DLL from LabVIEW RT.

To make sure your DLL is compatible with RT, you can use the Real-Time DLL checker found here:
How Can I Verify that My DLL is Executable in LabVIEW Real-Time?

Next, you'll want to ftp to your controller and put the DLL file in the system folder.  This will cause the DLL to load into memory at boot so you don't have to specify a full path in the Call Libaray Function node, just the DLL file name itself (see attached image).  Alternatively, if you're building an executable, you'll want to include the DLL in the build.

More information on using the Call Library Function node can be found here:
NI Developer Zone: An Overview of Accessing DLLs or Shared Libraries from LabVIEW.  Or in LabVIEW Help » Fundamentals » Calling Code Written in Text-Based Programming Languages » Concepts » Using External Code in LabVIEW.

I hope this helps!

Regards,
Erik J.

0 Kudos
Message 4 of 11
(5,007 Views)
Hi,
Thanks Eric,
Now i will proceed with my work.If i get any problems i will disturb you again.
Regrds&Thanks,
Vishnu
0 Kudos
Message 5 of 11
(4,978 Views)
You're welcome Vishnu, good luck!

Regards,
Erik J.
0 Kudos
Message 6 of 11
(4,890 Views)
Hi,
I am not able to access the link How Can I Verify that My DLL is Executable in LabVIEW Real-Time? and also i have started how to develop a dll file from C code.Weather  the dveloping a dll would be different  for RT target than use in  LABVIEW.Once i have dll file can you little bit explore how to load it into Crio 9004 RT controller? weather it is the sam eway we use in LABVIEW ? or is there any other way?

Thans and Regards,
Vishnu
0 Kudos
Message 7 of 11
(3,711 Views)
Hi Vishnu,

I'm sorry I posted the wrong link, here is the correct link to verify your DLL will work in LabVIEW Real-Time.
How Can I Verify that My DLL is Executable in LabVIEW Real-Time?

You call a DLL from LabVIEW Real-Time in the same way you call a DLL from LabVIEW - using the Call Library Function Node.

Once you have your DLL file, you can call it from LabVIEW Real-Time on your 9004 RT controller.  There is extensive help documentation on how to do this, please see the link below to the LabVIEW help.
Calling Code Written in Text Based Programming Languages

Also, we have a great whitepaper written on how to call C code built into a DLL from our Call Library Function Node.  This is a very useful whitepaper and is located here:
Can LabVIEW C?

I hope this helps!
Regards,
Erik J.

0 Kudos
Message 8 of 11
(3,672 Views)
Hi Eric,
Thanks for the all the information given by you.I have written some simple programs in C and able to create DLL's and executed in LABVIEW and also in RT controller.When executing on RT controller i just showed the path.Instead of that as you was saying if we can transfer the file to memory of RT controller by FTP means simply we can specify the DLL name.Can you exaplin a little bit how to put the created DLL in RT controller memory before we use it for execution?

Thanks and Regards,
Vishnu.
0 Kudos
Message 9 of 11
(3,654 Views)

Hi Vishnu,

The Real-Time Engine has an FTP server that can be accessed using any FTP utility.  For some specific information on how to download from and upload to an RT target, take a look at our Developer Zone article, FTP Options with LabVIEW Real-Time, and the Knowledge Base article, FTP Transfer of Files Between Host and Real-Time Targets in MAX.

Let me know if this helps.

Regards,

Lauren

Applications Engineering
National Instruments
0 Kudos
Message 10 of 11
(3,617 Views)