Bring Values and Sucesses To Our Customers

Home / Support and services / Technical Support

Technical support

Technical Support

EtherCAT Edge Programmable Industrial Motion Controller (2): ZMC432H API Function Encapsulation


Good day to you, everyone.

In last article , we have learnt Zmotion EtherCAT motion edge controller ZMC432H hardware interface and functions. Then today, let's talk about software knowledge, that is, how Zmotion API function encapsulation is and one API encapsulation routine.

Before that, review the EtherCAT edge programmable industrial controller hardware information briefly.

EtherCAT motion control edge controller ZMC432H supports self-researched and self-controlled software and hardware. And this EtherCAT edge controller is an independent motion controller that is compatible with EtherCAT bus and pulse.

32 axes motion control can be achieved. At the same time, Zmotion remote HMI function is valid, which means network configuration display is provided to watch and adjust parameters in real-time.

1.png

ZMC432H has rich hardware interfaces and control functional modules, then effective and stable motion control and real-time data acquisition can be achieved to meet application requirements of both industrial control and industrial internet.

What's more, Linux system is built in ZMC432H. That is, it can be connected through local LOCAL interface, then, instruction interaction speed can be faster. The one interaction time of one single instruction and multiple instructions is about 40us.

3.png

3.png

As for ZMC432H hardware knowledge, there is also a video that shows hardware interfaces and functions clearly.

Next, enter ZMC432H software development part -- API Function Encapsulation.

For the API function, all controllers and control cards use the same set of API function.

  1. Valid development language: C, C++, C#, LabVIEW, Python, Delphi

  2. Valid development platform: VC6.0, VB6.0, QT, .Net

  3. Valid development system: Windows, Linux, WinCE, iMac

And each development language has own corresponding function library, but they call the consistent API, which means portability is promoted greatly.

Here, Zmotion provides one manual that includes all calling methods of each language library, calling commands and corresponding routines -- Zmotion PC Function Library Programming Manual.

4.png

So how to achieve API encapsulation?

--Through sending corresponding commands.

Like, ZAux_Execute / ZAux_DirectCommand :

Encapsulate Basic commands

Encapsulate your own function

Use unencapsulated commands

--modify and add relative function according to current codes.

In addition, there are 2 ways to send character string command: buffer mode and direct mode.

1. Direction Mode:

Directly execute one single related command of variable / array / parameter, at this time, all transferred parameters must be exact values (not expressions).

2. Buffer Mode:

All instructions can be executed, and expression can be as parameters, but speed will be slower.

Example: in zmcaux_cpp, use encapsulated ZAux_Direct_SetSpeed() that sets motion speed and ZAux_Direct_GetMpos that gets current encoder feedback position.

As mentioned, it is valid to self-define encapsulation API function.

And it also uses "online command", that is, host computer generates all kinds of ZBASIC commands to achieve needed functions.

ZAux library is a full open source library, source codes are can be obtained. There is a need, Zmotion provides.

Therefore, add your customized function in source codes or add library to encapsulate.

Know clearly from real routines:

(1) Get multiple types of data directly

If you want to obtain a variety of data, such as the command position of the axis, the feedback position of the axis, the IO points on the board, etc., and they often obtain different data through a variety of separate and independent functions. Then in this such accumulation, so many times of reading and writing, it will cause the program to freeze.

How about custom one function, which can pass data into host computer program rapidly, then the controller data reading speed can be promoted obviously.

suppose there is a simple three-axis platform, it is necessary to read following data:

  1. DPOS of axis 0, axis 1, axis 2 -- command / target position

  2. MPOS of axis 0, axis 1, axis 2 -- encoder feedback / measurement position

  3. AXISSTATUS of axis 0, axis 1, axis 2 -- axis status

  4. IN (0) ~ IN (32)

  5. OUT (0) ~ OUT (33)


program codes:

5.png


(2) Execute several different types of buffer commands by one line command

Generally, the dispensing industry and the woodworking industry mostly use the continuous track , and there is an inserted buffer output between the continuous tracks. If the motion and the continuous track motion and the buffer output are sent separately, not so convenient. Then through encapsulating the motion function separately to execute multiple functions in one line of commands, as shown in the following example:

Assuming to control an XY two-axis platform, it starts from the coordinate point (0,0) then moves a below trajectory:

OUT0 outputs 50ms -- (100, 0)

OUT0 outputs 100ms -- (100, 100)

OUT0 outputs 50ms -- (0, 100)

OUT0 outputs 50ms -- (0, 0)

Now, you can use one function to encapsulate and send it out quickly.


program codes:

6-1.png

6-2.png

And synchronously, oscilloscope can capture corresponding data waveform.

7-1.png

7-2.png

8.png

9.png






ABOUT ZMOTION

That's all, thank you for your reading -- EtherCAT Edge Programmable Industrial Motion Controller (2): ZMC432H Uniform Host Computer API

For more information, please pay close attention to "Support"  and   "Download" , and there are other platforms about Zmotion - Youtube   &   LinkedIn   &   Twitter    &   Tiktok    &   Facebook including technical information (development environment, routine code), product showing, company development, etc.

Hope to meet you, talk with you and be friends with you.  Welcome!

This article is edited by ZMOTION, here, share with you, let's learn together.

ZMOTION: DO THE BEST TO USE MOTION CONTROL.

Note: Copyright belongs to Zmotion Technology, if there is reproduction, please indicate article source. Thank you.

Zmotion Technology focuses on development of motion control technology and general motion control products, it is a national high and new technology enterprise. Due to its concentration and hard work in motion control technology, ZMOTION already become one of the fastest growing industrial motion control companies in China, and is also the rare company who has managed core technologies of motion control and real time industrial control software completely. Here, Zmotion provides motion controller, motion control card, vision motion controller, expansion module and HMI. In addition, there is one program software developed by Zmotion -- ZDevelop. It is a good choice for you to program and compile. And program through upper computer, there is PC manual.

Zmotion Technology provides motion control card, motion controller, vision motion controller, expansion module and HMI. ( more keywords   for Zmotion: EtherCAT motion control card, EtherCAT motion controller, motion control system, vision controller, motion control PLC, robot controller, vision positioning...)

Have a good day, best wishes, see you next time.


2013-2023 版权所有 Zmotion Corp. Copyright Reserved 粤ICP备13037187号-1