LubomirJagos / LabVIEW-Universal-Transcriptor

Simple LabVIEW diagram parser with hooks provided to user to define own transcription process. For now target platform would be Arduino.
GNU Lesser General Public License v2.1
14 stars 6 forks source link

What’s this?

Have you every imagined when working in LabVIEW it would be cool have some tool to translate your code for some embedded device? Yes.. this is what you wanted, I know that, because I think about the same for long time until I finally implemented it. This is transcriptor (on internet also mentioned as transpiler) from LabVIEW to C++ for Arduino, ie. it takes as input VI and returns it’s C++ representation which is possible to deploy to embedded devices. It’s exactly as it’s written. There are some extra steps which has to be done to get right code in the end, so I programme them and test them to create basic customizable tool to translate LabVIEW diagram into requested form. To show basic principle imagine blinking led diode program below translated into some structured C++ code for Arduino.

LabVIEWforKids Blink Program

So if you implement some basic structure transcription process to translate diagram into code plus add some needed small function which handles tunnels, shift register you can somewho generates any code from LabVIEW. It sounds quite easy it’s not rocket science :D but still there are some mistfalls, luckily they are shallow….. long story short, I made this to you to avoid them and show you how to do that and provide you some tool hopefully useful for you.

Why “Universal”

Because you can scale it into width and also into deep :D Simple said you can add you own libraries and extende its functionality or modified it’s source to transcritp into another target platform language. All dis up to you. There are some chapters about creating own transcriptior dictionary, I tried to make easy for you, so you have to just create in folder with your Vis translator VI and that’s all. I also implemented some special features, killer features, you can create your own classes and use own color for wires! And there is more…. (at least my faviourite test program on picture below).

LabVIEWforKids FFT Program

As written above, you can define your own libraries, but still, you can modify whole transcriptor (I prefer way to add folder into Transcriptors/ folder number 3,4 or anything else, copy basic frame and starts to modify) and target it to any language, as proof of concept my option is C++ for arduino to show how to translates diagram for it.

There is performance issue, transcripted code cannot be faster than hand written

True and false at same time. Always depends on programme application. I wanted to show you that’s it’s possible to transcript LabVIEW diagram into C++ (but that we all know, because NI is doing this for years), but mostly to create xample application. Generated code has one advatage and that’s it has same structure over whole application which means it’s really easy to do some analysis and optimalization afterwards. So at first stage I concerd mostly for functionality ignore performance question, these should be handled by some code optiamlizators after transcriptor proces.

Implemented functionality

Let’s starts with something positive :) To gain your attention I would like to introduce thorought this whole document conecpt and implementation of my transcriptor for LabVIEW VI into target platform code, for beginning chosen C++ because of Arduino. Really, I’m not lying, this is it and it’s here to show you how to done this. So quick review what implement this transcriptor, in other words what could be seamlessly transcripted into C++ code:

Then there is pallete ”Translate tools” which holds result this whole effort, there is located whole transcriptor written into one sub vi, calling it and passing it reference to VI which we want to transcript is all what we have to do. Last pa section in pallete called “Scripting” contains Vis used to build this whole transcriptor, they can be used in users Vis to improve this whole tool. This is basic functionality which is making this transcriptor usable to transcript at least VI “Hello world” and prove concept functionality. Transcriptor can be also extended by user and I interfaced into this transcriptor some another arduino libraries to make it useful at least for playing, to hold your attnetion they are:

LabVIEWforKids early fun