[Beremiz-devel] Creating Motion Library in Beremiz

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Beremiz-devel] Creating Motion Library in Beremiz

phucvm1992
Dear all,

I would like to write Motion library, which can generate trajectory for
single axis, read status and control servo driver. Actually, I have a servo
driver which is compliant to CiA 402 with EtherCAT communication. Beremiz
supported EtherCAT extension with CiA 402 state processing. So my idea is:
- Write motion library which can call in PLC by adding instance of Motion
Function Block
- Motion library should have some function blocks: Power (On/Off axis),
MoveAbsolute(Point to Point),etc...
- Motion instance exchange data with real servo according CiA 402.

In my opinion, I should write by C/C++ (it is complicated) however I don't
know how to put it in Beremiz which we can call as a library. Does anyone
know? Please give me your advice!

Thank in advance,
Mr. Phuc



--
Sent from: http://beremiz-devel.2374573.n4.nabble.com/


_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Beremiz-devel] Creating Motion Library in Beremiz

phucvm1992
Hi,

Does anyone know how to link a variable, structure in a function block
(written in XML format) to the equivalent memory in C/C++. I would like to
write library in C/C++, then I will call the functions of this library by
instances of function block. Users can set input, get output from function
block in PLC program, and function block will exchange data to function in
C/C++.

Best regards,
Mr. Phuc





--
Sent from: http://beremiz-devel.2374573.n4.nabble.com/


_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel
skv
Reply | Threaded
Open this post in threaded view
|

Re: [Beremiz-devel] Creating Motion Library in Beremiz

skv
Administrator
Hi Mr. Phuc,

On 18-11-14 02:28, phucvm1992 wrote:

> Hi,
>
> Does anyone know how to link a variable, structure in a function block
> (written in XML format) to the equivalent memory in C/C++. I would like to
> write library in C/C++, then I will call the functions of this library by
> instances of function block. Users can set input, get output from function
> block in PLC program, and function block will exchange data to function in
> C/C++.
>
> Best regards,
> Mr. Phuc
>
You can use C pragma in ST code to call C/C++ library calls from POU
(Function block, Function).

It looks like this:
{{
 LogMessage(GetFbVar(LEVEL),(char*)GetFbVar(MSG, .body),GetFbVar(MSG, .len));
}}


See python example located test/python (it's included in Beremiz
installation with other examples).
https://bitbucket.org/automforge/beremiz/src/tip/tests/python/?at=default
It does contain Function block names 'C_Pragma' and shows how to use
this feature.


To learn to wrap C function into Function block and create Beremiz
library for that look at NativeLib.xml and features.py.

https://bitbucket.org/automforge/beremiz/src/tip/NativeLib.xml?at=default&fileviewer=file-view-default

 
--
Best regards,
Andrey Skvortsov


_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel

signature.asc (849 bytes) Download Attachment