8:15 pm
August 5, 2015
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?
11:09 pm
August 4, 2015
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).
15
1 Guest(s)