basic understanding of Arduino library compiler | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar

Please consider registering
guest

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
basic understanding of Arduino library compiler
October 15, 2015
4:55 pm
Avatar
merin
Member
Forum Posts: 5
Member Since:
October 14, 2015
sp_UserOfflineSmall Offline

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.

October 15, 2015
5:07 pm
Avatar
filipealtoe
Admin
Forum Posts: 89
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

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
October 15, 2015
6:07 pm
Avatar
merin
Member
Forum Posts: 5
Member Since:
October 14, 2015
sp_UserOfflineSmall Offline

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.

October 15, 2015
6:44 pm
Avatar
filipealtoe
Admin
Forum Posts: 89
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

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
October 15, 2015
7:05 pm
Avatar
merin
Member
Forum Posts: 5
Member Since:
October 14, 2015
sp_UserOfflineSmall Offline

Thanks a lot. Ya I am fairly new to Labview too. I will try to understand more. Can you please tell me what all areas i have to go through to understand this more?

Like any topics in Labview which will help me understand this example more.

Thanks again

October 15, 2015
7:06 pm
Avatar
filipealtoe
Admin
Forum Posts: 89
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

I would say you should probably go through what NI calls Core 1 and Core 2.

Cheers Filipe
October 15, 2015
9:44 pm
Avatar
merin
Member
Forum Posts: 5
Member Since:
October 14, 2015
sp_UserOfflineSmall Offline

Thanks a lot Filipe

November 10, 2015
7:20 am
Avatar
Adrian
Germany
Member
Forum Posts: 21
Member Since:
August 3, 2015
sp_UserOfflineSmall Offline

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!

Forum Timezone: UTC 0

Most Users Ever Online: 33

Currently Online:
3 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

John: 18

RTSLVU: 15

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