AXIMA Software User`s Guide
Transcription
AXIMA Software User`s Guide
AXIMA Software User’s Guide P/N 400263-00 Rev.: A1 Date: October 31, 1997 © 1997 EMERSON Motion Control. All Rights Reserved. P/N 400260-0 AXIMA Software User’s Guide Information furnished by EMERSON Motion Control is believed to be accurate and reliable. However, no responsibility is assumed by EMERSON Motion Control for its use. EMERSON Motion Control reserves the right to change the design or operation of the equipment described herein and any associated motion products without notice. EMERSON Motion Control also assumes no responsibility for any errors that may appear in this document. Information in document is subject to change without notice. P/N 400263-00 Rev.: A1 Date: October 31, 1997 © 1997 EMERSON Motion Control. All Rights Reserved. P/N 400290-00 AXIMA Software User’s Guide © 1997 EMERSON Motion Control. All Rights Reserved. Document Number: 400263-00 No part of this manual may be reproduced by any means without the written permission of EMERSON Motion Control. EMERSON Motion Control is a registered trademark of EMERSON Motion Control. AXIMA is a trademark of EMERSON Motion Control. Printed in U.S.A. October 1997, Revision A1 Microsoft, Excel, and Windows are registered trademarks of Microsoft Corporation. IBM is a registered trademark of International Business Machines, Inc. Modbus is a trademark of Modicon, Inc. Data Highway Plus are trademarks of Allen-Bradley This document has been prepared to conform to the current released version of hardware and software system. Because of our extensive development efforts and our desire to further improve and enhance the product, inconsistencies may exist between the product and documentation in some instances. Call your customer support representative if you encounter an inconsistency. ii Customer Service EMERSON Motion Control offers a wide range of services to support our customer’s needs. Listed below are some examples: Service Support (612) 474-8833 EMERSON Motion Control’s products are backed by a team of professionals who will service your installation wherever it may be. Our customer service center in Minneapolis, Minnesota is ready to help you solve those occasional problems over the telephone. Our customer service center is available 24 hours a day for emergency service to help speed any problem solving. Also, all hardware replacement parts, should they ever be needed, are available through our customer service organization. Need on-site help? EMERSON Motion Control provides service, in most cases, the next day. Just call EMERSON’s customer service center when on-site service or maintenance is required. Training Services (612) 474-1116 EMERSON Motion Control maintains a highly trained staff of instructors to familiarize customers with EMERSON Motion Control’s products and their applications. A number of courses are offered, many of which can be taught in your plant upon request. Application Engineering An experienced staff of factory application engineers provided complete customer support for tough or complex applications. Our engineers offer you a broad base of experience and knowledge of electronic motion control applications. Bulletin Board System (612) 474-8835 EMERSON Motion Control maintains a BBS which provides you access to software updates, and technical information and services. Communications protocol: 300 to 28,800 baud, N, 8, 1 FAX (612) 474-8711 Internet Website www.emersonemc.com iii AXIMA Software User’s Table of Contents Introduction Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 New for Version 2.0 . . . . . . . . . . . . . . . . . . . . . . . . 2 AXIMA Software Fundamentals. . . . . . . . . . . . . . . . . 2 AXIMA Application Basics . . . . . . . . . . . . . . . . . . 2 AXIMA Software Features . . . . . . . . . . . . . . . . . . 3 Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Program Quantity . . . . . . . . . . . . . . . . . . . . . . . . . 6 Program Verification . . . . . . . . . . . . . . . . . . . . . . . 7 Motion Program. . . . . . . . . . . . . . . . . . . . . . . . . . . 7 PLC Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Auxiliary Program . . . . . . . . . . . . . . . . . . . . . . . . . 8 What is an Application?. . . . . . . . . . . . . . . . . . . . . . . . 8 AXIMA Hardware Specifications . . . . . . . . . . . . . . . . 10 Understanding Motion in a Coordinate System Coordinate System Hierarchy. . . . . . . . . . . . . . . . 15 How Motion is Generated . . . . . . . . . . . . . . . . . . . 15 Closed Loop Operation . . . . . . . . . . . . . . . . . . . . . 18 Understanding Programs PLC Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Motion Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Auxiliary Programs . . . . . . . . . . . . . . . . . . . . . . . . 26 Understanding Multitasking Program Priority Assigning Program Priorities . . . . . . . . . . . . . . . . 29 Processing High and Low Priority Programs. . . . 30 Program Priority Execution Interval Times . . . . 32 v AXIMA Software User’s Guide Communications Interface Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Addressing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Terminal Mode Communications. . . . . . . . . . . . . Data Input/Output . . . . . . . . . . . . . . . . . . . . . . . . 39 39 39 42 Programming Examples Homing an Axis Example . . . . . . . . . . . . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . Product Alignment Example . . . . . . . . . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . Two Axis Gluing Example . . . . . . . . . . . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . MX/AXIMA Communications Example . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . T60/AXIMA Communications Example . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . Cam Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . Linear PLS Example . . . . . . . . . . . . . . . . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . Rotary PLS Example. . . . . . . . . . . . . . . . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . External Time Base Example. . . . . . . . . . . . . . . . . . . Example Program . . . . . . . . . . . . . . . . . . . . . . . . . Index vi 45 46 47 48 51 53 59 60 61 61 65 71 76 77 79 81 82 82 AXIMA User’s Guide Introduction Overview The AXIMA Software and controller combination is a high performance multi-axis servo controller. The AXIMA system provides the flexibility and functionality to perform multitasking operations that will handle the wide range of multiaxis applications found in plant automation and industrial machinery. The AXIMA system provides you with the following: Reduced application development time. • • • Microsoft Windows® standards for fast familiarity High level programs 24 hour service support A high performance coordinated multiaxis motion control system. • • • • • • • DSP processor, with servo profile update rates as fast as 200 microseconds Complex motion capability - arc, sine, linear, gear, cam Multitasking PLC digit controls Discrete I/O Servo controls Pulse controls Access to the complete EMERSON Motion Control family of motion control components. • • • • • Controllers Drives Motors Display panels System Communications - Modbus® and Data Highway Plus® 1 P/N 400290-00 AXIMA User’s Guide New for Version 2.0 • • • • • • • • • • • AXIMA 2000/4000 with reconfiguration Flash memory (AXIMA 2000/4000 only) Stepper support Quick encode Com 2 autobaud override Download and switch online Registration Move Instruction Auxiliary PLC E Series drive defaults 38.4K baud RS232C setting New flags; Positive and Negative Direction Limit, Direction Limit Activate and Tripped AXIMA Software Fundamentals EMERSON Motion Control’s AXIMA Software provides you with the ability to create, edit and maintain your controller Application. AXIMA Application Basics You will be building an AXIMA Application using the AXIMA Software. The Application is downloaded into the AXIMA controller for execution. The AXIMA Software allows you to work on multiple Applications, but only one Application can be resident in the controller memory at a time. An Application contains all the information to configure and program your AXIMA controller. This includes Motion Programs, coordinate systems, axis, analog, connectivity options (Modbus and Data Highway Plus), PLC Programs, Global Variables, Local Variables, and Pre-defined Variables. 2 Introduction The AXIMA Software provides a tool to generate your application, download it, and monitor it’s execution. Each Application is organized in the hierarchy shown below. Figure 1 Application Hierarchy Example The Application contains coordinate systems. You assign the available axis to your coordinates. Within a coordinate system axis moves are “coordinated moves” where the profile and each axis are executed simultaneously. Each coordinate system is assigned a Motion Program and a PLC Program. The Motion Program controls all motion while the PLC Program provides high speed digital I/O control. AXIMA Software Features Application Hierarchy The Application is organized in a hierarchy and displayed on the left of the AXIMA Application editing window. You can quickly navigate through your Application. Double clicking collapses or expands the hierarchy tree. The details of the selected hierarchy item are 3 AXIMA User’s Guide displayed on the right view of the AXIMA Application editing window. Easy Menus The menus in the AXIMA Software provide quick and easy access to a variety of tools used for graphical monitoring of the controller, program control, and diagnostics. Graphical Monitor The Graphical Monitor is a separate Windows program that can be launched for the AXIMA Software. It is used to analyze the operation of the AXIMA controller and graphically present multiple analog or digital signals on a graph. See the Graphical Monitor Online Help for more information. Program Control The Program Control dialog box is a useful tool when troubleshooting Applications. Specifically, you can control or monitor any Motion, Auxiliary, or PLC Programs from here. The controls available include running, halting and monitoring program output for all programs. You may also issue instructions to produce an immediate affect from this dialog box. Diagnostics Diagnostics provides convenient display of key Pre-defined Variables. Each key level of the hierarchy has it’s own status display. You can monitor the execution of your Application in online mode using the diagnostics capability. Diagnostic levels include Application (controller), Coordinate Systems, Axes, and Programs. Online Help Online Help provides you with help. All AXIMA Software dialog boxes provide a Help button. The help menu provides access to the different help files. 4 Introduction Communications Communications between the AXIMA Software on your PC and the AXIMA controller is accomplished using several options including: • • • RS232C RS422 RS485 As an option, your AXIMA controller can be configured with Modbus or Data Highway Plus communications hardware. These provide interfaces between your Application, system controllers and display panels. Program Memory The AXIMA controller has a total of 64K or 128K bytes of memory for programs depending on the controller you ordered. You can view the Total Memory Used and the Total Memory Available values from the Controller Memory dialog box which is accessed by clicking on the Memory button in the Applications dialog box. Programs There are two basic types of programs: Motion/Auxiliary and PLC. All these programs are multitasked within the controller. You can have up to fifteen Motion/Auxiliary Programs. Eight of these are designated High Priority. The Motion/Auxiliary Programs are either assigned to a coordinate or are stand-alone. Those assigned to coordinate are Motion Programs and those that are stand-alone are Auxiliary Programs. The Motion Program controls the axis movement, while the Auxiliary Program is used for non-motion functions. Auxiliary Programs instruction set is a subset of the Motion Programs. The PLC Program provides program logic controller capability to the user. The user can write programs to control the external I/O bits, the controllers pre-defined bits and user defined (Global bits). The AXIMA controller executes these programs simultaneously by multitasking the programs using the slicing method. The time slice algorithm treats PLC Programs as the highest priority with High Priority Motion/Auxiliary Program next and Low Priority last. 5 AXIMA User’s Guide Instructions AXIMA instructions preform high level operations. For example, single instructions provide multiaxis coordinated moves for linear, arc, sine, and gear motions. Program flow instruction provides if/ then, subroutine, wait on value, and dwell type instructions. The instructions are defined using dialog boxes. For each instruction type there is an associated dialog box. The dialog box covers all the parameters of the instruction so you can get a clear understanding of full instruction capability and options. Variables are user defined, with user assignable names. These names are easily selected by drop down boxes in each of the instruction dialogs Cut/Copy/Paste Cut/Copy/Paste provides a capability to take portions of one Application and paste it into another. This allows you to copy example programs. It also facilitates multiprogramer development. Each programmer develops code independently. The Cut/Copy/Paste is used to integrate the programs into one Application. Programs The dialog box used for creating and editing Motion, PLC or Auxiliary Programs are very similar with the exceptions listed below: • • • • • Auxiliary Programs include a user defined name. PLC Program instructions may not be commented. PLC Programs do not have a priority adjust option. Motion Programs default to High Priority. Auxiliary Programs default to Low Priority. Program Quantity Each of the program types (Motion, PLC, and Auxiliary) have limits on the total number of each. 6 • Number of Motion Programs <= 8 (coordinate systems) • Number of PLC Programs <= 8 (coordinate systems) Introduction • Number of Auxiliary Programs <= 15 minus the number of Motion Programs • Number of High Priority Programs <= 8 • Number of Low Priority Programs <= 7 Program Verification All programs (Motion, PLC and Auxiliary) are verified as you edit them. Warning messages are presented as inconsistencies are created within any program. Examples include; deleting referenced variables, labels and axes. See the Troubleshooting section for a description of the messages produced by the AXIMA Software. Motion Program Each Coordinate System contains one Motion Program which controls the motion of all axes. The Motion Program is used to control motion parameters such as acceleration and deceleration rates, velocities, starts and stops, input and output functions as well as calling subroutines. The example below shows a typical Motion Program configuration. PLC Program The PLC Program is a “ladder logic” type program that executes at the SUI. The purpose of the PLC Program is to monitor controller fault conditions, limits and safety/emergency actions. This flexibility puts the user in total control of the application. The PLC Program allows the Motion Program to be written without concern of fault conditions or stop/ hold inputs. The PLC Program provides digital processing only. PLC instructions may reference only Global or Pre-defined Variables. There is a maximum of eight PLC Programs, one for each Coordinate System. Each PLC Program may have a maximum of 100 instructions. If 100 instructions is insufficient to handle the application, an unused Coordinate System (with no axis) may be added to make use of it's PLC Program. 7 AXIMA User’s Guide Auxiliary Program Auxiliary Programs are contained at the Application level. Therefore, Auxiliary Programs can not directly control any motion. Auxiliary Programs typically use Low Priority as opposed to High Priority being generally reserved for Motion Programs. Auxiliary Programs are limited to three instruction groups; Flow, Logic and Other. What is an Application? An Application is the basic building block used by the AXIMA Software. You, the user, write the Application. Applications have a one to one relationship with the controller. Each Application contains Coordinate Systems, Motion Programs, Auxiliary Programs and Auxiliary PLC Programs. Each Coordinate System contains axes, a Motion Program and a PLC Program. The Motion Program is responsible (through the use of instructions) for controlling the motion of the axes contained in the Coordinate System. The PLC Program is used to monitor limit conditions and also provide high speed digital processing. These two programs (Motion and PLC) run simultaneously with the PLC Program running at the servo update interval. Application's may also contain Auxiliary Programs that contain nonmotion related instructions. This is because Auxiliary Programs are not contained by a coordinate system and therefore the Auxiliary Programs are not associated with the axes. This lack of association limits the Auxiliary Programs to non-motion instructions. The Application may also contain Auxiliary PLC Programs for additional high-speed digital processing. All types of programs can share process information through the use of Global and/or Pre-defined Variables. Coordinate Systems contain one or more axes. Each axis is assigned to a command (digital to analog converter) output and an encoder input. Each axis has servo loop parameters and motion limits. The servo loop parameters include PID (Proportional, Integral, Derivative) gains, time interval adjustments and notch filters. The 8 Introduction Axis motion limit parameters include travel, position, velocity and acceleration limits. The figure below shows the relationships between Application components. APPLICATION AXIMA 1st Coordinate System 4th Coordinate System 1st Axis Parameter Nth Axis Parameter Servo Loop Options Servo Loop Options Motion Program PLC Program Auxliary Program 1 Auxliary Program 7 Auxliary PLC Program 1 Auxliary PLC Program 7 Figure 2 Application Hierarchy Overview Diagram 9 AXIMA User’s Guide AXIMA Hardware Specifications See the table below for your particular AXIMA controller. AXIMA AXIMA 2000 AXIMA 4000 AXIMA ISA Maximum Axis 8 2 4 8 Maximum Coordinate Systems 8 8* 8* 8 Maximum Motion Programs 8 8 8 8 Maximum Auxiliary Programs (minus the number of Motion Programs) 15 15 15 15 Maximum PLC Programs 8 8 8 8 Yes Yes Yes Yes Encoder Inputs Each Axis Each Axis plus 2 Each Axis Each Axis Standard Inputs 32 16 16 32 Standard Outputs 32 12 12 32 Feature Analog Inputs Eight analog inputs, ±10V, 13 bit, single ended or 4 differential mode Pre-defined Inputs Pre-defined Outputs Axis enable - (1) per axis, dry contact (1) Watchdog timer, dry contact None 7 13 None Expanded I/O Banks (Optional) (32 Inputs/32 Outputs) 1 2 2 4 Data Highway Plus® (Optional) Yes Yes Yes No Modbus® (Optional) Yes Yes Yes No Stepper Axis (Optional) 0/4/8 0/2 0/4 0/4/8 Power Requirements 96 to 264 VAC, 50/60 Hz single phase, 2 Amps max. DSP Speed 10 27 MHz 50 MHz 50 MHz 27 MHz Introduction Feature Communications (1) 9-pin, D-sub, RS-232C serial port. (1) RS-232C/422/485 terminal block 19.2k max baud rate Memory AXIMA AXIMA 2000 AXIMA 4000 AXIMA ISA Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes 64K RAM 128K, 128 Flash 128K, 128 Flash 64K RAM Noise Immunity Designed to meet IEC801.2 standard Environmental Operating Temperature Relative Humidity Weight 32° to 133° F (0 to 45° ambient) 0 to 90%, non-condensing 8 lbs 5 lbs 5 lbs >1 lbs * Although you can enter up to eight coordinate systems for the AXIMA 2000/4000 controllers, the AXIMA 2000 will only use the first two coordinate systems and the AXIMA 4000 will only use the first four coordinate systems. 11 AXIMA User’s Guide Figure 3 12 Mechanical Dimensions of AXIMA Introduction Figure 4 Mechanical Dimensions of AXIMA 2000/4000 13 AXIMA User’s Guide 13.28 (337 mm) 1.25 (32 mm) 1.88 (48 mm) 3.86 4.17 (106 mm) (98 mm) AXIMA-ISA MOTHERBOARD STANDARD DAUGHTERBOARD OPTIONAL I/O EXPANSION BOARD Figure 5 14 Mechanical Dimensions of AXIMA ISA and ISA-STI-X AXIMA User’s Guide Understanding Motion in a Coordinate System There are four key concepts to understanding motion in a Coordinate System. 1. Coordinate System Hierarchy (the relationship between a Coordinate System, the Axes and a Motion Program). 2. How motion is generated. 3. Closed loop operation. 4. Motion program flow. The following paragraphs and figures will help you understand these concepts. Coordinate System Hierarchy The Coordinate System contains the axes and the Motion Program (in the hierarchy). The motion of the axes in a Coordinate System is controlled by the Motion Program. The Motion Program uses instructions to accomplish the motion including; jog, gear, move, sinusoidal move, etc. How Motion is Generated Axis motion is generated from any of four sources; the Coordinate System Profiler, Jog Profiler, Cam Profiler and the Gear Profiler. Any or all of these sources can generate profiles simultaneously. For example; while Gearing, a coordinated move, can be performed on top of the Gear Velocity. The sum of these four sources provides the commanded position and is called the Primary set point. The fact that these profiles are summed allows complex profiles and is a very powerful feature of the AXIMA controller. 15 P/N 400290-00 AXIMA User’s Guide Coordinated Move The most commonly used source for axis motion is the Coordinate System Move Profiler. All axes contained in the Coordinate System are treated as one vector. The vector has a velocity, an acceleration and a deceleration. The velocity of each axis is calculated to achieve the programmed vector velocity. All axes programmed within a move always start and stop at the same time. Consider the case where a single axis is moved. The direction of the move (vector direction) is along the motion of that (single) axis. The velocity of the single axis is exactly the velocity specified for the coordinate system vector (velocity, acceleration, deceleration are all coordinate system attributes). Figure 5 Coordinated Move Now consider the case where two axes are involved in a coordinated move, X axis will move five inches to the right and the Y axis moves five inches up. The vector direction is a 45° angle between the X and Y axes (see the Coordinated Move Figure above the Coordinated Move diagram above). The velocity specified (say ten inches/second) is the velocity along the vector direction (45° calculated by the AXIMA Software). This means that the velocity of the X and Y axes are less than ten inches/second (specifically the COS(45) times 10 inches/second or 7.07 inches/second for the X and Y axes). Jog Profiler The second method for generating motion is the Jog Profiler. There is a separate Jog Profiler for each axis. All jogging motion is done on an axis by axis basis there is no coordination between axes. The AXIMA Software allows Jog motion for multiple axes to be programmed in 16 Understanding Motion in a Coordinate System the same instruction, but the motion is not coordinated as it is when the Move Instruction is used. The Jog Profiler can be used for traditional type jogging, i.e. Accelerate, move at the programmed speed until told to decel and stop. The Jog Profiler can also be used to move a specified distance with accel and decel in either the incremental or absolute mode. Cam Profiler The third method of generating motion is the Cam Profiler. The Cam Profiler can be used to produce nonlinear repetitive type motions. The follower axis position is determined by a combination of master position and a cam table (local array). The cam table is a list of follower positions sorted in order of increasing master axis position. The master distance between each point within a segment is equal. Up to eight segments can be used for each cam allowing areas of coarse and fine cam increments. The AXIMA Software monitors the position of the master axis and moves the follower axis to the corresponding position according to the cam table linearly interpolating between follower points. The AXIMA Software also has instructions to automatically shift and scale the cam. The Cam Profiler does not provide for automatic acceleration or deceleration when engaging or disengaging a cam motion. Gear Profiler The Gear Profiler simply produces a follower axis command at the programmed ratio of a master axis or encoder. The ratio can be specified as a 32 bit floating point number or variable. Gear acceleration and deceleration parameters can also be applied when the gear function is turned on and off or when changes are made in the gear ratio. 17 AXIMA User’s Guide Figure 6 Axis Motion Calculations Diagram Secondary Set Point The final step in generating a command position is to add in the backlash and leadscrew position error compensation correction factors. This is added to the primary set point to generate the final commanded position, the secondary set point (see the Servo Loop Calculations diagram below). Another key AXIMA Software feature is that this final commanded position is calculated at each servo update interval providing updated trajectories of the highest possible accuracy. Closed Loop Operation The closed loop operation compares the final commanded position (secondary set point) to the encoder feedback to calculate a position error (following error). This following error is used by the Proportional, Integral and Derivative (PID) calculations to produce a term (in volts) for each calculation. Feedforward velocity and 18 Understanding Motion in a Coordinate System feedforward acceleration are open loop and use the commanded velocity and acceleration to produce a velocity and an acceleration term (in volts). Both feedforward terms are very useful in reducing following error. This is because the calculation is open loop, which means following error is not required to produce a command response. All of the terms are summed into the summation point. Filters may or may not be applied to the summed value. A low-pass and/or a notch filter may be used to reduce machine vibration. Lastly, the filter output signal may be limited by the command limit specified in the Axis Limits dialog box or in the command limit instruction. This result may be clamped to zero volts and the final output signal is sent to the digital to analog converter (DAC). The only effect on the actual voltage signal from this point on is the DAC gain and offset values. One of AXIMA Software’s most powerful features is the ability of the application programmer to access information. All of the axis commands, set points, summation points, closed loop terms and output values etc. shown in the Servo Loop Calculations diagram below can be accessed as Pre-defined Variables. 19 AXIMA User’s Guide Figure 7 20 Servo Loop Calculations AXIMA User’s Guide Understanding Programs The AXIMA Software has three different types of programs; PLC, Motion and Auxiliary. This gives you the flexibility needed to put you in control of your application. These three programs work together to solve the application. Typically, a PLC program is the “master controller”, monitoring status’s and controlling the Motion and Auxiliary Programs. The Motion Program controls the motion and usually the logic for the main sequence of operation. Auxiliary Programs cannot directly control any motion, and are typically used for such things as handling I/O communication with an external PLC, updating the AXIMA controller’s status display, serial operator interface and other data gathering. NOTE: Before you start writing programs, define the operation of your system and write it down. Consider more than just the motion. Consider the start/stop conditions, machine I/ O, the operator interface and the possible interface with an external PLC. Understanding this definition will help you define which functions to place in each program type and what data to share between programs. PLC Programs The purpose of the PLC Program is to monitor controller fault conditions, limits and safety/emergency actions. The PLC program allows the Motion Program to be written without concern of fault conditions or stop/hold inputs. Each Coordinate System has one PLC Program available with a maximum of 100 instructions. The PLC Program provides digital processing only. PLC instructions may reference only Global or Predefined Variables. Since all Pre-defined Variables are Global, a PLC 21 P/N 400290-00 AXIMA User’s Guide Program can control more than one Motion Program. PLC Programs are typically selected to run on power-up. A typical PLC Program would control the following functions: • • • • • • Drive Enable Outputs. Encoder Match (zero following error). Feed Hold and Cycle Start. Stop Motion. Motion Program Run/Halt. Axis Jog Control. Listed below, are detailed explanations of how the following example PLC Program controls the various system functions followed by a PLC Program example: 22 • Drive Enable Outputs are latched "On" when the Drive Enable Input is momentarily turned on. Drive Enable Outputs are turned off whenever the X or Y Over Travel Inputs are turned “On” or “Off”, or when the Coordinate System follower limit is exceeded. • When the Drive Enable Outputs are “Off”, an Encoder Match (zero following error) is performed for both axes. • If the Feedhold Input is turned “On”, a feedhold is requested. • The Cycle Start Input is used to resume the motion from a feedhold condition. • The Stop Input turns the Stop Move “On”, which decelerates the current move to a stop. When the In Motion bit is turned “Off”, indicating that the deceleration is complete, the Halt Motion Program bit is turned “On” stopping the Motion Program. • If a Reset Input is turned “On”, and the Motion Program is not running and the Stop Input is not “On”, a Motion Program Run Request will be issued. • Jogging is controlled with the Jog Mode and Jog Direction inputs. If the Drive Enable Output is “On”, a Jog Direction bit is set which causes the axis will jog at the predetermined jog velocity. Understanding Programs PLC Program Example: PLC Program with 32 instruction(s), will run on power-up. Load Contact DRIVES_ENABLE_PB Or Contact ENABLE_X_DRIVE And Not Contact X_OVER_TRAVEL_INPUT And Not Contact Y_OVER_TRAVEL_INPUT And Contact NOT_FOLLOWING_ERROR Output ENABLE_X_DRIVE Output ENABLE_Y_DRIVE Load Not Contact ENABLE_X_DRIVE Output X_ENC_MATCH Output Y_ENC_MATCH Load Contact FEED_HOLD_PB Output FEED_HOLD_REQ Load Contact CYCLE_START_PB And Not Contact IN_FEEDHOLD Output CYC_START_REQ Load Contact STOP_INPUT Output STOP_MOVE_REQ Load Contact STOP_INPUT And Not Contact IN_MOTION Output HALT_MOTION_PROG_REQ Load Not Contact STOP_INPUT And Contact RESTART_PB And Not Contact PROG_RUNNING Output MOTION_PROG_RUN_REQ Load Contact JOG_MODE_SELECT_INPUT And Contact X_JOG_LEFT_INPUT And Contact ENABLE_X_DRIVE Output X_JOG_FWD Load Contact JOG_MODE_SELECT_INPUT And Contact X_JOG_RIGHT_INPUT And Contact ENABLE_X_DRIVE Output X_JOG_REV 23 AXIMA User’s Guide Motion Programs Each Coordinate System contains one Motion Program which controls the motion and usually the logic for the main sequence of operation of all axes within that Coordinate System. In a typical application, the Motion Program would control multiple modes of operation such as Homing, Jogging and the Automatic Cycle. The best way to handle the different modes of operation is to program a subroutine for each mode. The beginning of the program will usually require a variable initialization section then a main loop with If/Then instructions used to call a specific subroutine. Motion Program Flow It is important to understand the flow of a Motion Program. Most instructions are obvious such as If/Then, GoTo, Call Subroutine, Wait, Dwell, etc. When the program encounters a Cam, Gear or Jog instruction it processes the instruction and starts the appropriate motion while the program continues on to process the next instruction without waiting for that motion to be completed. In the case of a Move Instruction, the motion profile is calculated and the move is started. Program execution will continue until another Move Instruction (or other program control instructions such as Wait, Dwell, etc.) is encountered. Since only one Move Instruction can be performed at a time, the program preprocess (buffers) the second move and suspends program execution until the first move is completed. The second Move Instruction is then executed and the program continues. Motion Program Example: Motion Program with 30 instruction(s) will run on power up Comment = Initialize variables, only exicutes the first time the Comment = program is run on power up or after a program halt. PART_COUNT = 0 LOAD_OFFSET = 1.0025 Set And Clear Bits Clear Bit HOME_COMPLETE LABEL = MAINLOOP 24 Understanding Programs If (HOME_INPUT ) Then Do Call Subroutine HOMESUBROUTINE End If/Then If (JOG_INPUT ) Then Do Call Subroutine JOGSUBROUTINE End If/Then If (AUTO_MODE_INPUT AND HOME_COMPLETE ) Then Do Call Subroutine AUTOMODESUBROUTINE End If/Then GoTo MAINLOOP LABEL = HOMESUBROUTINE Comment = add home logic and motion here Return From Subroutine LABEL = JOGSUBROUTINE Comment = Add jog definintion here. Comment = Jog logic and motion can be done here or Comment = in a PLC program, it usually easier in PLC program. Return From Subroutine LABEL = AUTOMODESUBROUTINE Comment = Add auto mode logic and motion here If (AUTO_MODE_INPUT AND NOT ( CYCLE_STOP_INPUT ) ) Then Do GoTo AUTOMODESUBROUTINE End If/Then Return From Subroutine 25 AXIMA User’s Guide Figure 8 Motion Program Flow Special types of moves such as Move Wait and Trigger Move operate differently. This operation is explained in the Move Instruction section. Auxiliary Programs Auxiliary Programs are contained at the application level. Therefore, Auxiliary Programs can not directly control the motion of an axis. Auxiliary programs typically use the Low Priority as High Priority is generally reserved for Motion Programs. Auxiliary Programs are limited to three instruction groups: Flow, Logic and Other. 26 Understanding Programs Auxiliary Program Example: The example Auxiliary Program shown below controls when an analog input value (converted to user "velocity" units) is added to the constant velocity of an axis's motion being controlled from a Motion Program. LABEL = TOP If (SET_WEB_SPEED) Then Do NEW_SPEED = 1 GoTo TOP End If/Then NEW_SPEED = 1 + (0.1*ADC_CHANNEL1) NEW_DWELL = 1 + ADC_CHANNEL2) GoTo TOP The following variables are used in this program: Name Scope Type Description NEW_DWELL Global Integer ADC_CHANNEL1 Pre-Defined Floating Point 32 Analog Input Number 1 ADC_CHANNEL2 Pre-Defined Floating point 32 Analog Input Number 2 NEW_SPEED Pre-Defined Floating Point 32 Coordinate System #1 Feedrate Override SET_WEB_SPEED Pre-Defined Bit Input Number 1 Referring to the example program, when the SET_WEB_SPEED input is on, the speed of the axis will remain unchanged (NEW_SPEED = 1), when this input is off, the value of ADC_CHANNEL1 (analog channel 1) will be added to the Feedrate Override which will change the velocity of the axis. 27 AXIMA User’s Guide Understanding Multitasking Program Priority Motion and PLC Programs are automatically assigned when a Coordinate System is defined. AXIMA Software has a total of 23 different user programs available in an Application. These 23 programs are made up of a combination of Motion, PLC and Auxiliary Programs. The maximum number of each program (Motion, PLC and Auxiliary) that you can have in an AXIMA Software application is shown below: MOTION PROGRAMS = 8 PLC PROGRAMS = 8 AUXILIARY PROGRAMS = 15 For example, if your Application had eight Coordinate Systems defined, you would automatically have eight Motion and PLC Programs giving you a total of sixteen user programs used. Therefore, you could assign up to seven Auxiliary Programs giving you a total of 23 user program in your Application. Each program is ‘prioritized’ for processor execution position and ‘timesliced’ for duration amount. This is necessary since there is only one Digital Signal Processor (DSP) contained within AXIMA controller. The goal is to maximize the DSP’s processing performance while providing smooth motion, efficient fault handling and fast I/O processing. Assigning Program Priorities There are a total number of eight High Priority programs available and generally speaking, these are Motion Programs (AXIMA Software’s default selection). Motion Programs are automatically assigned as High Priority when establishing the Coordinate System. 29 P/N 400290-00 AXIMA User’s Guide Likewise, the total number of Low Priority programs is set at seven which is initially assigned to the Auxiliary Programs as the default condition. Along with High and Low Priority programs, PLC Programs have the Highest Priority available. This priority level is strictly reserved for PLC Programs and is not changeable. For the 23 possible programs, the total number of priority assignments is as follows: HIGH PRIORITY PROGRAMS total = 8 (PLC only) HIGH PRIORITY PROGRAMS total = 8 (Motion or Auxiliary) LOW PRIORITY PROGRAMS total = 7 (Motion or Auxiliary) The default relationship between the High Priority (Motion) programs and Low Priority (Auxiliary) programs can be overwritten as necessary. To do so, select Advanced (indicated by a check mark in front) under Options in the toolbar section of the Application View dialog box. The next time the user enters any Motion or Auxiliary Program, the bottom right hand corner of the program indicates a radio button box for either High or Low Priority selection. Flexibility within the AXIMA Software allows the user to define Motion and Auxiliary Programs in any High or Low Priority fashion as long as all parameters listed previously are met. AXIMA Software is also designed to prevent the user from going beyond the stated limitations. For instance, if the user has already defined a maximum of eight High Priority programs, only Low Priority programs will automatically be added. AXIMA Software allows complete flexibility while easily providing access to define the application as defined by the machine or process requirements. Processing High and Low Priority Programs The rates of execution for a Highest Priority program is set at the Servo Loop Update Interval (SUI). The SUI is user selectable and is dependent on the total number of axes configured at the time of selection. Each PLC Program is limited to no more than 100 lines of 30 Understanding Multitasking Program Priority code. Since we have a total number of eight PLC Programs available, up to 800 lines of PLC code are possible. High Priority and Low Priority programs are defaulted in the Motion and Auxiliary Programs but limitations exist. The duration of processor execution on both High and Low Priority programs is set for a total of one millisecond each by the DSP. On average, the one millisecond execution block may process approximately 3 to 5 program instructions but this is very dependent upon instruction type. As of yet, no consideration has been given to updating the servo loops. After one millisecond of program execution, the DSP ‘holds’ the current program point in the process and moves on to the next program in the ‘execution cycle’. This process allows a single processor to multitask multiple programs. The difference between priority distinctions are that all High Priority programs and only one Low Priority program are executed within one execution cycle. During the next execution cycle, all High Priority programs are again executed for one millisecond each and the next Low Priority in the queue is executed. The process continues and repeats until halted. To further illustrate this concept, the following example would be a typical depiction of program priority execution for three High, and two Low Priority programs. Table 5 Program Priority Example High Low MP1 MP2 MP3 AP1 t0 t1 t2 t3 t4 t5 t6 t8 t9 t10 AP2 t7 t11… * where t x = one millisecond of fixed time to execute program instructions 31 AXIMA User’s Guide Figure 9 Program Priority Execution Program Priority Execution Interval Times The overall results of the DSP execution process should be considered, especially for larger applications. To calculate the interval of leaving one particular program and returning to that same program again, after processing other programs in the execution cycle, the user would want to know how long it may take. This could affect motion or any logic function if the time between operations is too long. The following equations would be the resultant after selection of High and Low Priority programs for the application: If no LOW PRIORITY and HIGH PRIORITY programs exist, then... PROGRAM TIME interval = (# of programs) * 1 msec If any LOW PRIORITY programs exists, then... PROGRAM TIME interval, High Priority = (1 + # of HIGH PRIORITY programs) * 1 msec PROGRAM TIME interval, Low Priority = [(1 + # of HIGH PRIORITY programs) * # of LOW PRIORITY programs] * 1 msec For the example outlined above, the time it would take to return to any one High Priority (Motion) program is four millisecond. It also 32 Understanding Multitasking Program Priority follows then that the Low Priority (Auxiliary) program time interval is eight millisecond. ! CAUTION If we were to maximize AXIMA Software’s capabilities in one Application and use all programs, the interval time to return to any particular High or Low Priority Program is nine millisecond and 63 millisecond respectively. This only takes into account the time interval returns to programs. The number and type of instructions within those programs will also have a bearing on Application performance. One can quickly realize that if an operation within a particular program is somewhat time dependent, understanding High and Low Priority interval times becomes crucial. If a program is halted or in a Wait state such as a Wait For Bit Instruction, no time is spent on the halted program and the next program in the execution string is executed. Effects of PLC Program (High Priority) on Processor Execution Time Since PLC Programs are defined as having the High Priority, one PLC Program will be scanned within one SUI. Since the AXIMA Software can achieve SUIs of 50 scanned within 50 Other factors still need to be considered to complete the controller requirements. The number of user selected PLC Programs are normally established during the design and configuration stages (with user limitations of eight total. This execution cycle follows the pattern detailed below: Therefore, if any PLC programs exists, then... PLC PROGRAMS total = PLC programs + 2 Because of PLC background operations, the AXIMA Software assigns two additional PLC programmed scan blocks to complete the needed process tasks. These two PLC time blocks evaluate the entire Application for all possible timers*, latches* and counters* in one program and scan the AXIMA "hardware" inputs & outputs (I/O) in the other. Therefore, the total number of PLC Programs can never be 33 AXIMA User’s Guide more than ten. (*Note: Indicated as TLC with a total limit of eight each for timers, latches and counters.) Like High and Low Priority programs, PLC Programs also have an execution cycle but it is exclusive to the High Priority Programs and all instructions are executed. Figure 10 PLC Program Execution Order The time it then takes to evaluate all of the PLC Programs, called the PLC execution cycle time, is: PLC EXECUTION CYCLE TIME = (PLC programs + 2) * SUI The PLC execution cycle is the time guaranteed to process all PLC instructions and PLC assigned I/O and this will vary from Application to Application. From our previous example, if we assume that only one PLC Program was needed to satisfy the Application and the SUI is set at the fastest rate of 200 second/axis with four axes), our PLC scan cycle would be 0.6 millisecond. But if we needed eight PLC Programs and the SUI rate was set at the longest time of 700 PLC cycle would then be 7.0 millisecond - more than ten times longer! Completing The Timeslicing Process ‘Picture’ With SUI The SUI is user selectable within the AXIMA Software and all axes will be updated within the SUI (up to 700 by the Watchdog timer). To change the default selection, (400 qual to 8 axes at 50 of Hierarchy Level at the Application View. Present the Application dialog box by ‘double clicking’ the Application Name on the right side’s Text View. 34 Understanding Multitasking Program Priority Under the Options button, select a different value in s step it may be wise to verify the axes setting number for the application. This will allow the appropriate update range for the SUI. To do so, select the Controller line under Options in the toolbar section of the Application View. This presents an Axes radio button area, among other items, to configuration the application to actual AXIMA hardware. The quicker the SUI rate setting, the more frequent the axes servo loops will be updated. But the frequency of faster updates takes processing duration away from Motion or Auxiliary Program instructions. Remember, Motion and Auxiliary Program execution time is fixed at one millisecond. at io n op P ca LC l c 2 ula tio Lo n o PL p c C alc TL ul C atio Lo n op P ca LC l c I/O ula tio Lo n o P pc LC a lc 1 ul at io Lo n op ca lc ul at io n ul 1 Lo LC P op ca lc LC Lo I/O lc ul at io n n ca P op Lo C PL op ca lc TL ula C tio at ul lc 2 LC Lo ca P op Lo P Lo op c L C alc 1 ula tio io n n Recommendations are therefore made to the user to select an SUI at the slowest allowable setting (while still receiving superb positioning and/or PLC updates as demanded by the application) to provide ample program instruction execution time. The goal is to balance DSP performance by providing as much processing time for all Motion, Auxiliary and PLC Programs and updating the servo loops adequately. T(msec) ime MP2 MP1 SUI 1 1 MP3 2 Figure 11 Timeslicing Process Diagram. A complete time line depicting our example, called ‘timeslicing’, is shown above. In this example, the SUI is set at 222 servo loops for an Application with three High Priority Motion Programs and two PLC Programs. The light gray area represents the actual duration of time to complete all servo loop updates. This verifies and commands the positioner to be on target at that moment in time. The duration of 35 AXIMA User’s Guide updating the servo loops will be less than the frequency of which these updates are needed, as indicated by extra dark gray and white time duration within one SUI time frame. The dark gray duration is the physical time required to scan one PLC program. This too is required to occur within one SUI. Together the combination of light and dark gray processing duration subtracted from the SUI represents the time remaining to accomplish Motion or Auxiliary program instructions. Added all together within a one millisecondof fixed time block, this becomes a significant factor of processor time. In this example, there is relatively little time remaining for adequately processing either Motion or Auxiliary Program instructions. Effect of Lengthening the SUI In the diagram in section 6, the SUI was set to approximately 222 effect of this setting is the low amount of processing time during 1 servo loop update interval given to execute instructions in either the Motion or Auxiliary programs. Lo op PL ca C lcu I.O la . tio n ns io ct ru st In n io ot M Lo o PL p c C alc TL ul C at io n io ot io n In st ru ct io M op c L C alc ul 2 at Lo P ct ru st In n io ot n io n tio M op c L C alc 1 ula P Lo ns ns To ensure more instructions are processed while not sacrificing motion or PLC performance, the diagram below illustrates the same scenario but with a slower SUI setting. Let us assume a new SUI setting of 700 rform as indicated in the ‘timeslice’ diagram below. T(msec) ime MP2 MP1 SUI 1 Figure 12 36 1 MP3 2 Timeslicing Servo Update Interval Diagram Understanding Multitasking Program Priority Timeslicing Process Consideration Conclusions You have complete control in the selection of updating the SUI within the AXIMA Software. The range is from 200 to 700 per system or 100 the quicker the servo loop will be updated. But the slower Motion and Auxiliary Programs will execute. A balance will need to be maintained to provide excellent system performance in all Application aspects. As a general design rule for larger Applications, as much of the system solution that can be achieved with PLC instructions should be attempted while selecting the slowest SUI frequency rate as possible (assuming motion is not adversely effected). This will guarantee the most processing of all Motion and Auxiliary Program instructions as possible. 37 AXIMA User’s Guide Communications Interface Overview This section describes the details that are required to interface an external interface to the AXIMA controller COM1 or COM2. This interface is accomplished with ASCII serial communications. The communications may be accomplished using either the RS-232C or RS232C/485 COM port. The RS485 specification supports up to 32 AXIMA controllers on a single multi-drop communications network. Addressing Each AXIMA controller has a unique address that is used to distinguish one controller from the next. Terminal Mode Communications In a multi-drop configuration you can communicate with any or all of the AXIMA controller's in your system using special control characters and echo modes. Echo Modes All non-zero addresses default to Echo Mode 6 at power-up. Any AXIMA controller with an address of zero will default to Echo Mode 1. Use the table below to set the desired Echo Mode. To change the Echo Mode type; echo# <CR>. Where # is the Echo Mode from the table below. 39 P/N 400290-00 AXIMA User’s Guide Table 6 Echo Modes Echo Mode Command Prompt Error Messages Character Echo 0 On On Off 1 On On On 2 On Off Off 3 On Off On 4 Off On Off 5 Off On On 6 Off Off Off 7 Off Off On Establishing Communications Use the table below to establish communications with individual or all addresses. Table 7 Establishing Communications Syntax 40 Result <CR> <CR> Send two carriage returns to activate serial ports and baud rate information. CNTL A <CR> Opens communications to all controllers. CNTL B <CR> Closes communications to all controllers. CNTL A <address> <CR> Opens communications to an individual controller. CNTL B <address> <CR> Closes communications to an individual controller. Communications Interface To simultaneously communicate with all addresses in a multi-drop system, all AXIMA controllers must be in Echo Mode 6. ! CAUTION Use caution when sending commands to more than one AXIMA controller simultaneously. Because all addresses are using Echo Mode 6, the AXIMA controllers do not echo a response. To verify that a command, or group of commands, was received by all addresses in your system, each address must be queried individually using Echo Mode 1. Also, sending a large number of commands simultaneously, such as an entire Application, could cause communication problems. For example In this example we will have two AXIMA controllers in a multi-drop configuration. Their addresses are 1 and 2. Upon power-up they will be in Echo Mode 6 (i.e. only responses to queries will be echoed back). Lets assume you want to communicate with AXIMA controller #1. To establish communications with AXIMA controller #1 type the following: Type Result <CR> <CR> Sends two carriage returns to activate serial ports and baud rate detection. CNTL B <CR> Closes communications to all AXIMA controllers in the system. (Not necessary but helpful to establish a starting point). CNTL A 1 <CR> Opens communications with AXIMA controller #1 only. Echo1 <CR> Changes the Echo Mode of AXIMA controller #1 to echo mode 1. Now that you have established communications, a set of commands are available for sending data to the AXIMA controller as well as retrieving data from the controller. 41 AXIMA User’s Guide For example If you wanted to query AXIMA controller #1 for the value of a Global Variable you previously defined in a program. For this example we will use the variable P1 and parameter P12291. Prompt/Display Result SYS>?P1 <CR> Queries AXIMA controller #1 for the value of P1 (Because we are in echo mode 1, the system prompt SYS> is displayed). SYS>643 The value of P1 is displayed. SYS>prog1 Move to program 1 level. PO1>?P12291 <CR> Queries AXIMA controller #1 for the value of P12291. 14 The value of P12291 is displayed. P01> PO1>Echo6 <CR> Changes the Echo Mode of AXIMA controller #1 to Echo Mode 6. The prompt is not displayed in Echo Mode 6. -14 ?P12291 was sent but only the value of variable is displayed. Echo1 <CR> was typed. PO1> The prompt is displayed again. Data Input/Output This following describes the retrieval of Global and Pre-defined Variables. Local Variables, input and output are not described here. Global and Pre-defined Variables are listed in the printout generated by the AXIMA Software. The printout includes the name and type for each variable. The basic names used by the AXIMA controller can also be included in the printout by checking the Advanced Mode option in the General tab in the Preferences dialog box (accessed from the Options menu). A fourth column is added to the list of variables and includes either a bit number or a P number. Bit numbers are used for digital information and P numbers are used for analog information. 42 Communications Interface Digital To send digital information to the AXIMA controller the command is BIT followed by the bit number, the equals sign and either one(1) or zero (0). For example SET 512 <CR> This will set bit 512. CLR 513 <CR> This will clear bit 513. To retrieve digital information from the AXIMA controller the command is question mark then BIT followed by the bit number. For example ?BIT 512 <CR> This will retrieve the status of bit 512. If bit 512 is off, a zero is returned, if it is on, a minus one (-1) is returned. Analog To send analog information to the AXIMA controller the command is "P" followed by the parameter number equals the new value. For example P8192 = 1 <CR> This will set P 8192 to the value of one (1). To retrieve digital information from the AXIMA controller the command is question mark then "P" followed by the parameter number. For example ?P8192 <CR> This will retrieve the status of parameter 8192. Both integer and floating point analog data is sent and retrieved in the same way. Obviously, floating point analog data must include the decimal point. 43 AXIMA User’s Guide Programming Examples Homing an Axis Example We want to position the carriage to the physical location of the external HOME_SWITCH sensor and then to the encoder maker. Gear Reducer External Home Sensor Motor With Resolver Carriage Offset Distance Mechanical Zero Point Figure 13 Homing Example The Move Type used in this example is an Interruptible Move (see Move Instruction in the Instructions section). When the program executes an Interruptible Move, the axis will start the move unless the “Interruptible on bit” is true in which case the “If interrupted” move is executed. 45 P/N 400290-00 AXIMA User’s Guide Example Program Motion program with 19 Instruction(s) will run on power-up Set Velocity To 0.25 inches/Sec Set Acceleration Ramp To 100.0 inches/Sec/Sec Set Deceleration Ramp To 100.0 inches/Sec/Sec LABEL = HOMING_AXIS_1 Comment = Program will suspend further execution until HOME_INITIATE (input 16) is set. Wait Until HOME_INITIATE is Set Comment = The HOME_DONE (output 48) is cleared. Set And Clear Bits Clear Bit HOME_DONE Comment = If the HOME_SWITCH (input 24) is set, the axis moves CCW 2 inches. If during this move the HOME_SWITCH is cleared or it's cleared to start with, the axis will move CCW 0.25 inches Move, Wait until complete Interruptible on bit HOME_SWITCH set, Axis -1 Incrementally CCW 2.0 inches If interrupted, incrementally CCW 0.25 inches Comment = Moves CW until the HOME_SWITCH (input 24) is set then moves CCW 0.25 inches. Move, Wait until complete Interruptible on bit HOME_SWITCH set, Axis -1 Incrementally CW 12.0 inches If interrupted, incrementally CCW 0.25 inches Comment = After HOME_SWITCH (input 24) is set the motor moves to the encoder marker (home position). Home, Axis-1 1.0 inches CCW (Rising, Encoder 1 Marker) Comment = Program will suspend further execution until HOME_COMP(Axis 1 capture complete) is set. Wait Until HOME_COMP is Set Comment = HOME_DONE (output 48) is set. Set And Clear Bits Set Bit HOME_DONE GoTo HOMING_AXIS_1 46 Programming Examples Product Alignment Example The AXIMA controller is used to align a product that is randomly feed onto a conveyer. Sensors connected to the AXIMA controller’s high speed inputs are used to detect the presence of each end the product as they move onto the conveyer. We used the Gear Instruction in a Motion Program to slave Axes 1 and 2 to Axis 3. The Encoder Capture Instruction is used to capture the position of each motors encoder as the product triggers each of the sensors. The encoder position values are stored as encoder counts in the “Hardware Capture” Pre-Defined Variable, and the “Capture Complete” bit is set. The motion program uses the “Phase Error” to align the product before it is transferred to the final conveyer. The phase error is calculated using the following formula: PE = HC1 - PP HC2 Where PE = Phase Error HC1 = Hardware Capture Axis #1 PP = Profiler Position HC2 = Hardware Capture Axis #2 The result is converted from encoder counts to user units and loaded into the Move Instruction which is used to advance or retard that belt to align the part. Notice the AXIMA controller is executing a Move Instruction on top of a Gear Instruction. 47 AXIMA User’s Guide Figure 14 Product Alignment Example Example Program Motion program with 26 Instruction(s) will run on power-up Set Velocity To 2.5 inches/Sec Set Acceleration Ramp To 100.0 inches/Sec/Sec Set Deceleration Ramp To 100.0 inches/Sec/Sec Comment = The Encoder Preload instruction sets all positions to zero. Encoder Preload, 48 Programming Examples Axis #1 to 0.0 inches, Axis #2 to 0.0 inches, Axis #3 to 0.0 inches, Comment = Defines the relationship between the master conveyor and slaves. Gear Definition, Axis #2 Encoder=3, Pulses=4096.0, Ratio=1.0:1.0, Preload=0.0, Axis #1 Encoder=3, Pulses=4096.0, Ratio=1.0:1.0, Preload=0.0 Comment = Turns the gearing on. Gear Control, Axis #1 On offset=0 counts, Axis #2 On offset=0 counts Comment = Defines the parameters to be used when jogging. Jog Definition, Axis #3 Velocity=2.0, Accel=100.0, Decel=100.0 LABEL = START Comment = The program is waiting for READY to be set before axis 3 jogs. Wait Until READY is Set Comment = Starts the jog as defined in Jog Definition for incoming conveyor. Jog Control, Axis #3 CW and Reset LABEL = LOOP Comment = Set an encoder capture as defined. Encoder Capture, Axis #1 (Rising, Input 24), Axis #2 (Rising, Input 25) Comment = The program will wait until axis 1 encoder capture is set Wait Until A1_CAP_COMP is Set Comment = The program will wait until axis 2 encoder capture is set. Wait Until A2_CAP_COMP is Set Comment = PHASER is phase Error calculated by AXIMA. PHASER = A1HARDCAP - PROFILER_POSITION - A2HARDCAP Comment = Phaser is in encoder counts and needs to be in user units. PHASERU = PHASER / 4096 Comment = Axis 1 will move the distance of PHASERU on top of the gearing. Move, Wait until complete, Axis #1 Incrementally CW PHASERU inches If (READY) Then Do GoTo LOOP 49 AXIMA User’s Guide End If/Then Jog Control, Axis #3 Stop and Reset GoTo START 50 Programming Examples Two Axis Gluing Example We use two axes (X and Y) to apply glue to the perimeter of a nine inch paperboard product with two inch radii rounded corners. Initially, an external shuttle (not shown in the diagram below) moves the paperboard into position triggering a sensor. If sensor input conditions are met (verified by the PLC program), the Motion Program moves the glue tip applicator to a start position above the paperboard. Upon reaching the start position, glue is dispensed during the X-Y travel outlining a nine inch square with two inch radii rounded corners. The process will continue again and again as long as paperboard is shuttled and no error conditions occur. Figure 15 Two Axis Gluing Application 51 AXIMA User’s Guide Input condition checking is accomplished by the PLC Program for certain machine state requests. For example, stop conditions from either paperboard jam, operator inputs of either normal Stop or Emergency Stop (E-Stop), or excessive following error buildup. Each results in different recovery schemes and could be very useful in many other applications as well. Since the AXIMA Software and controller provides both circular interpolation and compounded indexing capabilities, continuous path velocities are possible. This yields a glue bead that is uniform throughout X-Y motion and requires less On/Off control of the glue dispenser solenoid. The end results are faster throughputs, higher qualities, larger yields and reduced machine component wear. Variables Used: Inputs (defined and assigned by User) START_HOME Bit Pre-defined BIT 0 PAPERBOARD_PRESENT Bit Pre-defined BIT 1 RUN Bit Pre-defined BIT 2 RESUME_PROCESS Bit Pre-defined BIT 3 X_HOME_SENSOR Bit Pre-defined BIT 24 Y_HOME_SENSOR Bit Pre-defined BIT 25 STOP_PROCESS Bit Pre-defined BIT 30 E_STOP Bit Pre-defined BIT 31 Outputs (defined and assigned by User) 52 X_AXIS_ENABLE Bit Pre-defined BIT 32 Y_AXIS_ENABLE Bit Pre-defined BIT 33 JAM_ALARM Bit Pre-defined BIT 37 MACHINE_STOPPED Bit Pre-defined BIT 38 GLUING Bit Pre-defined BIT 39 Programming Examples Global References (defined by User) DISPENSE_GLUE_OK Bit Global BIT 128 PAPERBOARD_GLUED Bit Global BIT 129 ENABLE_DRIVES Bit Global BIT 130 OK_TO_RUN Bit Global BIT 131 PAPERBOARD_JAM Bit Global BIT 132 Internal References (assigned by User) IN_MOTION Bit Pre-defined BIT 516 IN_FEEDHOLD Bit Pre-defined BIT 519 FEEDHOLD_REQUEST Bit Pre-defined BIT 520 CYCLE_START_REQUEST Bit Pre-defined BIT 521 NOT_FOLLOWING_ERROR Bit Pre-defined BIT 529 X_MARKER_CAPTURE_COMPLE Bit Pre-defined BIT 777 Y_MARKER_CAPTURE_COMPLE Bit Pre-defined BIT 809 HALT_MOTION_PROGRAM Bit Pre-defined BIT 033 RUN_MOTION_PROGRAM Bit Pre-defined BIT 1032 Example Program Motion Program with 50 instruction(s) will run on power-up Comment = The next 3 instructions set the profile for the Homing Routine's acceleration, deceleration and speed. Set Acceleration Ramp To 10.0 inches/Sec/Sec Set Deceleration Ramp To 10.0 inches/Sec/Sec Set Velocity To 5.0 inches/Sec Comment = The Encoder Match instruction zeros out any accumulated following error, regardless of current position. This in effect will prevent unwanted motor motion. Encoder Match, X-axis, Y-axis Comment = The next 3 instructions initiate a Global bit for the PLC program to enable the drives (Output's #32 & #33). Setting, dwelling and clearing of a Global bit in this Motion Program is the basis for the PLC Program’s latching circuit (see PLC program). Set And Clear Bits 53 AXIMA User’s Guide Set Bit ENABLE_DRIVES Dwell For 0.1 Seconds Set And Clear Bits Clear Bit ENABLE_DRIVES Comment = The many following instruction constitute a Homing Routine. LABEL = HOME_ROUTINE Comment = The following Wait Until instruction holds the program until Start Home input (Input #0) is set. Wait Until START_HOME is Set Comment = The following Home instruction move each axis in a direction toward external sensors (X-axis > Input #24 and Y-axis > Input #25). Home, X-axis 20.0 inches left (Rising, Input 24) Wait Until X_MARKER_CAPTURE_COMPLETE is Set Wait Until IN_MOTION is Clear Home, Y-axis 20.0 inches down (Rising, Input 25) Wait Until Y_MARKER_CAPTURE_COMPLETE is Set Wait Until IN_MOTION is Clear Comment = The following Homes instructions rotate the axes to the motor's marker (make sure to complete at least one revolution). This reduces exact sensor location error. Home, X-axis 1.1 inches right (Rising, Encoder 1 Marker) Wait Until X_MARKER_CAPTURE_COMPLETE is Set Wait Until IN_MOTION is Clear Home, Y-axis 1.1 inches up (Rising, Encoder 2 Marker) Wait Until Y_MARKER_CAPTURE_COMPLETE is Set Wait Until IN_MOTION is Clear Comment = The following Encoder Preload instruction establishes the machine's repeated absolute 'Zero Point' (assuming the motors were not removed from last Powered State and the Home Sensors weren’t grossly moved). Encoder Preload, X-axis to 0.0 inches, Y-axis to 0.0 inches Comment = HOME ROUTINE END Comment = The following 3 instructions establishes new acceleration, deceleration and speed for normal machine operation. Set Acceleration Ramp To 75.0 inches/Sec/Sec Set Deceleration Ramp To 75.0 inches/Sec/Sec Set Velocity To 20.0 inches/Sec 54 Programming Examples Comment = The following Batch Routine sets up the process. LABEL = BEGIN_BATCH Comment = The following Wait instruction holds the program until Input #2 is set. This is the operator's RUN button which is monitored by the PLC program. Wait Until OK_TO_RUN is Set Comment = The following If/Then instruction initiates a ‘Clear Paperboard’ alarm if it occurred later in the program. This is enunciated by the PLC program. If (PAPERBOARD_JAM) Then Do Set And Clear Bits Clear Bit PAPERBOARD_JAM End If/Then Comment = The following Wait instruction holds the program until new paperboard has been sensed (Input #1). Wait Until PAPERBOARD_PRESENT is Set Comment = The following Move & Wait instruction is a move to pattern start point with no glue being dispensed along the way. Move & Wait, X-axis To Absolute Position 3.0 inches, Y-axis To Absolute Position 4.0 inches Comment = The following Glue Pattern Routine establishes a 9" rounded corner square on the paperboard. LABEL = CORNERED_SQUARE_LOOP Comment = ALL MOVES WITHIN THE PATTERN ARE COMPOUNDED TO PROVIDE A CONTINUOUS PATH VELOCITY PROFILE. This increases system efficiency and distributes a uniform glue bead whether on a straight side or on the arc. Comment = The following Set Bit instruction will send the PLC program a Global Bit stating O.K. to dispense glue. (The PLC Program will determine if all other conditions have been met as well.) Set And Clear Bits Set Bit DISPENSE_GLUE_OK Comment = The following Move instruction is a linear move to the right along the bottom horizontal side. Compound Move, X-axis Incrementally right 5.0 inches Comment = The following Sinusoidal Move instruction is a 90 degree arc to turn CCW to meet the right vertical side. Compound Sinusoidal Move, X-axis Destination=10.0 inches, Sweep=90.0, Phase=0.0, Amplitude=2.0, Y-axis Destination=6.0 inches, Sweep=90.0, Phase=270.0, Amplitude=2.0 Comment = The following Move instruction is a linear move outward along the right vertical side. 55 AXIMA User’s Guide Compound Move, Y-axis Incrementally up 5.0 inches Comment = The following Sinusoidal Move instruction is a 90 degree arc to turn CCW to meet the far horizontal side. Compound Sinusoidal Move, X-axis Destination=8.0 inches, Sweep=90.0, Phase=90.0, Amplitude=2.0, Y-axis Destination=13.0 inches, Sweep=90.0, Phase=0.0, Amplitude=2.0 Comment = The following Move instruction is a linear move along the far horizontal side. Compound Move, X-axis Incrementally left 5.0 inches Comment = The following Sinusoidal Move instruction is a 90 degree arc to turn CCW to meet the left vertical side. Compound Sinusoidal Move, X-axis Destination=1.0 inches, Sweep=90.0, Phase=180.0, Amplitude=2.0, Y-axis Destination=11.0 inches, Sweep=90.0, Phase=90.0, Amplitude=2.0 Comment = The following Move instruction is a linear move inward along the left vertical side. Compound Move, Y-axis Incrementally down 5.0 inches Comment = The following Sinusoidal Move instruction is a 90 degree arc to turn CCW to meet the near horizontal side. Note that the Wait Until In Motion is Cleared check box was used. This will allow the glue dispenser to continue dispensing until the exact moment motion is stopped (view the very next instruction). Had this option not been selected, the dispenser would have stopped just after this Sinusoidal Move instruction was commanded. Sinusoidal Move and Wait, X-axis Destination=3.0 inches, Sweep=90.0, Phase=270.0, Amplitude=2.0, Y-axis Destination=4.0 inches, Sweep=90.0, Phase=180.0, Amplitude=2.0 Comment = The following Set Bit instruction will send the PLC Program a Global Bit stopping the dispensing of glue. Set And Clear Bits Clear Bit DISPENSE_GLUE_OK Comment = The following Dwell allows for glue to stop dripping from the dispenser tip. Dwell For 0.085 Seconds Comment = The following routine portion will evaluate paperboard removal (with glue). If paperboard is not removed, or 'jam' detected, then a return to 'Zero Point' is sent. Comment = The following Set Bit instruction sends a Global bit to the PLC to initiate paperboard (with glue) removal. Set And Clear Bits Set Bit PAPERBOARD_GLUED 56 Programming Examples Comment = The following Dwell allows for removal of the paperboard using the PLC program's, Output #40, control of an external solenoid. Dwell For 0.257 Seconds Comment = The following If/Then instruction will prevent continuance if paperboard is not cleared. If (PAPERBOARD_PRESENT) Then Do Comment = The following Set Bit instruction alarms the operator that a potential paperboard 'jam' has occurred. This Global Bit is seen by the PLC program for processing. Set And Clear Bits Set Bit PAPERBOARD_JAM Comment = The following Move instruction is a return to the 'Zero Point'. This allows manual paperboard removal without obstruction from mechanical machine elements. Move, X-axis To Absolute Position 0.0 inches, Y-axis To Absolute Position 0.0 inches Comment = The following Clear Bit instruction sends a Global bit to the PLC program which drops out the RUN contact. Set And Clear Bits Clear Bit OK_TO_RUN Comment = The following Go To instruction sends the program back to the Batch Routine to start again. GoTo BEGIN_BATCH End If/Then Comment = The following Wait instruction holds the program until new paperboard has been sensed (Input #1). Wait Until PAPERBOARD_PRESENT is Set Comment = The following unconditional Go To instruction directs the program to the continual production process. GoTo CORNERED_SQUARE_LOOP PLC Program with 27 instruction(s) will run on power-up Load Contact ENABLE_DRIVES Or Contact X_AXIS_ENABLE Or Contact Y_AXIS_ENABLE Load Contact NOT_FOLLOWING_ERROR And Load Output X_AXIS_ENABLE Output Y_AXIS_ENABLE Load Contact RUN Output OK_TO_RUN Load Not Contact IN_FEEDHOLD 57 AXIMA User’s Guide And Contact IN_MOTION And Contact DISPENSE_GLUE_OK Output GLUING Load Contact PAPERBOARD_JAM Output JAM_ALARM Load Contact STOP_PROCESS Output FEEDHOLD_REQUEST Load Contact RUN And Contact IN_FEEDHOLD Output CYCLE_START_REQUEST Load Contact E_STOP Or Not Contact NOT_FOLLOWING_ERROR Output HALT_MOTION_PROGRAM Load Contact JAM_ALARM Or Contact FEEDHOLD_REQUEST Or Contact IN_FEEDHOLD Output MACHINE_STOPPED 58 Programming Examples MX/AXIMA Communications Example This example demonstrates how to read the value of an MX drive parameter (Pr83, motor position) and write to an MX parameter (Pr01, Digital Speed Preset). The protocol is documented in the serial communications section of the MX manual. Two MX parameters (Pr22 and Pr23) and three bits (b21, b51, and b52) need to be properly entered before communications can be established. Information on these parameters and bits can be found in the MX manual. The MX drive’s serial communications plug D and AXIMA controller’s COM 2 serial port should be wired as shown in the following diagram: Figure 16 AXIMA To MX Drive Serial Communications Diagram The AXIMA controller's COM 2 port must be configured for RS422 communications. To configure the AXIMA controller's COM 2 serial port for RS422 communications, perform the following procedure: 1. Set jumper JP3 to 422 (between pins 2 and 3). 2. Remove JP1 of the daughterboard by cutting it with a wire cutter. The following AXIMA Motion Program is used to establish serial communications between an AXIMA controller and an MX drive. The variable "Motor Position" (P0), is defined as a global integer. 59 AXIMA User’s Guide Example Program Motion Program with 25 instruction(s) LABEL = MAIN_LOOP Call Subroutine COMMUNICATIONS Comment = Reset encoder to the value read from Pr 83. Encoder #1, Reset To MOTOR_POSITION GoTo MAIN_LOOP LABEL = COMMUNICATIONS Comment = Dimension 2 string variables of 10 characters each. Generic = DIM $V(2,10) Comment = Open com port 2 for 19200 baud, no parity, 8 data bits, 1 stop bit Generic = OPEN "COM2:19200,N,8,1" AS #2 Comment = Write -1000 rpm into Pr01 of the MX. Generic = PRINT #2, CHR$(4)+"0011"+CHR$(2)+"011000"+CHR$(3)+CHR$(13) Comment = Dwell for short time to separate the print statements for MX drive processing. Dwell For 0.1 Seconds Comment = Query the MX drive for Pr 83. Generic = PRINT #2, CHR$(4)+"001183"+CHR$(5) Comment = Put response in string variable $V0. Generic = INPUT #2, $V0 Comment = Strip away all characters from the response except for the data asked for. Generic = $V1=MID$($V0,5,4) Comment = P0 is the variable called motor position. VAL converts a character string to a number. Generic = P0=VAL($V1) Comment = Close com port 2. Generic = CLOSE #2 Return From Subroutine 60 Programming Examples T60/AXIMA Communications Example The T-60 BUILD program in this example shows how to program the T60/T61 in order to communicate with an AXIMA controller. An example of the T-60/61 pseudocode is included to show: 1. How to establish communications and verify the AXIMA controller’s address. 2. How to monitor machine status. 3. How to verify, with every reply received, that communications are up and running. 4. How to build subroutines that open communications, send messages, and get replies. Example Program GOTO SCREEN begin *>SCREEN begin COMMENT "Open communications and verify that communications work by querying" COMMENT "the AXIMA's address (0). P4098 is a parameter in which the 5 least" COMMENT "significant bits are the address. Anding with 255 masks the" COMMENT "nonaddress bits. The additional three bits are verified to be in an" COMMENT "off position. If multiple AXIMAs with different addresses are to be" COMMENT "communicated with, then the decimal equivalents of the ASCII" COMMENT "control characters CNTL A and CNTL B must be used to open and close" COMMENT "communications with the individual AXIMAs." PUT TEXT AT (7,2): "Checking Communications ..." GOSUB opencom msg$ = "?P4098AND255" GOSUB sendmsg GOSUB getreply IF noreply% = 1 THEN resp$="NO REPLY" IF (noreply%=0 AND VAL(reply$)=0) THEN resp$="READY" 61 AXIMA User’s Guide IF (noreply%=0 AND VAL(reply$)<>0) THEN resp$="WRONG ADDRESS" PUT TEXT AT (7,4): "Status:" PUT TEXT AT (16,4): resp$ DELAY 2000 IF resp$="READY" THEN GOTO checkflt SOFTKEY (2) "RETRY" GOTO SCREEN begin SOFTKEY WAIT COMMENT "This screen runs in a continuous loop to query the AXIMA for machine" COMMENT "faults. Loss of communications is checked along with the fault" COMMENT "status. Bit 137 is an example of a user defined global bit in the" COMMENT "AXIMA PLC program that is monitored to determine if a fault has" COMMENT "occurred." *>SCREEN checkflt PUT LARGE TEXT AT (4,1): "MACHINE STATUS" msg$ = "?bit137" GOSUB sendmsg GOSUB getreply IF noreply%=1 THEN GOTO lostcomm IF reply$ = "0" THEN GOTO sysflt PUT TEXT AT (7,4): "All Systems are operating." DELAY 2000 GOTO checkflt LABEL sysflt PUT TEXT AT (7,4): "FAULT HAS OCCURRED !!!!!!" DELAY 2000 GOTO checkflt *>SCREEN lostcomm PUT TEXT AT (6,2): "LOST COMMUNICATIONS WITH AXIMA" PUT TEXT AT (4,4): "Press RETRY to attempt to establish" PUT TEXT AT (4,5): "communications." SOFTKEY (2) "RETRY" GOTO SCREEN begin SOFTKEY WAIT COMMENT "*************** Subroutines **********************" COMMENT "Open communication ports. Com 1 and Com 2 are RS232." COMMENT "Procedure is to send at least one carriage return, then put AXIMA" COMMENT "into echo 6 mode." STOP LABEL opencom COM: INIT COM 1 ECHO 0 BAUD 192 HANDSHAKE 0 TIMEOUT 0 STRIP 0 62 Programming Examples COM: INIT COM 2 ECHO 0 BAUD 192 HANDSHAKE 0 TIMEOUT 0 STRIP 0 msg$ = CHR$(13) GOSUB sendmsg DELAY 100 msg$ = CHR$(13) GOSUB sendmsg DELAY 100 msg$ = "echo6" GOSUB sendmsg DELAY 100 RETURN COMMENT "Build message string by taking message and adding a carriage return" COMMENT "to it. Send message out Com 1 with Print statement." STOP LABEL sendmsg COM: INIT COM 1 ECHO 0 BAUD 192 HANDSHAKE 0 TIMEOUT 100 STRIP 0 msg$ = msg$ + CHR$(13) PRINT #1, msg$; RETURN COMMENT "Read reply in from AXIMA with Line input statement." COMMENT "Check to see that there actually was a reply." STOP LABEL getreply LINE INPUT #1, reply$ IF LEN(reply$) = 0 THEN noreply%=1 ELSE noreply%=0 RETURN END OF PSEUDOCODE 63 AXIMA User’s Guide T-60 and T61 RS232C/RS485 Wiring Diagrams Figure 17 T-60 to AXIMA RS232C Serial Communications Figure 18 T-60 to AXIMA RS485 Serial Communications NOTE: Figure 19 64 If you use an RS485 configuration, you must add the basic instruction "RS422 ON, #1" to your T-60 or T-61 build program in the "OPENCOM" subroutine, after the "COM: INIT COM 1.…" pseudocode. T-61 to AXIMA RS232C Serial Communications Programming Examples Figure 20 T-61 to AXIMA RS485 Serial Communications Cam Example This example demonstrates the steps required to run cam profiles with the AXIMA controller. The application used in the example is a flying cut-off mechanism. The master axis is an encoder which is monitoring the speed of a continuously moving web of material to be cut (imagine cutting a continuous web of paper into eight foot long sheets). The follower axis is the flying cut-off head which is controlled by the AXIMA controller. The cycle sequence is as follows: 1. The flying cut-off head accelerates from a stop to matched speed with the web. 2. The cutting knife is activated to cut the web while at matched speed. 3. The cut-off head decelerates to a stop and reverses direction to return to the start position. 4. The cut-off head waits until it is time to start the next cut. 65 AXIMA User’s Guide 5. The part length is determined by the rollover point of the master cycle. Figure 21 Flying Cut-off Example To create the cam profile we created a spreadsheet with Microsoft Excel®. This spreadsheet creates the cam profile using master position and follower velocity information. The output of the spreadsheet is a table of corresponding master and follower axis positions. In the motion program, the master axis is a second motor which can be jogged back and forth (fast or slow) using inputs 16 to 19, to allow the user to see how the cam profile will perform. The Motion Program can be summarized as follows: • 66 The two LX drives are enabled. Programming Examples • Both axes’ positions are set to 0.0 • The cam profile is defined (this consists of putting the cam profile positions into the array variables used by the cam functions) • The cam profile is setup and started. This is well commented in the program. • The main loop of the program is used for jogging of the master axis using inputs 16 - 19. Calculating a Cam Profile Shown below is the Excel spreadsheet we used to calculate the cam profile for the AXIMA Software’s Motion Program. Cam Profile Generation Spreadsheet Worksheet Setup Master Axis Units in Follower Axis Units in Follower Scale (Units/Motor Rev.) 1 in/rev Max Speed of Master Axis 20 in/sec Mapping Interval (>= 2 ms) 4 ms Initial Follower Position = 0 in Calculated Motor Sizing Parameters Max. Speed of Follower Motor #### rpm Max. Accel. of Follower Motor 200 rev/s^2 Steps Sug. Steps Enter These Values Segment # Master Position (in) Follower Velocity (in/in) 0 0 0 1 2 1 20 25 2 8 1 1 1 3 10 0 20 25 4 12 -1 20 25 5 18 -1 1 1 67 AXIMA User’s Guide Cam Profile Generation Spreadsheet 6 20 0 20 25 7 30 0 1 1 Figure 22 Cam Profile Graph The Pre-defined Variables and the AXIMA Software’s programs used in this Application examples are listed on the following pages: 68 Programming Examples Variables Used: Enable_Master Bit Pre-defined BIT 32 Enable_Follower Bit Pre-defined BIT 33 Input_16 Bit Pre-defined BIT 16 Jogging Bit Pre-defined BIT 792 Jog_Forward Bit Pre-defined BIT 796 Input_17 Bit Pre-defined BIT 17 Jog_Reverse Bit Pre-defined BIT 797 Input_18 Bit Pre-defined BIT 18 Input_19 Bit Pre-defined BIT 19 Pre-defined Variables for Flying Cut-off Machine Distance Into Move (Float) 8192 Vector Velocity (Float) 8193 Vector Acceleration (Float) 8194 Vector Length (Float) 8196 Target Velocity (Float) 8197 Distance To Go (Float) 8200 Feedrate Override (Float) 8201 Manual Vector (Float) 8202 Total Distance (Float) 8203 Distance Squared (Float) 8204 Velocity Squared (Float) 8205 Fraction Into Move (Float) 8206 Fraction Into Path (Float) 8207 (Integer) 8208 Accelerating (Bit) 512 Decelerating (Bit) 513 Stopping (Bit) 514 In Motion (Bit) 516 Move Buffered (Bit) 517 Feedholding (Bit) 518 In Feedhold (Bit) 519 Move Counter 69 AXIMA User’s Guide 70 Feedhold Request (Bit) 520 Cycle Start Request (Bit) 521 Kill Move Request (Bit) 522 Stop Move Request (Bit) 523 Final Velocity Zero Pending (Bit) 524 Final Velocity Zero Active (Bit) 525 Feedrate Override Lock Pending (Bit) 526 Feedrate Override Lock Active (Bit) 527 Not In Position (Bit) 528 Not Following Error (Bit) 529 Within Travel Limit A (Bit) 530 Not Within Travel Limit B (Bit) 531 Not Command Limit (Bit) 532 Not In Command Band (Bit) 533 Decrement Count (Bit) 536 Increment Count (Bit) 537 Interrupt On Move (Bit) 538 Trigger Pending (Bit) 539 Start Move Inhibit (Bit) 540 Encoder Match Request (Bit) 541 Programming Examples Pre-defined Variables for Motion Program Program Running (BIT) 1024 Program Dwelling (BIT) 1025 Program Inhibited (BIT) 1026 Move Pending (BIT) 1027 Program Timeout (BIT) 1028 Program Modified (BIT) 1029 Run Request (BIT) 1032 Halt Request (BIT) 1033 Example Program Motion Program with 190 instruction(s) will run on power-up Local Variables CAM_SEGMENT_0(21) Integer LA0 CAM_SEGMENT_1(2) Integer LA1 CAM_SEGMENT_2(41) Integer LA2 CAM_SEGMENT_3(2) Integer LA3 CAM_SEGMENT_4(21) Integer LA4 CAM_SEGMENT_5(2) Integer LA5 Instructions Set And Clear Bits Set Bit ENABLE_MASTER Set Bit ENABLE_FOLLOWER Comment = Enable both drives. Encoder Preload , Master Axis to 0.0 inches, Follower Axis to 0.0 inches Comment = Zero the position of each axis. Call Subroutine DEFINE_CAM_PROFILE Update Status Display Left Digit = C Right Digit = P Call Subroutine START_CAM_PROFILE LABEL = MAIN_LOOP Comment = This main loop allows jogging of the master Comment = axis using inputs 16-19. Comment = Input 16: Jog Reverse Fast 71 AXIMA User’s Guide Comment = Input 17: Jog Reverse Slow Comment = Input 18: Jog Forward Slow Comment = Input 19: Jog Forward Fast If (INPUT_19 ) Then Do Jog Definition Master Axis Velocity=30.0, Accel=500.0, Decel=500.0 Set And Clear Bits Set Bit JOG_FORWARD Cam Flying Cut-off 4/12/1996 03:00:01 PM Wait Until INPUT_19 is Clear Set And Clear Bits Clear Bit JOG_FORWARD End If/Then If (INPUT_16 ) Then Do Jog Definition , Master Axis Velocity=30.0, Accel=500.0, Decel=500.0 Set And Clear Bits Set Bit JOG_REVERSE Wait Until INPUT_16 is Clear Set And Clear Bits Clear Bit JOG_REVERSE End If/Then If (INPUT_18 ) Then Do Jog Definition , Master Axis Velocity=1.0, Accel=50.0, Decel=50.0 Set And Clear Bits Set Bit JOG_FORWARD Wait Until INPUT_18 is Clear Set And Clear Bits Clear Bit JOG_FORWARD End If/Then If (INPUT_17 ) Then Do Jog Definition , Master Axis Velocity=1.0, Accel=50.0, Decel=50.0 Set And Clear Bits Set Bit JOG_REVERSE Wait Until INPUT_17 is Clear Set And Clear Bits Clear Bit JOG_REVERSE End If/Then GoTo MAIN_LOOP LABEL = START_CAM_PROFILE 72 Programming Examples Comment = This subroutine sets up and initiates the cam profile. Generic = CAM DIM B6 Comment = First cam profile B (axis 2) is dimensioned to have 6 segments. Generic = CAM SRC B0 Comment = The CAM SRC B0 command assigns the master axis encoder as 0 (Axis 1) for cam profile B. Generic = CAM SEG B(0,8192,LA0) Comment = Acceleration Segment Comment = The CAM SEG commands set up each of the Cam segments (in cam profile B). Comment = Segment 0 is used for the first 8192 master axis encoder counts. Comment = LA0 is the array variable of evenly spaced follower positions. Comment = LA0 is the same as the CAM_SEGMENT_0 variable assigned below. Comment = To see what variables are assigned to which labels (like LA0), turn on advanced mode and look in the Variables screen (see "Variables" button in this dialog box). Generic = CAM SEG B(1,24576,LA1) Comment = Run forward at speed segment Generic = CAM SEG B(2,16384,LA2) Comment = Decelerate and Accelerate Backwards Segment Generic = CAM SEG B(3,24576,LA3) Comment = Run backwards at speed segment Generic = CAM SEG B(4,8192,LA4) Comment = Decelerate to a stop segment Generic = CAM SEG B(5,40960,LA5) Comment = Wait in position segment Comment = Changing the length of this segment will change the part length. Generic = CAM SCALE B 0.0001 Comment = The CAM SCALE command is used to convert the Comment = follower positions stored in the integer profile arrays back into units that make sense. Generic = CAM FLZ B0 Comment = This CAM FLZ command sets profile B's offset to 0. Generic = CAM ON B Comment = The CAM ON command start the cam profile (profile B here). Return From Subroutine LABEL = DEFINE_CAM_PROFILE Comment = Cam Segment 0 Follower Position Points Comment = (Accel Ramp) (integer values) CAM_SEGMENT_0 ( 0 ) = 0 73 AXIMA User’s Guide CAM_SEGMENT_0 ( 1 ) = 25 CAM_SEGMENT_0 ( 2 ) = 100 CAM_SEGMENT_0 ( 3 ) = 225 CAM_SEGMENT_0 ( 4 ) = 400 CAM_SEGMENT_0 ( 5 ) = 625 CAM_SEGMENT_0 ( 6 ) = 900 CAM_SEGMENT_0 ( 7 ) = 1225 CAM_SEGMENT_0 ( 8 ) = 1600 CAM_SEGMENT_0 ( 9 ) = 2025 CAM_SEGMENT_0 ( 10 ) = 2500 CAM_SEGMENT_0 ( 11 ) = 3025 CAM_SEGMENT_0 ( 12 ) = 3600 CAM_SEGMENT_0 ( 13 ) = 4225 CAM_SEGMENT_0 ( 14 ) = 4900 CAM_SEGMENT_0 ( 15 ) = 5625 CAM_SEGMENT_0 ( 16 ) = 6400 CAM_SEGMENT_0 ( 17 ) = 7225 CAM_SEGMENT_0 ( 18 ) = 8100 CAM_SEGMENT_0 ( 19 ) = 9025 CAM_SEGMENT_0 ( 20 ) = 10000 Comment = Cam Segment 1 Follower Position Points (Run at Speed) CAM_SEGMENT_1 ( 0 ) = 10000 CAM_SEGMENT_1 ( 1 ) = 70000 Comment = Cam Segment 2 Follower Profile Points (Decel and Accel Backwards) CAM_SEGMENT_2 ( 0 ) = 70000 CAM_SEGMENT_2 ( 1 ) = 70975 CAM_SEGMENT_2 ( 2 ) = 71900 CAM_SEGMENT_2 ( 3 ) = 72775 CAM_SEGMENT_2 ( 4 ) = 73600 CAM_SEGMENT_2 ( 5 ) = 74375 CAM_SEGMENT_2 ( 6 ) = 75100 CAM_SEGMENT_2 ( 7 ) = 75775 CAM_SEGMENT_2 ( 8 ) = 76400 CAM_SEGMENT_2 ( 9 ) = 76975 CAM_SEGMENT_2 ( 10 ) = 77500 CAM_SEGMENT_2 ( 11 ) = 77975 CAM_SEGMENT_2 ( 12 ) = 78400 CAM_SEGMENT_2 ( 13 ) = 78775 CAM_SEGMENT_2 ( 14 ) = 79100 CAM_SEGMENT_2 ( 15 ) = 79375 CAM_SEGMENT_2 ( 16 ) = 79600 74 Programming Examples CAM_SEGMENT_2 ( 17 ) = 79775 CAM_SEGMENT_2 ( 18 ) = 79900 CAM_SEGMENT_2 ( 19 ) = 79975 CAM_SEGMENT_2 ( 20 ) = 80000 CAM_SEGMENT_2 ( 21 ) = 79975 CAM_SEGMENT_2 ( 22 ) = 79900 CAM_SEGMENT_2 ( 23 ) = 79775 CAM_SEGMENT_2 ( 24 ) = 79600 CAM_SEGMENT_2 ( 25 ) = 79375 CAM_SEGMENT_2 ( 26 ) = 79100 CAM_SEGMENT_2 ( 27 ) = 78775 CAM_SEGMENT_2 ( 28 ) = 78400 CAM_SEGMENT_2 ( 29 ) = 77975 CAM_SEGMENT_2 ( 30 ) = 77500 CAM_SEGMENT_2 ( 31 ) = 76975 CAM_SEGMENT_2 ( 32 ) = 76400 CAM_SEGMENT_2 ( 33 ) = 75775 CAM_SEGMENT_2 ( 34 ) = 75100 CAM_SEGMENT_2 ( 35 ) = 74375 CAM_SEGMENT_2 ( 36 ) = 73600 CAM_SEGMENT_2 ( 37 ) = 72775 CAM_SEGMENT_2 ( 38 ) = 71900 CAM_SEGMENT_2 ( 39 ) = 70975 CAM_SEGMENT_2 ( 40 ) = 70000 Comment = Cam Segment 3 Follower Profile Points (Run at Speed Backwards) CAM_SEGMENT_3 ( 0 ) = 70000 CAM_SEGMENT_3 ( 1 ) = 10000 Comment = Cam Segment 4 Follower Profile Points (Decel Backwards) CAM_SEGMENT_4 ( 0 ) = 10000 CAM_SEGMENT_4 ( 1 ) = 9025 CAM_SEGMENT_4 ( 2 ) = 8100 CAM_SEGMENT_4 ( 3 ) = 7225 CAM_SEGMENT_4 ( 4 ) = 6400 CAM_SEGMENT_4 ( 5 ) = 5625 CAM_SEGMENT_4 ( 6 ) = 4900 CAM_SEGMENT_4 ( 7 ) = 4225 CAM_SEGMENT_4 ( 8 ) = 3600 CAM_SEGMENT_4 ( 9 ) = 3025 CAM_SEGMENT_4 ( 10 ) = 2500 CAM_SEGMENT_4 ( 11 ) = 2025 CAM_SEGMENT_4 ( 12 ) = 1600 CAM_SEGMENT_4 ( 13 ) = 1225 75 AXIMA User’s Guide CAM_SEGMENT_4 ( 14 ) = 900 CAM_SEGMENT_4 ( 15 ) = 625 CAM_SEGMENT_4 ( 16 ) = 400 CAM_SEGMENT_4 ( 17 ) = 225 CAM_SEGMENT_4 ( 18 ) = 100 CAM_SEGMENT_4 ( 19 ) = 25 CAM_SEGMENT_4 ( 20 ) = 0 Comment = Cam Segment 5 Follower Profile Points (Wait in home position) CAM_SEGMENT_5 ( 0 ) = 0 CAM_SEGMENT_5 ( 1 ) = 0 Return From Subroutine Linear PLS Example This example demonstrates the use of PLS (Programmable Limit Switches) in a linear slide application with 4096 encoder counts per linear inch of travel. The linear slide in this example requires two outputs (#39 and # 40), output 39 will be on between 4 inches and 12 inches, output 40 will be on from 3 inch to 4 inch, 6 inch to 9 inch and 11 inch to 12 inch. This example assumes you are using an AXIMA controller. Solution Use a PLS broken into one inch segments. Calculate Multiplier The multiplier is 1/(counts per array segment). PLS multiplier is 1/ 4096 = 0.0002441. Array This PLS requires twelve 1 inch segments so a 12 element array (0 through 11) will be required 76 Programming Examples Array Values To calculate array values make a table of the output pattern for each segment. Segment Array Element # Output 39 on/off Output 40 on/off Array integer value 0-1 inch 0 Off Off 0 1-2 1 Off Off 0 2-3 2 Off Off 0 3-4 3 Off On 256 4-5 4 On Off 128 5-6 5 On Off 128 6-7 6 On On 384 7-8 7 On On 384 8-9 8 On On 384 9-10 9 On On 384 10-11 10 On Off 128 11-12 11 On On 384 Mask Since we only want the PLS to control outputs 39 and 40 the mask should be set to 384. 2**(39-32) + 2 ** (40-32) Example Program Motion Program with 40 instructions) will run on power-up Comment = This is an example of the PLS instruction to control outputs 39 and 40. Comment = Output 39 will be on between 4 and 12 inches. Comment = Output 40 will be on between 3 and 4 inches, 6 to 9 inches and 11 to 12 inches. Comment = 1st step, set up PLS array, it is not necessary to set elements with a value of zero. Comment = array value to turn on output 40 only PLS OUTPUT (3= 256) Comment = array value to turn on output 39 only PLS_OUTPUT (4) = 128 77 AXIMA User’s Guide PLS_OUTPUT (5) = 128 Comment = array value to turn on outputs 39 and 40 PLS_OUTPUT (6) = 384 PLS_OUTPUT (7) = 384 PLS_OUTPUT (8) = 384 PLS_OUTPUT (9) = 384 Comment = array value to turn on output 39 only PLS_OUTPUT ( 10 ) = 128 Comment = array value to turn on outputs 39 and 40 PLS_OUTPUT ( 11 ) = 384 Comment = reset the encoder position to 0 Encoder Preload, X to 0.0 INCHES Comment = Next set use the PLS definition instruction PLS 1 On Using ENC# 1, A Scale Ratio Of 0.000244 An Array Index Offset Of 0, A Mask Of 384 Data Array PLS_OUTPUT Comment = The PLS is now active Comment = The PLS information needs to be set up only once and should not be in a program loop. Comment = Use the PLS Control Instruction to turn on and off the PLS. Set Velocity To 5.0 INCHES/Sec Set Acceleration Ramp To 100.0 INCHES/Sec/Sec Set Deceleration Ramp To 200.0 INCHES/Sec/Sec Comment = Make a move loop LABEL = LOOP Wait Until INPUT_16 is Set Move, Wait until complete, X To Absolute Position 15.0 INCHES Dwell For 2.0 Seconds Move, Wait until complete, X To Absolute Position 0.0 INCHES Dwell For 2.0 Seconds GoTo LOOP 78 Programming Examples Rotary PLS Example This example demonstrates the use of PLS in a rotary application for the AXIMA 2000/4000 with a 10:1 gear reduction and 8192 encoder counts per motor revolution which equals 40960 counts per 360°. In this application output 11 will turn on for 10° and go off for 10°, on from 10 to 20, off from 20 to 30 etc. output 12 is to turn on at 90° to 180° and remain off for the rest of the cycle. Solution Use a PLS programmed in 10° segments with the following specifications: Calculate multiplier The multiplier is 1/(counts per array segment). PLS multiplier is 1/ (8192*10*10/360) = .2949120, to make use of AXIMA’s 64 bit math capability we can enter a variable name in the PLS multiplier field. For example, PLS_RATIO. Then insert a Formula instruction immediately before the PLS Definition Instruction. PLS_RAITO = 1/ (4096*10*10*/360). Rotary Enter a PLS Rotary Value of 81920. Arrays This PLS requires 36, 10° segments so a 36 element array (0 through 35) will be required. Array values To calculate array values make a table of the output pattern for each segment. Segment Array Element # Output 11 on/off Output 12 on/off Array Integer Value 0-10 0 Off Off 0 10-20 1 On Off 16536 20-30 2 Off Off 0 79 AXIMA User’s Guide 80 Segment Array Element # Output 11 on/off Output 12 on/off Array Integer Value 30-40 3 On Off 16536 40-50 4 Off Off 0 50-60 5 On Off 49152 60-70 6 Off Off 0 70-80 7 On Off 49152 80-90 8 Off Off 0 90-100 9 On On 49152 100-110 10 Off On 327768 110-120 11 On On 49152 120-130 12 Off On 327768 130-140 13 On On 49152 140-150 14 Off On 327768 150-160 15 On On 49152 160-170 16 Off On 327768 170-180 17 On On 49152 180-190 18 Off Off 0 190-200 19 On Off 16536 200-210 20 Off Off 0 210-220 21 On Off 16536 220-230 22 Off Off 0 230-240 23 On Off 16536 240-250 24 Off Off 0 250-260 25 On Off 16536 260-270 26 Off Off 0 270-280 27 On Off 16536 280-290 28 Off Off 0 290-300 29 On Off 16536 300-310 30 Off Off 0 310-320 31 On Off 16536 320-330 32 Off Off 0 330-340 33 On Off 16536 340-350 34 Off Off 0 Programming Examples Segment Array Element # Output 11 on/off Output 12 on/off Array Integer Value 350-360 35 On Off 16536 Mask Since we only want the PLS control to outputs 11 and 12, the mask should be set to 16536. 2**(11-32) - 2** (12-32). Notice the minus sign since output 12 is used. Example Program Motion Program with 32 instruction(s) will run on power up Variable Name Type Name PLS_OUTPUT Integer LA0 Instructions Comment = This is an example program to demonstrate the rortay PLS function. Comment = Outputs 11 and 12 will be controlled by the PLS. Output 11 Comment = will toggel on and off every 10 degrees, Output 12 will be on Comment = between 90 and 180 degress. The motor (8192 counts per revolution Comment = is connected to a 10:1 gear box. The PLS tracks the output Comment = of the gear box. Comment = 1st step is to set the PLS array, it is not necessary to set elements with Comment = a zero value. N=1 Comment = A loop can be used to fill some of the array elements LABEL = INCREMENTLOOP LABEL = INCREMENTLOOP LABEL = INCREMENTLOOP PLS_OUTPUT ( N ) = 16384 N=N+2 If (N < 36 ) Then Do GoTo INCREMENTLOOP End If/Then PLS_OUTPUT ( 9 ) = 49152 PLS_OUTPUT ( 10 ) = 32768 PLS_OUTPUT ( 11 ) = 49152 PLS_OUTPUT ( 12 ) = 32768 PLS_OUTPUT ( 13 ) = 49152 PLS_OUTPUT ( 14 ) = 32768 PLS_OUTPUT ( 15 ) = 49152 PLS_OUTPUT ( 16 ) = 32768 81 AXIMA User’s Guide PLS_OUTPUT ( 17 ) = 49152 Comment = define PLS ratio, 8192 cnts per rev, 10 :1 gear box, 10 deg / inc Comment = 360 deg. per rev. PLS_RATIO = 1 / ( 8192 * 10 * 10 / 360 ) PLS 1 On, using ENC# 1, a Rotary Length of 81920, a Ratio of PLS_RATIO, an Array Index Offset of 0, a Mask of 49152, and using Data Array: PLS_OUTPUT Comment = The PLS only needs to be setup once, Comment = donot put it in a program loop. The PLS control instruction Comment = can be used to turn the PLS on and off as required. External Time Base Example This example demonstrates the use of the External Time Base Instruction in a two axis system. Axis #1 is the master and axis #2 is the follower. In the Coordinate System Parameters the external time base is set up with encoder #1 as the source, the master units is “rev”, the counts per master unit is set to 4096 and the signal interpretation is set to comp +. This example jogs axis #1 to simulate a master while input 17 selects two different jog speeds for axis 1. When input 16 is set axis #2 moves to 20 inches at velocity of one inch per revolution of the master. Time base is switched back to real time and axis #2 returns to zero at 20 inches per second. Example Program Motion Program With X Instruction(s) will run on power up Set And Clear Bits Set Bit OUT33 Set Bit OUT32 Encoder Preload , Axis #1 to 0.0 revs, Axis #2 to 0.0 inches Comment = for demonstration purposes the left lx is used as a master Comment = input 17 is used to select between different jog speeds for the master. Jog Definition , Axis #1 Velocity=JOGVEL, Accel=100.0, Decel=100.0 Jog Control , Axis #1 CW LABEL = LOOP 82 Programming Examples If (INPUT17 ) Then Do JOGVEL = 2 GoTo JOGSPEED End If/Then JOGVEL = 5 LABEL = JOGSPEED Jog Definition , Axis #1 Velocity=JOGVEL, Accel=100.0, Decel=100.0 Comment = switch to external time base Begin External Time, Velocity of 1.0 Inches/revs, Acceleration of 2.0 Inches/revs/ revs, Deceleration of 2.0 Inches/revs/revs Comment = dwell for demonstration purpose only Dwell For 0.5 Seconds Wait Until INPUT16 is Set Comment = move to 20 inches in synchronized time base. Move,, Axis #2 To Absolute Position 20.0 inches Comment = switch back to internal time base. Begin Real Time, Velocity of 20.0 Inches/Sec, Acceleration of 100.0 Inches/Sec/Sec, Deceleration of 100.0 Inches/Sec/Sec Comment = dwell for demonstration purpose only Dwell For 0.2 Seconds Comment = move back to zero at 20 inches/sec Move,, Axis #2 To Absolute Position 0.0 inches GoTo LOOP 83 AXIMA Software User’s Index A F application basics, 2 description, 8 overview diagram, 9 auxiliary program example, 27 overview, 8 auxiliary programs overview, 26 AXIMA controller description, 10 feature list, 10 features, 1, 3 application hierarchy , 3 communications , 5 cut/copy/paste, 6 diagnostics, 4 graphical monitor , 4 instructions , 6 menus, 4 online help, 4 program control, 4 program memory , 5 programs , 5 fundamentals , 2 C G cam profiler, 17 closed loop operation, 18 gear profiler, 17 graphical monitor , 4 E I examples, 45 cam, 65 external time base, 82 homing an axis, 45 linear PLS, 76 MX/AXIMA communications, 59 product alignment, 47 rotary PLS, 79 T60/AXIMA communications, 61 two axis gluing, 51 instructions overview, 6 J jog profiler, 16 85 M motion concept jog profiler, 16 motion concepts , 15 cam profiler, 17 coordinate system hierarchy , 15 coordinated move, 16 gear profiler , 17 generating motion , 15 secondary set point , 18 motion program flow , 24 overview , 7, 24 multitasking programs , 29 O online help , 4 operator interface addressing, 39 data I/O, 42 analog , 43 digital, 43 overview , 39 terminal mode , 39 echo, 39 establishing , 40 example , 41 P PLC program example , 23 overview , 7, 21 program priority , 29 assigning , 29 execution interval times, 32 processing, 30 86 timeslicing, 34 programming examples, 45 programs quantity, 6 type, 6, 21 auxiliary, 8 motion, 7 PLC, 7 verification, 7 T timeslicing, 34 diagram, 35 U understanding motion, 15 understanding programs, 21