Motion controller tracking application demo

Publisher:TranquilDreamsLatest update time:2024-09-26 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction to programming framework

The programming framework is a general framework for chasing and shearing applications. The functions of each part have been fully written. Users only need to modify the relevant processing parameter values ​​based on this framework. After connecting to a touch screen, the parameters can be modified on the touch screen interface. It is simple and convenient to use.

1.png


The software framework contains two types of files, basic and HMI mixed program files written by the positive motion programming software ZDevelop, and touch screen files written by the Weintron programming software EasyBuilder Pro.



2.png


This system has two modes: hardware platform operation and software platform simulation, which can be customized on the touch screen.

In situations where there is no control system such as a controller or drive, it can be run on a simulation platform, allowing users to quickly get started.

There are two touch screen options: Weiluntong touch screen and ZHD touch screen. Even without a physical screen, simulation can be run on these two platforms.



2. Chasing shearing instruction


The shearing motion requires two axes. The main axis is axis 6, which is generally an encoder axis used to transport workpieces. The VMOVE instruction is used to control the main axis to run at a constant speed. The slave axis is axis 0. In the shearing motion, the slave axis follows the main axis. The slave axis uses the MOVESLINK automatic cam instruction to control the variable speed motion.

MOVESLINK -- Auto Cam 2

This instruction is used for custom cam motion, which automatically plans the intermediate curve without calculating the cam table.

The connected axis is the reference axis and the connected axis is the following axis.

MOVESLINK (distance,link dist,start sp,end sp,link axis[,link options][,ink pos][,link offpos])

[, link options] [, link pos] When optional parameters are not filled in, the comma cannot be omitted. The controller determines what parameter it is based on the position of the parameter.

Distance: The distance the following axis moves from the beginning to the end of the connection. This parameter can be positive or negative. A positive number means the axis follows in the positive direction, while a negative number means the axis follows in the negative direction. The parameter is in units.

link dist: The absolute distance the reference axis moves during the entire connection process, in units

start sp: The speed ratio of the following axis and the reference axis at startup, in units/units. A negative number indicates negative movement of the following axis.

end sp: The speed ratio of the following axis and the reference axis at the end, in units/units. Negative numbers indicate negative movement of the following axis. Note: When start sp = end sp = distance/link dist, the motion is uniform.

link axis: the axis number of the reference axis

link options: connection mode options, different binary bits represent different meanings



3.png


link pos: When the link options parameter is set to 2, this parameter indicates that the link starts at this absolute position of the reference axis.

Link offpos: When the link_options parameter bit4 is set to 1, this parameter indicates the relative position of the spindle after it has run. Supported by firmware 20170428 and above.

In order to match the speed during the acceleration and deceleration phases, the start sp of the next MOVESLINK must be the same as the end sp of the current MOVESLINK.

Please make sure that the distance parameter *units passed by the command is an integer number of pulses, otherwise floating point numbers will cause slight errors in the movement.

Example: During the shearing process, the reference axis (spindle axis 1) is the profile, and the worktable (slave axis 0) is the following axis. In one processing cycle, the worktable first moves a distance of 1, then moves in the opposite direction for 1, and returns to the original position. During the whole process, the profile moves a distance of 4.

RAPIDSTOP(2)

WAIT IDLE(0)

WAIT IDLE(1)

BASE(0,1)

UNITS=10000,10000

ATYPE=1,1

DPOS=0,0

SPEED=1,1 'profile running speed 1m/s, 60m/min

ACCEL=2,2

DECEL=2,2

VMOVE(1) AXIS(1) 'Continuous movement of profile

TRIGGER 'Automatically trigger the oscilloscope

MOVESLINK(0,1,0,0,1) AXIS(0) 'Before the profile moves 1 unit, the workbench is stationary

MOVESLINK(0.4,0.8,0,1,1) AXIS(0) 'In the stage of workbench acceleration, the workbench moves 0.4 and the profile moves 0.8. During acceleration, the speed of the following axis is 0, so the speed ratio of the following axis and the reference axis is 0. After acceleration, the speed of the following axis and the reference axis is equal, and the ratio is 1.

MOVESLINK(0.2,0.2,1,1,1) AXIS(0) 'Speed ​​following stage, the speed is consistent, keep synchronous motion 0.2

