4:55 pm
October 14, 2015
Hi I am very new to Labview and Arduino Labview compiler. I am trying to do the Digilent analog example. I have problems in understanding how the template is mapping to our api.
So what I have understood so far for porting an arduino Library to labview is step1) download the library we want. step2) understanding which all functions we want to port. Step 3 creating password protected VIS for the same. Step 4 is confusing, these are my doubts
How is the translator vi connected to the api we created? for new libraries we want to add, we just change the case structure in template and just include libraries?
Please help me with this. I am fairly new and I am learning how to do.
5:07 pm
March 12, 2015
Inside the Translator vi you just rename the cases to match the name of the API VIs you created. For instance, if you have an API VI named clear in library named X; you need to have a case named X.lvlib:Clear. Inside that case, you will need to map the C-code call of the corresponding clear function from the Arduino library. The best way to understand the connection is to pick one case of the Digilent Translator VI; look at the C-code inside and see how the same function is being used in one of the Digilent C-code examples that ship with the library.
Hope this helps.
Filipe
Cheers
Filipe
6:07 pm
October 14, 2015
Thank you Filipe for your reply,
I still have few more doubts...
How is translator VI connected to the API we created? What are those inputs in Translator VI? I understand based on our function definition in c program we have to connect the case structure to the respective input and output.
In the format into string vi where do we get the function name analog.write? or analog.read etc? is it from the .cpp file or from the arduino main file?
And the VI for Write two channel.vi write four channel .vi etc in the block diagram all that is there is the those input and output values but no wiring, i understand that is happening in the translator vi, is that right?
It will be great if you can explain all this. thanks a lot.
6:44 pm
March 12, 2015
The Translator VI is just a wrapper. What you need to worry about is that it has cases in its case structure matching each of the API VIs you create; like I mentioned on my previous post.
The analog.write is the C-code API function that implements the AO write as used on Digilent's example code. You don't need to map the underlying intermediate functions from the .cpp file that will implement the analog.write for example, just the high level API functions that are exposed by the library and used on its example code (analog.write, analog.read, etc).
For the API VI in/out terminals, you need to map them to the number of in/out variables in the C-code for the corresponding function you are trying to port so you have an one-to-one correlation between them. That way the in/out terminals map correctly to the underlying C-code line in/out variables you have inside the case statement.
I have a feeling your difficulty may be related to lack of familiarity with LabVIEW itself. The porting of Arduino libraries is probably the most advanced feature of the compiler product. You may want to spend some time familiarizing yourself more with it and LabVIEW in general before tackling such an advanced feature.
Filipe
Cheers
Filipe
7:20 am
Hi @all,
the C-code API function is a very good tool to use external C-code in the Arduino compatible Compiler for LabVIEW. It doesn't make a difference between Arduino library code or your own c-code.
Last weekend i try to use this function and i would like to post my experiences.
My first test was a bit difficult. I did all steps in the manual but it didn't work. At first the compiler couldn't find the API VIs. -> my first solution was to hit the password protection -> at this time the compiler find all my API VIs but in the c-code display the result was......definitely wrong!
My first problem was the connector panel. I didn't know the element index of my inputs and outputs. I wrote an VI that checks all frontpanel elements and put the element index out of my API VIs. But these element indexes are not the same indexes for the C-code API function...:(.
The C-code result was always wrong. So i delete all my API VIs and i started from the beginning.
I used the template again and worked step by step. The result was wrong too.
My last solution was the mass compiling function. After that it works properly. The C-code result was right and all API function were available. Now the password protection for the API VIs works properly too.
So all in all i had ported some more functions of my own C-Code and now it works really fine.
I think the mass compilation was the solution of my problem.
Maybe this can help other users.
Good luck and much fun!
7
1 Guest(s)