NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

This Question is Possibly Answered

2 Replies Last post: May 12, 2008 3:24 PM by Kevin_S  
kilroywashere   1 posts since
May 8, 2008
Currently Being Moderated

May 8, 2008 2:57 PM

how do u get line c into a labVIEW program

we have multiple mp-lab programs that we would like to use in labVIEW. help please

Kevin_S NI Employee 19 posts since
May 6, 2008
Currently Being Moderated
May 9, 2008 4:43 PM in response to: kilroywashere
Re: how do u get line c into a labVIEW program

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

Kevin_S NI Employee 19 posts since
May 6, 2008
Currently Being Moderated
Jun 6, 2008 6:33 PM in response to: Kevin_S
Re: how do u get line c into a labVIEW program

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

More Like This

  • Retrieving data ...