MOVESLINK(0.4,0.8,1,0,1) AXIS(0) 'In the stage of table deceleration, the table moves 0.4 and the profile moves 0.8. During deceleration, the speed of the following axis and the reference axis are equal, and the ratio is 1. After deceleration, the speed of the following axis is 0, so the speed ratio of the following axis and the reference axis is 0.

MOVESLINK(-1,1.2,0,0,1) AXIS(0) 'The workbench returns to the starting point, the workbench moves -1, and the profile moves 1.2

END

Speed ​​and position curves of master axis 1 and slave axis 0:



4.png



3. Program Structure


The main program of the controller is written in Basic language, and the HMI program is a ZHD touch screen program.

(I) View Window

1. File view: Contains four files, two automatically run tasks, and other tasks started by commands.



5.png


2. Process view: Each file contains SUB sub-functions, among which GLOBAL is a global sub-function that can be called by HMI components.



6.png


3. Configuration view: configuration window and components under each configuration window



7.png


(II) Task Allocation

The project contains a total of 4 tasks, three Basic tasks and one HMI task.

Task0: Main task

It is started by automatic operation task number 0, and the file "TaskMain.bas" is automatically run after power is turned on to perform parameter definition, axis parameter initialization, main program cyclic scanning, etc.

Task 1: Manual task

Started by the main loop of main task 0, task 1 runs the "TaskHands.bas" manual file task.

This file contains a while statement, which is automatically turned on initially, and the subsequent loop detects whether the triggering conditions for manual movement are met and executes manual movement.

The functions include JOG manual, MOVE inch movement and inch movement distance setting, axis return to zero, and storage of user parameters and mechanical parameters in FLASH block.

Task 2: Automatic task

Started by the main loop of main task 0, task 2 runs the "TaskAutoRun.bas" automatic processing file task.

This file executes the chasing shearing processing in a loop. The chasing shearing parameters can adopt the parameters set during the initialization process. The user can also customize the chasing shearing parameters on the touch screen interface. After each processing, the output is automatically increased by 1 and displayed on the touch screen.

Before executing automatic machining task 2, all basic tasks except the main task will be stopped, all axes will be stopped quickly, and then the machining program will be executed.

If the "Stop" button is pressed when Task 2 is automatically started, Task 2 will end and switch to Manual Task 1.

Task 5: Functional reservation

It is started by the automatic operation task number 5, and the file "Hmi1.hmi" is automatically run when powered on. This task is a ZHD touch screen program, which can be downloaded to the controller and connected to the ZHD touch screen for control, or connected to the xplc screen touch screen simulation platform.

If you use the Weiluntong configuration program, this file will not run. Remove the automatic run task number or delete this hmi file.

The calling relationship between the framework's tasks and subroutines:



8.png


4. Register Usage


The MODBUS register is mainly used. MODBUS_IEEE is used for data storage and transmission. The touch screen component calls the MODBUS_IEEE address to display the value of the register. MODBUS_BIT is used for function control and is used in conjunction with the function keys or bit components of the touch screen.



9.png


The VR register saves data in conjunction with the power-off interrupt, and reads from the VR when power is on.

VR_INT(30): Saves the production.

VR(35): Saves the target position DPOS(0) of the slave axis (shear axis 0).

FLASH block is used to save mechanical parameters and user parameters.

FLASH block 0: storage of mechanical parameters

FLASH block 1: store user parameters

5. Program operation instructions


1. Controller Platform

The general process of connecting the controller to the touch screen:

The program on the controller side is written using ZDevelop software and downloaded to the controller.

The program on the touch screen is written using the corresponding programming software and then downloaded to the touch screen for storage.

After the program is downloaded, select the serial port or network port to connect the touch screen and the controller for offline operation.

1. Wiring: Connect the controller, driver, touch screen, etc. as required.

2. Download the controller program: Open the zpj project program in the ZDevelop software, connect to the controller first, and download the program to the controller.

3. Download the touch screen program:

If you use a ZHD touch screen, directly download the basic and hmi files under the above zpj to the controller, and then use the ZHD400X touch screen to connect to the controller network port. After the operation is successfully connected, it can be used without downloading the program to the touch screen separately. For detailed usage methods, please refer to the article "Introduction to ZHMI Configuration Programming of ZHMI Controllers" in the Positive Motion Assistant.

[1] [2]
Reference address:Motion controller tracking application demo

Previous article:EtherCAT motion control card hardware wiring and C# single-axis motion control
Next article:VPLC Series Machine Vision Motion Control All-in-One Quick Start (V)

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号