--Hardware Controller ZMC408CE--
ZMC408CE is one multi-axis high-performance EtherCAT motion controller, there are EtherCAT, EtherNET, RS232, CAN, and U disk communication interfaces.
It supports 8-axis motion control, but it can be up to 32 axes. Functions of linear interpolation, circular interpolation, space arc, helical interpolation, electronic cam, electronic gear, synchronous follow are valid.
For development, there are 3 programming methods (PLC, Basic, HMI) and main PC languages (C#、 C++、 LabVIEW、 MATLAB、 Qt、 Linux、 VB.Net、 Python) of Zmotion uniform API function library.
Except above functions, there are hardware comparison output, hardware timer, precision output in motion, PWM, etc., below video link can show you more.
(1) Create One Project
In MATLAB R2019a menu, click "Main" -- "New" -- "Project" -- "Empty Project".
(2) Create One GUI
In command line, enter "guide" to build one GUI.
(3) Refer to Zmotion MATLAB Function Library
Here, take 64-bit library as the example.
A. Get Zmotion MATLAB Function Library
Zmotion provides one uniform encapsulated function library, it supports all kinds of host computer programming languages. If you want corresponding function library, please contact us. When you get MATLAB compressed package, it shows like this:
B. How to Use Zmotion Library File
It only needs to copy library file and corresponding file into MATLAB working directory.
--copy these four files ("zauxdll.dll", "zmotion.dll", "zauxdll2.h", "zmotion.h") into "matlab" working directory--
For example: C:\...\....\R2019a\bin
--copy these two files ("zauxdll2.h", "zmotion.h") into "include" directory--
For example: C:\...\....\R2019a\extern\include
--copy "zauxdll.dll" into new built project directory--
(4) How to Configure MATLAB Development Environment
A. In MATLAB command line, enter "mbuild -- setup" and "mex -- setup", then select installed C language compiler.
B. Use "loadlibrary('zauxdll.dll','zauxdll2.h')" to load function library.
C. Show shared library function signature: libfunctions zauxdll -full; / libfunctionsview zauxdll;.
(5) Use "calllib" to call the function that is in "zauxdll" function library. For details, please check MATLAB help.
--for corresponding parameters transfer, please click "transfer parameter" in calllib help--
At this time, function library is added. It is time to do MATLAB project development.
As it was mentioned above, Zmotion provides one uniform encapsulated function library. Specifically, there are many commands to achieve corresponding functions. They can be referred from Zmotion PC Function Library Programming Manual, which can be obtained from our Zmotion website or contact us directly.
A. Controller Connection Interface: ZAux_OpenEth()
Generally, for PC programming, the controller and IPC are connected through Ethernet. The Ethernet linking function interface is ZAux_OpenEth(). When the connection is built successfully, this interface will return one connection handle. Then, it can control the controller through this connection handle.
--command introduction--
--project application showing--
--command line application showing--
B. Single-Axis Motion Control
Use single-axis corresponding command to operate the connection handle "g_handle", then do single-axis motion control for the controller.
--how to control relative single-axis motion--
--how to control absolute single-axis motion--
--how to control continuous motion--
--how to stop single-axis motion--
(1) Single-Axis Motion Control HMI Interface
(2) Routine Simple Process
(3) Program Editing
In MATLAB CUI Interface, build one new control to do programming.
A. Build one "normal button" and one "editable text" in Tool, then double click to modify the property.
B. Right click the control, and click the "Callback" to build one callback respond function. At this time, .m form file is created automatically. Then, edit the respond program.
C. Add the automatic built file into project.
D. In "XXX_OpeningFcn" function, load the function library , and define global variable.
(4) Edit "connect" (connect to controller) button program , call the interface "ZAux_OpenEth()", while clicking the button, now it connects to the controller.
(5) In main interface, right click to add one "delete" function, call the interface "ZAux_Close()" to close the connection.
(6) Update controller axis states through timer : current coordinates, current speed, etc.
(7) Set axis parameters and start to move through the event processing function of "Run" button.
(8) Stop interpolation motion through the event processing function of "Stop" button.
When compiling and running the routine, it can debug it at the same time in ZDevelop software (ZDevelop is one free programming software made by Zmotion, it can be downloaded from here or contact us), including axis parameters, motion situation.
(1) Watch by "SCOPE" in ZDevelop
Connect the controller to ZDevelop, then click "View"--"Scope". Open the oscilloscope window, then, axis motion situation can be watched in real-time.
(2) Run PC Programming Software to Debug & Watch