LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with call node function for a calling an external c dll file

i am trying to make a delta robot. i used a c code for  the kinematics of the robot and created a dll file to use in labview. i found the c code online http://forums.trossenrobotics.com/tutorials/introduction-129/delta-robot-kinematics-3276/.

 

i have attached the VI and also the c file i am using.

but it doesnt work. the servos dont move and the program gives an error. i have attached the necessary files. i do not have any experience with calling function node and i know i am doing something wrong but i cam completely stuck.

 

can someone tell me what to do?

how can i correctly implement the function node. 

 

when i used a similar arduino code(from trossen robotics), it worked perfectly. but with labview i am not getting anywhere.

thanks

Download All
0 Kudos
Message 1 of 9
(4,208 Views)

You got it backword.

You should define IO in LabVIEW, wire to the CLFN.

Right click on it to generate a c prototype.

Finish the c code, and compile it into a dll.

Load the dll into LabVIEW.

 

George Zou
0 Kudos
Message 2 of 9
(4,203 Views)

could you elaborate more.

 

I right clicked on CLFN to 'create a c file', But when i load my code in it and build it, it gives error. and then how will i convert it into a dll file.

 

 

 

why is doing it this way necessary?

0 Kudos
Message 3 of 9
(4,181 Views)

> why is doing it this way necessary?

To make sure data pass from LabVIEW to dll correctly.

 

> how will i convert it into a dll file.

Create a project in your C compiler, build into a dll.

How did you do it before?

 

 

George Zou
0 Kudos
Message 4 of 9
(4,166 Views)

this is how i followed your instrucions:

 

1- i created a CLFN block diagram

1a- double clicked it to add library path.

 

i used the dll file i had alreay created from 'inverseKinematics.cpp' so i could select the function for each CLFN i have in the VI.

 

2- defined input, output

 

3- right clicked it, then clicked on 'Create C File', saved it as code.c 

4- opened 'code.c' in visual sudio

5- copied one function from inverseKinematics.cpp into it and saved it.

 

6. but now it does not give me an option to build it into a dll file. so thats where i got stuck

 

 

i have attached the VI, code.c my C program

 

Download All
0 Kudos
Message 5 of 9
(4,150 Views)

These are just general mathematic calculations that can be very easily recreated in LabVIEW, either with LabVIEW primitives on the diagram or with mostly copy and past in the script node or mathscript node.

 

That's definitely an order of magnitude less complicated than trying to get a DLL compiled without any formal C programming knowledge.

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 9
(4,136 Views)

Sounds like you don't know how to use Visual Studio.

Before you load code.c into Visual Studio, you should create a PROJECT in Visual Studio for build dll.

 

Since you're not family with Visual Studeo, you should try Rolf's idea.

 

George Zou
0 Kudos
Message 7 of 9
(4,124 Views)

i have already done it using math script node. that was never the issue. i am just trying to use different techniques to solve one problem. its a requirement of our project, thats why i am experimenting with all this. i agree i am not exactly familiar with visual studio. 

 

i will try creating a project and then loading code.c in it. hope it works..thank you for the guidance .. but besides this fault, is their any other fault in the steps i described earlier.

0 Kudos
Message 8 of 9
(4,118 Views)

@zee20 wrote:

i will try creating a project and then loading code.c in it. hope it works..thank you for the guidance .. but besides this fault, is their any other fault in the steps i described earlier.


I didn't check the entire code, as I consider that a useless exercise considering that the mathscript node allows to do the same without C difficluties. But I noticed at least one more fundamental error as you can not pass back results in parameters passed by value, only when they are passed by reference. If those terms don't mean anything to you then you should really stop trying to do a DLL.

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 9 of 9
(4,101 Views)