Porting C libraries | Arduino Compatible Compiler for LabVIEW Discussions | Forum


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 4 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Porting C libraries
March 24, 2016
8:15 pm
Forum Posts: 16
Member Since:
August 5, 2015
sp_UserOfflineSmall Offline

Hi there,

If its possible to port existing Arduino Libraries as illustrated in the user guide, does this suggest that it is possible to wrap any C program or subroutine in a Labview wrapper, and to pass & receive parameters into and out of it by means of a labview VI, or am I misunderstanding something?

If possible does anyone have an example of how to accomplish this?

March 29, 2016
11:09 pm
Forum Posts: 21
Member Since:
August 4, 2015
sp_UserOfflineSmall Offline

Hi tronron,

yes you are understanding it right. Arduino itself is pure C++, with all libraries written in C++ and when you hit upload button, there are at first added some blocks of code (not too much, it's really only few lines of code), then it's compiled by avr-gcc and then uploaded into arduino by avrdude. LabVIEW Compiler for Arduino is on the other hand transcriptor what means, that your code which is described by VI blocks is transcripted into arduino sketch and then compiled by avr-gcc... So when you are porting existing library for arduino or something else, you are telling LabVIEW Compiler for Arduino how to transform your block into C++ commands.

So to answer your question, you will be able to wrap any C program or subroutine which you are able to compile by avr-gcc into LabVIEW VI and then you can use it. The translator VI is the one which holds information how to transcript user defined VIs into C++ code, so you have to put your code into it to right places. I cannot provide exact manual how to do it (or I could but probably it would be any book about C++ :D), because it depends what you want to reach and there are always different ways how to do it i.e. simplest one is when you already have your running code and you have .h file and you just port most important functions for LabVIEW compiler.

Assume that you have some FFT library and you want to have in LabVIEW FFT VI. So what you can do is create C++ wrapping class/library for these FFT functions, which would be used like glue between FFT functions and LabVIEW let's say 'double* computeFFT(double* samples)' and then just simply port this intermediate library into LabVIEW compiler. If you want to port something little more complicated than blinking with LED or making sound with PWM it's good to have some experience with C/C++.

So it depends on what you want to do, but I have to say that everything is possible (but sometimes it takes too much coffee :D).

Forum Timezone: UTC 0

Most Users Ever Online: 33

Currently Online:
1 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

John: 18


Dan6077: 11

Member Stats:

Guest Posters: 0

Members: 80

Moderators: 0

Admins: 3

Forum Stats:

Groups: 1

Forums: 2

Topics: 58

Posts: 289

Newest Members: Travlissah, viktorIcera, HowardClouG, Dianecet, Produktnaodchudzaniex

Administrators: geadmin: 5, filipealtoe: 35, Steffan: 89