As we know, quick start (1) -- firmware update and quick start (2) -- ZBasic program development are introduced before. Also, there are 3 kinds of programming language, ZBasic, ZPLC and ZHMI. Then, today, let's learn how to develop motion control through ZPLC.
Firstly, What's the ZPLC?
Z PLC is the PLC language supported by Zmotion motion controller, it can use ladder of diagram (LAD) and statement list (STL) to program, which means it compatible with most PLC commands, for customers who are familiar to PLC can rapidly program. In addition, it supports hybrid programming with ZBasic. What's more, there are some different instructions, namely, some new instructions are added, such as, contact logic operation instructions, floating-point number contact comparison instructions, ZPLC calling ZBasic instructions, comment instructions //, etc.
Now, we know ZPLC basically, next, to learn how to develop through ZPLC for details from below words and image description.
1. Motion Controller ZPLC Program Development Code
2. Specific Steps
(1) new build the project
Firstly, new build one folder in PC to save the project to be made. Then, open ZDevelop software, click "File" - "New Project", one "save as" interface appears, select the built folder to open, and enter the file name, save the project, now new project is made. Please note the file suffix is ".zpj".
(2) new build the file
Click "File" - "New File".
Select the file type (PLC), and click "OK".
It can be seen hybrid programming among Basic, PLC and HMI is valid.
(3) set file as automatic operation
Double click "AutoRun", and input task Number as 0.
(4) edit the program
There are two methods.
--select the pane, directly enter instruction, operand and operand No., then click "ok".
If the instruction format is correct, the cursor will jump to next pane, but if it is incorrect, there will pop up one window.
--directly click the "symbol" in LD tool bar, then, "Emter PLC Instruction" window pops up, also, input instruction, operand and operand No.
The instruction can be input directly, or can be selected from drop-down list or from left commonly used instructions list.
When the program is edited, click below mark to save the file.
And new built basic file will be saved automatically into the file under project zpj.
(5) connect to controller
Edit the program well, then click "controller" -- "connect". If there is no controller, click "controller" -- "connect to simulator". And this routine selects simulator, when connected, there is "Connected to Controller:ZMC4xx-Simu Version:4.80-20180104."
When "connect to controller" window popped up, serial port or net port can be selected.
(6) download the program
Click following two buttons, RAM means download into RAM, ROM means download into ROM. When the program is downloaded, also, there is message in "output and command" window, at the same time, the program will run automatically.
RAM supports power failure storage, but ROM doesn't support. That is, the program that was downloaded into ROM will run automatically according to task number when the controller is connected next time.
(7) start to debug
Click "Debug" -- "Start/Stop Debug" to call "task and watch" window.
Task window is used to check running status and task line number. Watch window is used to watch axis parameters, customized variables, input and output status, etc.
(8) oscilloscope sampling
Click "View" -- "Scope" to open the relative window.
Open "Config" to set captured channel numbers, depth, space and other required parameters, then click "OK".
Here, select 5 channels:
curve 0 -- DPOS of axis 0 (the position)
curve 1 -- DPOS of axis 1 (the position)
curve 2 -- VP_SPEED of axis 0 (the interpolation merge speed)
curve 3 -- MSPEED of axis 0 (sub vector speed)
curve 4 -- MSPEED of axis 1 (sub vector speed)
Then, click "start" button.
Close the X0 rising edge contact, and transfer the movement distance parameters of axis 0 and axis 1 to the data register for storage.
Close the X1 contact to generate a rising edge pulse, M0 conducts and self-locks, at the same time triggers the execution of the oscilloscope sampling command and the MOVE linear interpolation motion command. Below is the waveform, X2 contact is used to stop axis motion rapidly.
The trajectory under XY mode:
When axis is running, press X2 button, and gain following graphics, interpolation axis stops at the speed of FASTDEC set before.
ABOUT ZMOTION
That's all, thank you for your reading -- Motion Control Quick Start (3) | How to Develop Motion Controller ZPLC Program
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.