Hi, everyone, there is Zmotion, welcome to our "Motion Control Quick Start" series of technical support, and today let's learn the second part.
Some of you master "Basic" language, but how about ZBasic, specifically, how to develop motion controller through ZBasic. There is one document (ZBasic Program Manual) that introduces it about 600 pages in details, but actually it is easy to understand, which means all we can quick start.
The logic and the structure of ZBasic programming is extremely clear, then it can meet multiple program requirements. Now, it is applied widely. And all standard program grammar, it provides, such as, variables, arrays, condition judge, loop, arithmetical operation, etc. In addition, expanded instructions are provided and wide motion control functions are provided by function.
Ok, next, let's see how to develop ZBasic Program of motion controller?
1. Motion Controller ZBasic 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 (Basic), 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
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".
When "connect to controller" window popped up, serial port or net port can be selected. Please select matched serial port parameter or net port IP address, click "connect". Now, pay attention to the message in "output" window, "Connected to Controller:ZMC432 Version:4.64-20170623" means success.
(6) download the program
Click following two buttons, 1 - RAM means download into RAM, 2 - 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.
--download into RAM--
--download into ROM--
You may ask, what's their difference?
Actually, there is only one, 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, they are DPOS of axis 0 and axis 1, master speed VP_SPEED of interpolation motion, MSPEED of axis 0 and axis 1. Then, click "Start" button. And enter SUB motion program execution condition "modbus_bit(0) = 1" in "command" window to trigger oscilloscope sampling. After motion program is executed, below waveform data is captured.
The curve trajectory under XY mode:
ABOUT ZMOTION
That's all, thank you for your reading -- Motion Control Quick Start (2) | How to Develop Motion Controller ZBasic 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.