Wrapping arduino library into LabVIEW VI, Arduino Compiler for LabView

27th August 2015, Zilina

This document is about wrapping arduino libraries into LabView VI for purposes of Arduino Compiler for LabView. Compiler result is firmware file for arduino running on embbeded device. I hope that it's help somebody, but now it's mostly for me :)

I started looking how to wrap arduino libraries into VI, because there is already lot of existing code which is better implemented in arduino code, so why to invent wheel?

First I opened Digilent Analog Shield template to figure out how the job is done. I found library with files. After reading documentation and half hour starring on code I have clear idea what about it's going.

Empty VI which pretend to be functions implemented in arduino code

Testbench to verify functionality of VIs

Translator generate arduino code based on used VI (red ones) in project which is in end of whole compilation proces compiled

So for functions from library which we want to have as independent VI we have to create VI with input and output controls and indicators same as function. Here is one for analog shield writing values into 4 channels.

For this VI which represent each function we need to SET UP PASSWORD PROTECTION.

Programmed VI is used in Test VI, so we can open in also in Arduino Compiler for LabView and try to compile it. Here it is how it looks inside.

So everytime when some password protected VI from this library is used, LabView call Translator VI and it's getting used VI as Variant object and generating arduino code.

I made little modification to see principle of how it's whole running. So I put there my string and was watching where it will appear.

After compilation of test.vi I choosed to see generated arduino code, to watched where my string appeared.

Here is result where is clear where we can see string inside generated code.

There are also files with physical implementation and header file analogShield.h and analogShield.cpp inside libraries/ directory inside library directory.

Conclusion

Wrapping arduino library into LabView is creating empty VI with right inputs and outputs and after that creating translator. We can copy existing translator and just rewrite case and list with included header files.

After little studying wrapping library doesn't seem to be very hard, but it require little training. This feature is very useful, because there is already done a lot work which could be used.


Spat