![]() |
|
|
we have multiple mp-lab programs that we would like to use in labVIEW. help please
Hi kilroywashere,
I’m assuming that when you say mp-lab programs that you mean C programs written in Microchip’s MPLAB Integrate Development Environment (IDE). You can definitely call C code from LabVIEW. One of the easiest ways to achieve this is to create a DLL out of your C code and then to call that DLL with the Call Library Function Node in LabVIEW. Just remember that C code specific to a microcontroller won’t port well into LabVIEW. (For example, accessing the digital pins on a microcontroller wouldn’t make sense in LabVIEW.) Algorithms and functions can be easily accessed though. I will post a specific example shortly.
Regards,
Kevin Stuart
Applications Engineer
National Instruments
For a specific example, please view the tutorial "[d-1690]" under the Documents tab. (Note: See below for how to use C code on the cRIO.)
There are two items of note with regards to using C code in LabVIEW.
First, it may be easiest to recode your C algorithm in LabVIEW instead of trying to use LabVIEW and C together.
Second, the link above explains how to use a DLL in LabVIEW, but this method will not work for the cRIO controller that FRC will be using.
In order to compile C code for the FIRST cRIO controller, a specific compiler has to be used. The operating system that comes on the FIRST cRIO controller is called VxWorks, and if you have access to your C source code, you can rebuild it in the VxWorks development environment in order to use the C code on the cRIO. This article talks specifically about this process.
Regards,
Kevin Stuart
Applications Engineer
National Instruments
