From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C Code Generator and Pic Microcontroller

Hello everyone,

I found couple threads discussion on how to use C Code Generator from LabVIEW to create code that could be compiled to HEX and programmed into Pic Microcontrollers.

However, it seems that no one had sucessfully achieved that. I believe that assignig IO, config header and oscillator frequency should be challenging.

Does anyone could provide me any information on how to proceed to achieve that? I wrote a simple VI and converted it to C using the C Code Generator, but I have no idea what I have to adjust into C code in order to have it working on my Pic Microcontroller.

Thanks,

Dan07.
0 Kudos
Message 1 of 2
(2,869 Views)

Hi Dan07, 

 

I see no one has commented on this for a few days so I'll throw my 2 cents in. The limited experience I have with the c code generator is pretty much to not use it. LabVIEW does a lot of things for you that would result in a runtime error for C code. An example of this is accessing an array outside of it's index, normally this will give you a runtime error in C,whereas, LabVIEW will just return a zero. 

 

I found there's a lot of that going on in the background so going through the code to try and extract your algorithms or changing specific parts can be really challenging. Personally, I'd get a cRIO to run LabVIEW programs natively or just write your code in C to begin with.

 

There are a few tutorials to get you started with the C code generator. Linked below, I guess if you have to go down that route they'll be your best starting points? 

 

http://www.ni.com/tutorial/11784/en/ 

http://www.ni.com/pdf/manuals/373192a.pdf 

 

Sorry I can't really help with this one 😕

 

Thanks 

Daniel Harryman MEng
CLA, CPI
0 Kudos
Message 2 of 2
(2,808 Views)