Download XCD FW ver 1.4 User Manual
Transcript
User Manual XCD™ Software Version 1.4.0.7 XCD0458001-01 Rev. B October 2012 Nanomotion Ltd. POB 623, Yokneam 20692, Israel Tel: 972-73-2498000 Fax: 972-73-2498099 Web Site: www.nanomotion.com E-mail: [email protected] XCD0458001-01 Rev. B ii XCD™ Software Version 1.4.0.7 Copyright © 2012 by Nanomotion Ltd. All rights reserved worldwide. No part of this publication may be reproduced, modified, transmitted, transcribed, stored in retrieval system, or translated into any human or computer language, in any form or by any means, electronic, mechanical, magnetic, chemical, manual, or otherwise, without the express written permission of Nanomotion Ltd., Mordot HaCarmel Industrial Park, Yokneam, 20692, Israel. This document contains proprietary information and shall be respected as a proprietary document with permission for review and usage given only to the rightful owner of the equipment to which this document is associated. Limited Warranty Nanomotion Ltd. (hereinafter NM) warrants the product (other than software) manufactured by it to be free from defects in material and workmanship for a period of time of one year (except those parts normally considered as consumable/expendable components such as motor conditioning brushes). The warranty commences thirty (30) days from the date of shipment. NM warrants those parts replaced under warranty for a period equal to the remaining warranty coverage of the original part. NM's sole and exclusive obligation under this warranty provision shall be to repair, or at its sole option exchange defective products or the relevant part or component, but only if: (i) the Purchaser reports the defect to NM in writing and provides a description of the defective product and complete information about the manner of its discovery within ten (10) days of its discovery; (ii) NM has the opportunity to investigate the reported defect and to determine that the defect arises from faulty material, parts or workmanship; and (iii) the Purchaser returns the affected product to a location designated by NM. These provisions constitute the exclusive remedy of the Purchaser for product defects or any other claim of liability in connection with the purchase or use of NM products. This warranty policy applies only to NM products purchased directly from NM or from an authorized NM distributor or representative. This warranty shall not apply to (i) products repaired or altered by anyone other than those authorized by NM; (ii) products subjected to negligence, accidents or damage by circumstances beyond NM control; (iii) product subjected to improper operation or maintenance (i.e. operation not in accordance with NM Installation Manuals and/or instructions) or for use other than the original purpose for which the product was designed to be used. NM shall not in any event have obligations or liabilities to the Purchaser or any other party for loss of profits, loss of use or incidental, increased cost of operation or delays in operation, special or consequential damages, whether based on contract, tort (including negligence), strict liability, or any other theory or form of action, even if NM has been advised of the possibility thereof, arising out of or in connection with the manufacture, sale, delivery, use, repair or performance of the XCD0458001-01 Rev. B iii XCD™ Software Version 1.4.0.7 NM products. Without limiting the generality of the preceding sentence, NM shall not be liable to the Purchaser for personal injury or property damages. Patents Nanomotion products are covered under one or more of the following registered or applied for patents. 5,453,653; 5,616,980; 5,714,833; 111597; 5,640,063; 6,247,338; 6,244,076; 6,747,391; 6,661,153; 69838991.3; 6,384,515; 7,119,477; 7,075,211; 69932359.5;1186063; 7,211,929; 69941195.5; 1577961; 4813708; 6,879,085; 6,979,936; 7,439,652; 7061158;1800356; 1800356; 1800356; 2007-533057 (pending); 2011-093431 (pending); 7,876,509; 10-2007-7009928 (pending); 200780019448.6; 7713361.9 (pending); 12/294,926 (pending); GB2008000004178 (pending); GB2009000003796 (pending); 12/398,216 (pending); GB2446428; 12/517,261 (pending); 08702695.1 (pending); 10-2009-7017629 (pending); 12/524,164 (pending); 12/581,194 (pending) Contact Information Website: www.nanomotion.com Customer Service Contact your local distributor or email Nanomotion Ltd. Technical Support Department at [email protected], with detailed problem description, additions, corrections or suggestions. Nanomotion Ltd. Worldwide Headquarters Mordot HaCarmel Industrial Park HaYetsira Street, PO Box 623 Yokneam 20692 Tel: +972-73-249-8000 Fax: +972-73-249-8099 Email: [email protected] Nanomotion Inc - US Headquarters 1 Comac Loop, Suite 14B2 Ronkonkoma NY 11779 Tel: +1-800-8216266 Fax: +1-631-5851947 Email: [email protected] XCD0458001-01 Rev. B iv XCD™ Software Version 1.4.0.7 Revision History The following table shows the last three revisions to this document. ECO Doc Rev Date Description 433 00/A Sept. 2012 Added Overview of Servo Loop section. Expanded the operating instructions for the XCD Commander, and incorporated new XCD Commander, and XMS feature since last software user manual release (ver 1.1.0.4) NA 00/B Oct. 2012 Corrected typographic errors XCD0458001-01 Rev. B v Table of Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Conventions used in this manual. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Related Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Overview of Servo Loops. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Position Profile. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Control Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Offset Mechanism. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 Zero Feed Forward (ZFF) Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.3 Dead Zone Mechanism. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 5 5 6 6 3 XCD Commander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.1 Overview of XCD Commander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2 Work Flow with XCD Commander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.3 Installing XCD Commander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.4 Quick Start - Launching XCD Commander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.5 Tuning of the XCD System Servo Loop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.6 Working with XMS Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.6.1 Editing a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.7 Executing an XMS Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.8 Managing Flash Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.9 Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4 Host Communication Protocol .............................. 4.1 Communication Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Communication Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Communication Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.1 Prefixes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Command Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Reply Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 Reply Body Format for Specific Commands. . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Commands Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.1 Pseudo-Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.2 Controller Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 XCD Motion Script (XMS) Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2 Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.3 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.4 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.5 Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 23 23 23 24 25 26 27 28 33 37 39 39 40 40 41 44 5 XMS Special Functions and Examples . . . . . . . . . . . . . . . . . . . . . . . 49 49 50 50 51 5.1 5.2 5.3 5.4 Stage Location Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Position Latch and Encoder Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XMS Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Position Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XCD0458001-01 Rev. B vi Table of Contents 5.4.1 Position Compare Activation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.2 Position Compare Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.3 Position Compare Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.4 TIME Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.5 Safe Time Measuring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5 XMS Script Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.1 XMS Script for a Linear Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.2 XMS Script for a Rotary Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Communication Examples .................................. 6.1 Explanation of Command-Response Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 RS232 examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.1 Move motor to position 2.5 (millimeters). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.2 Set motion velocity 70 (mm/sec). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.3 Read feedback position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 IIC examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.1 Move motor to position 2.5 (millimeters). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.2 Set motion velocity 70 (mm/sec). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.3 Read feedback position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 52 52 53 54 54 55 56 59 59 61 61 62 63 64 64 65 65 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 XCD0458001-01 Rev. B vii CHAPTER 1 INTRODUCTION This manual provides information for developing and using Nanomotion's XCD™ Software to control Nanomotion motors with the XCD Controller. The manual is divided into the following sections, • • • • 1.1 Overview of Nanomotion XCD Software XCD Commander™ - user interface that provides access to program parameters and values to allow tuning the servo loop system, and developing unique motion control systems XMS software information - this section includes a description of the parameters and allowed values. Communication Protocol CONVENTIONS USED IN THIS MANUAL Throughout this manual commands are shown in BOLD and parameter values are shown in italics NOTE: Notes provide additional information that is not included in the normal text flow. CAUTION: Caution provides information about actions that will adversely affect system performance. Best Known Methods: Provides additional detailed information about operations and methods. BKM XCD0458001-01 Rev. B 1 Related Products Danger: Indicates operations or activities that may cause damage to equipment or injury to personnel. 1.2 RELATED PRODUCTS The following table lists Nanomotion products which may have this software version. Refer to your hardware product user manual to verify installed software version. Product Part Number XCD HR1™ Controller Driver XCD-HR1-BD-01 XCD HR2™ Controller Driver XCD-HR2-BD-01 XCD HR4™ Controller Driver XCD-HR4-BD-01 XCD HR8™ Controller Drive XCD-HR8-BD-01 XCD EDGE™ Controller XCD-EDGE-BD-01 EDGE™ Controller S775150000 XCD™ Component IC000028 XCD0458001-01 Rev. B 2 CHAPTER 2 OVERVIEW OF SERVO LOOPS Nanomotion's XCD Controller/Driver boards supply dynamic servo control to ensure accurate position changes. The motor control circuit consists of three major building blocks. • • • • • Linear or rotary stage mounted on a Platform HR series or Edge motor Encoder XCD Controller/Driver Remote computer to host the XCD Commander The Controller provides a PWM signal to an AC converter. The output AC is applied to the motor driving the stage. As the stage moves, the encoder sends position information to the Controller. The Controller matches the current position against a calculated expected position and corrects the PWM drive signal to correct motor speed. Figure 1: Servo Loop Block Diagram XCD0458001-01 Rev. B 3 Position Profile 2.1 POSITION PROFILE When the Controller receives a MOVE command it calculates a position signal profile that defines the expected stage positions at 50 ìsec intervals. The profile includes three phases: • • • • Acceleration (ACC) Constant velocity (VEL) Deceleration (ACC) Position (RPOS) The ACC parameter is a <userUnit>/sec2 value used for both acceleration and deceleration. Note that for a linear stage the value is mm/sec2 and for a rotary stage it is degree/sec2. During acceleration (ACC) the Controller supplies a signal that increases motor speed. After the motor reaches the configured velocity (VEL) the Controller maintains velocity by changing the drive command. As the stage approaches the target position the Controller begins to reduce the drive command. Figure 2: Position and Velocity Profile changes over time XCD0458001-01 Rev. B 4 Control Algorithm 2.2 CONTROL ALGORITHM The XCD Controllers are based on a standard PIV (position/velocity loop) controller with a non-linear mechanism. The Controller uses several mechanisms to control movement of the stage. • • • Offset mechanism Zero FeedForward mechanism Dead Zone mechanism Figure 3: Controller Block Diagram The discussions in the following sections refer to this diagram. 2.2.1 OFFSET MECHANISM The offset mechanism provides an initial starting value to overcome the natural friction of the motor by initializing the integrator. The offset value is set using two parameters: • • Friction Positive (FRP) - compensates for friction in a positive direction. Friction Negative (FRN) - compensates for friction in a negative direction These parameters are set at between 50-100% of the value required to cause the motor to move. This is determined during the initial tuning of the servo loop. XCD0458001-01 Rev. B 5 Control Algorithm 2.2.2 ZERO FEED FORWARD (ZFF) MECHANISM The Zero feed forward mechanism improves the motors settling time. This is done by stopping the Velocity Feed Forward (VFF), reducing the speed at which the motor approaches the Target Position. As shown in the block diagram, VFF provides a value derived from the position profile. The ZFF parameter is set to a value of between 30 and 50 microns from the target position. The value of ZFF is dependent on the moving mass. For a larger mass ZFF should be increased. Figure 4: Motor braking on approach to Target Position 2.2.3 DEAD ZONE MECHANISM The Dead Zone mechanism takes advantage of the motor’s intrinsic friction to prevent jitter and improve the settling time. The Dead Zone is defined by two areas on either side of the motor. • • XCD0458001-01 Rev. B Dead Zone Minimum (DZMIN) - a range around the Target Position that is the desired final position of the motor. Dead Zone Maximum (DZMAX) - defines the maximum allowable final position of the motor. 6 Control Algorithm Figure 5: Dead Zone Mechanism DZMIN is the distance from the Target Position at which the Dead Zone mechanism drops the drive command to 0. At this point the motor’s intrinsic friction applies mechanical braking to the motor. After the motor enters DZMIN and removes the signal to the PWM, the Controller continues monitoring position error (PE). If absolute value of PE is greater than DZMAX the Controller applies a signal to return the motor toward the Target Position (servoing again). XCD0458001-01 Rev. B 7 CHAPTER 3 XCD COMMANDER The XCD Commander™ is an application that resides on an external Host computer and provides monitoring of the operation of the user developed motor control program. XCD Commander gives the user the ability to: • • • • • • 3.1 Configure and tune the XCD Controller Motion system Edit and save XMS scripts Evaluate and troubleshoot motion control program operation Edit program parameters Save the final motion control program on the XCD Controller Save the final program to file on the Host and save from the Host to other Controllers OVERVIEW OF XCD COMMANDER The XCD Commander is a user interface that provides access to all operations involved in developing, testing, and using XMS scripts, as well as monitoring Controller and motor states. The interface provides the following: • • • XCD0458001-01 Rev. B Communication between XCD Commander and the XCD Controller/ Driver is based on a Host/Client relationship. XCD Commander resides on the Host (remote computer), and the XCD Controller/Driver is the Client. Communication is over either a UART cable or IIC of up to 400 kHz. XCD Motion Program™ (XMS Script) - The XCD Motion Program is a scripting language that gives the user the ability to customize and control Nanomotion motors. XMS uses both standard commands and variables to control motor position, stops, speed and loading. User interface - Provides a number of actions: • downloading and executing a motion program from the Host to the Controller. • access the Controller's flash memory to tune the servo loop parameters • editing of motion control programs written in XMS • saving programs from the Controller's flash memory to the Host for reuse on other Controllers. 8 Work Flow with XCD Commander 3.2 WORK FLOW WITH XCD COMMANDER the XCD Commander is typically used to tune the motion control system. The Commander is supplied with example XMS scripts that can serve as a starting point for program development. If a script is developed from scratch it must be saved with the extension (<fileName>.xms). After development open the file in the XCD Commander to verify the script. The file is opened with the parts of the script color coded. The next step is to check the operation of the script on the system by clicking Download and Execute. This downloads the script to the Controller's RAM and simulates a power on to start the program. Figure 1: Basic Work Flow If discrepancies are found in motor operation or there is a need to fine tune parts of the program specific commands can be applied and their response monitored. The parameters that require modification can be edited and the program rerun. All modifications of the program are implemented in the Controller's RAM. These changes are not saved unless they are saved to the Controller's Flash memory. After development and testing are complete the final program is saved to the Controller's Flash. From here the program can be moved to a file (<fileName>.S19) on the Host computer. This file can be copied to other Controllers. 3.3 INSTALLING XCD COMMANDER XCD Commander is on a USB drive or CD that is supplied with the Controller/ driver. The Host computer OS must be Microsoft Windows XP, or Windows 7. XCD0458001-01 Rev. B 9 Installing XCD Commander 1. The XCD Software is delivered on either USB flash drive or CD. The XCD Commander will automatically launch. In case the installation does not launch navigate to the installation program (USB or CD) and double-click on the setup.exe file. 2. If Security Warning notice opens click INSTALL. Figure 2: Application Install - Security Warning Window The installation process window shows install progres. When the installation finishes the XCD Commander GUI opens. If the XCD Commander GUI does not open select Start > Programs > Nanomotion > XCD NanoCommander to open the application. 3. If a Communication failure warning appears click OK. 4. In the Communication pane set the Address field to the correct Communication Protocol type. This is required because address formatting is different for different protocols. Nanomotion evaluation kits typically use RS232 communication. BKM When using an IIC connector select the controller’s IIC address. When connecting with UART(RS232) select 0. Set the following parameters in the Host computer’s COM Port settings: • • • • • Baud Rate: 115200 Number of Data Bits: 8 Parity: None Number of Stop bits: 1 Flow Control: None 5. In the Communication pane Port field select the port connected to the Controller/driver from the dropdown menu. XCD0458001-01 Rev. B 10 Installing XCD Commander Figure 3: Commander Main Window 6. To confirm successful communication click Info. The Info field displays the Controller and application information: • • • • Controller version and build Controller serial number Code Controller/Driver type and mode Ensure that the Controller version is the same as the XCD Commander version shown in the window header. For example, Controller version 1.4.0.7 and XCD Commander 1.4 7. The XCD Commander application is ready for use. XCD0458001-01 Rev. B 11 Quick Start - Launching XCD Commander To uninstall XCD Commander application, use the Control Panel Program Remove feature. 3.4 QUICK START - LAUNCHING XCD COMMANDER The XCD Software package has a folder with Nanomotion developed motion control programs. These programs provide recommended motor controls that can be used as-is or modified to meet specific user application requirements. The programs include basic servo loop tuning parameters. These parameters should be tested to ensure they provide optimal performance. Changes to fields and selection boxes in the Configure Servo Loop and Tune Servo Loop dialogs are passed to the Controller's RAM when the field selection changes. 1. Connect the system components. If using a Nanomotion Evaluation kit connect the following components. • • • • Motor to Controller Encoder to Controller Controller to the Host computer Controller to external power supply Ensure that the stage is securely mounted to the workbench. Stage movement can be extreme until properly tuned. 2. Launch XCD Commander. 3. Click CONFIGURE SERVO LOOP. 4. In the lower pane of the Configure Servo Loop window ensure that the four indicators are green. The following figure shows a Positive Limit showing red in the upper panel of the window. Change the configuration from Active Low to Active High to clear the problem. XCD0458001-01 Rev. B 12 Quick Start - Launching XCD Commander Figure 4: Example of incorrect limit switch configuration 5. Enter the ENR value. ENR is the encoder's resolution. For example: • • Linear applications - If the encoder resolution is listed as 1000 counts per mm, enter 0.001 in the ENR field. Rotary applications - If the encoder resolution is listed as 4096 counts per revolution, enter 360/4096=0.08789 (degrees per count) in the ENR field. 6. In the OPEN LOOP COMMAND pane move the slider slowly right (positive PWM signal). When the motor begins to move, stop and record the value shown in the OPEN LOOP COMMAND field. If the motor movement is in the opposite direction (as shown by a negative number in the CURRENT POSITION field), select or deselect INVERSE DRIVE OUTPUT and recheck motor action. XCD0458001-01 Rev. B 13 Quick Start - Launching XCD Commander The slide displacement is proportional to the PWM duty cycle. In the Info pane, check that the Controller is in Normal mode. In this mode the motor shows a sensible Dead Zone and normally starts moving at 15-30% of PWM duty cycle. If the motor hasn't moved at 50% of PWM, do not continue. The motor apparently has a problem that must be corrected. 7. Continue in the positive direction and record the value shown in the CURRENT POSITION where the motor stops. 8. Move the slider slowly left (negative PWM signal) and when the motor begins to move record the value in the field. 9. Continue in the negative direction and record the value shown in the CURRENT POSITION where the motor stops. 10. Click TUNE SERVO LOOP button in the Commander main window. 11. In the lower pane of the Tune Servo Loop dialog, enter values for Position 1 and Position 2 obtained in steps 7 and 9. The values should be at least 1 mm off the hard stops noted in the above steps. 12. In BACK-FORCE WITH DELAY enter 500 milliseconds. 13. Click POSITION 1 and ensure that the motor moves to that position. 14. Click POSITION 2 and ensure that the motor moves to that position. 15. If movement in both directions is ok, click BACK-FORCE WITH DELAY. The motor will begin moving between Position 1 and Position 2. Any of the following indicate a need to tune the servo loop: • • • • • XCD0458001-01 Rev. B Noisy motion unstable movement intolerable overshoot position error other undesirable motor action 14 Tuning of the XCD System Servo Loop 3.5 TUNING OF THE XCD SYSTEM SERVO LOOP After installing XCD Commander it is necessary to tune the connected servo loop. This operation sets the drive and feedback loop gain to ensure smooth motor operation. This procedure provides tuning instructions for a linear stage. Procedures for tuning a rotary stage will be added in a later revision of this document. 1. In the Commander main window click CONFIGURE SERVO LOOP and select the Drive Mode. BKM Normal mode is recommended for most applications. Linear mode may be useful for some applications with extreme requirements. However, Linear mode increases power consumption and motor wear. 2. In the Commander main window click TUNE SERVO LOOP and select the Configuration tab. 3. Set the parameters as follows: Press Enter after entering data in fields. • ENR (Encoder Resolution) - units appropriate for application (millimeters, degrees, radii etc.). For example: Linear applications - If the encoder resolution is listed as 1000 counts per mm, enter 0.001 in the ENR field. Rotary applications - If the encoder resolution is listed as 4096 counts per revolution, enter 360/4096=0.08789 (degrees per count) in the ENR field. Display of position-related variables in the XCD Commander is formatted according to the ENR value. • • DZMIN = Normal mode=2*ENR (0.02 micron) DZMAX = 10*ENR (0.1 micron) If the required Drive Mode is Linear (AB5), set DZMIN to 0, and DZMAX to 1. • XCD0458001-01 Rev. B ZFF = 0.03 - 0.05 (30-50 micron) 15 Tuning of the XCD System Servo Loop • • • • • • • FRP = 60% of value recorded in paragraph 3.4 step 5 (default value is 10) FRN = 60% of value recorded in paragraph 3.4 step 7 (default value is -10) SLN = 0 (disables negative software limit) SLP = 0 (disables positive software limit) PEL = 0 - (disables critical position error) TEL = 0 - (disables Temperature Error Limit) MTL = 20000 (Sets Motion Time Limit to 20 sec). A value of 0 disables the Motion Time Limit parameter. The tuning values entered in step 3 are for the purpose of tuning the stage only. After tuning is completed the user should adjust these values according the application's requirements. 4. Select SERVO LOOP PARAMETER tab and set the following parameters: • • • • • • • • Biquad 1 = Selected Type = Low Pass Bandwidth (Hz) = 700 Damping Ratio = 0.7 KP = 20 KV = 0.1 KI = 300 LI = 90 5. Open the CONFIGURE SERVO LOOP window. 6. Ensure that the status indicators at the bottom of the window are all green. If not reset the related logic selections in the dropdown menus in the top portion of the window. For example, if the Positive Limit indicator is red select Active High in the Positive Limit Switch dropdown. 7. Manually position the stage to its midpoint. 8. Move the Open loop command slider towards +100 and verify that the Current Position shows a positive value (counts positive). If the value was negative select the option box for Inverse Drive Output, press ENTER and recheck the action. Standard orientation of the motor is when looking at the stage, and the Drive Strip is visible, motor movement to the right is positive, and movement to the left is negative. 9. Close the Configure Servo loop and open Tune Servo Loop. XCD0458001-01 Rev. B 16 Tuning of the XCD System Servo Loop 10. In the lower section of the window select the Motion Parameter tab and set the parameters: • • VEL to 50 (mm/sec) ACC to 1000 (mm/sec2). 11. Manually move the stage in a positive direction until you feel the HW physical limit. 12. Enter a value that is 1mm less than the HW physical limit in the Move to Position 1 field. 13. Manually move the stage in the negative direction until you feel the HW physical limit. 14. Enter a value that is 1mm less than the HW physical limit in the Move to Position 2 field. 15. Click MOVE TO POSITION 1 and verify that the stage moves to that position. 16. Click MOVE TO POSITION 2 and verify that the stage moves to that position. 17. Enter 500 in the Back-Force with Delay field. 18. Click BACK-FORCE WITH DELAY to start the back and forth movement. 19. Ensure that the stage moves smoothly in both directions. The motor should move between the two entered positions in a smooth repetitive action. 20. While the motor is moving increase KV until an audible sound appears. Each increase should be twice the previous increment. The noise will typically be heard at the extremes of the stage movement. 21. Return the KV value to the last value before the noise began. 22. Raise the KV value very gradually (1mm increments). 23. Divide the value where the noise starts again by 2 and enter as KV. The stage runs smoothly with no audible noise. 24. Reset KP to 200. If the stage physically oscillates (low frequency movement), reduce KP to 100. 25. Stop the motor movement. 26. In the Commander's main window select MANAGE FLASH DATA and click RAM>Flash to save the tuning settings. XCD0458001-01 Rev. B 17 Working with XMS Scripts 3.6 WORKING WITH XMS SCRIPTS The user can develop a motion control program from scratch, or run a Nanomotion sample script that provides a starting point for program development. The sample scripts are in the evaluation kit software package folder titled Scripts. The folder contains two XMS scripts. • • 3.6.1 <productName>_DEMO_KIT_Cond.xms - sets general defaults <productName>_DEMO_KIT_Steps.xms - sets defaults for step operation. EDITING A SCRIPT The edit function can be used for editing existing XMS scripts. By using one of the supplied sample scripts the user can experiment with the system, develop a unique script 1. In the Motion Program pane click BROWSE. 2. Browse to the folder containing XMS scripts and select a script and click OPEN. 3. The path to the script appears in the Motion Program field. 4. Click EDIT. 5. The Script edit panel opens. Commands and parameters are color coded. Figure 5: XMS edit window 6. Click VERIFY to check script syntax. XCD0458001-01 Rev. B 18 Executing an XMS Script If there are errors in the script syntax, an error message appears and the line with the error is highlighted. 7. Edit the script as required. The editor verifies the script syntax. An error message is displayed with the line number of the error and marks the error in the script. If no error is found no message is displayed 8. To test the script click DOWNLOAD & EXECUTE button to execute the script. The script is loaded to the Controller's RAM and a power on condition is simulated to start the motor. The button name changes to STOP. The Line field indicates the currently running script line. 9. To save the program select Program > Save or Save As. 3.7 EXECUTING AN XMS SCRIPT To execute an XMS script 1. In the Motion Program pane click Browse. 2. Browse to the folder containing XMS scripts and select a script. 3. The selected script's full path is displayed in the Motion Program field. XCD0458001-01 Rev. B 19 Managing Flash Data Figure 6: Commander user interface 4. To stop the script click STOP. The STOP & DISABLE button stops the script execution and disables the motor. 3.8 MANAGING FLASH DATA The XMS program and parameters reside in the Controller’s RAM. Changes that were made during editing will be lost on power down. They must be saved either to the Controller’s Flash memory, an XMS file or as an S19 file. the S19 file can be loaded directly to the memory of multiple controllers. After executing the program, the program's parameters are displayed in the Configure Servo Loop and Tune Servo Loop dialogs. These parameters can be edited to improve and fine tune the motor's operation. After editing these parameters the program can be rerun to test the changes. XCD0458001-01 Rev. B 20 Managing Flash Data Editing of the program cannot be done while the motor is operating. Parameter edits are copied to the Controller's RAM and affect the motor's current operation. 1. In the Commander's Setup pane click MANAGE FLASH DATA. Figure 7: Manage Flash Data dialog The dialog has three tabs that display the contents of the Flash memory. Each tab displays the contents of both the Controller's Flash and RAM. • • • Configuration Flash Variables Program - shows Program size and checksum in the Flash drive and RAM The Encoder Compensation tab provides the ability to import or export an encoder compensation value. 2. Save and upload data as follows: • • • • XCD0458001-01 Rev. B RAM > FLASH - saves the Controller's RAM to its Flash memory. The process overwrites the contents of the Flash memory FLASH > RAM - copies the contents of the Flash memory to RAM. This returns the RAM to its previous state. FLASH > FILE - saves the Controller's Flash data to a *.S19 file on the Host computer. FILE > FLASH - Copies an S19 file from the Host computer to the Controller's Flash memory. 21 Error Messages 3.9 ERROR MESSAGES When the Controller driver detects an error, the following actions take place: • • An error code appears on the screen. The currently running XMS program is aborted, and motor action is stopped. Table 3-1: Error Codes Error Code Error Description 101 Position error 102 Software limit switch 103 Hardware limit switch 104 Emergency 105 Motor not connected 106 Time out XCD0458001-01 Rev. B 22 CHAPTER 4 4.1 HOST COMMUNICATION PROTOCOL COMMUNICATION CHANNELS Communication with the host computer is provided through the following physical channels: • • 4.2 UART (RS232) • Baud Rate: 115200 • Number of Data Bits: 8 • Parity: None • Number of Stop bits: 1 • Flow Control: None IIC up to 400 kHz COMMUNICATION ADDRESS Each Controller stores its communication address, which is a number in the range of 0-254. Factory default is zero. The user can change a Controller's address by using the command Set Address (16). A user defined address can be stored in Controller's flash memory by using command Save (13). This user defined address is retrieved at power up. Each host command includes the destination address. The destination address must be in a range of 1-254. The Controller accepts host's command and responds to it, only if Controller's address matches host's command destination address. Zero destination address defines broadcasting, i.e. any connected Controller accepts and responds to the command. 4.3 COMMUNICATION PROTOCOL The Controller is a communication client and plays a passive role. Other side (customer processor or PC) is a communication host and plays an active role. The communication is performed in a ping-pong manner. Each communication session includes two events: • • XCD0458001-01 Rev. B The host initiates communication by sending a command. The Controller sends reply; in many cases, the reply is simply a prompt, which reports whether the command is accepted or rejected. 23 Communication Protocol The host commands and the Controller replies are similar in all supported communication channels. Each host command consists of the following parts. Table 1: Host's Command Structure Description Part Description Command prefix Command prefix depends on the communication channel. Command prefix is the same for all commands. Command body Command body does not depend on the communication channel. Command body is specific for each command. Table 2: Controller's Command Structure Description 4.3.1 Part Description Reply prefix Reply prefix depends on the communication channel. Reply prefix is the same for all commands. Reply body Reply body does not depend on the communication cannel. Reply body is specific for each command. PREFIXES The prefix format is different for UART and IIC communication. UART (RS232) In UART(RS232), both the Command and reply prefix are identical and consist of 4 bytes Table 3: UART Command/Reply Prefixes Structure Description Byte offset XCD0458001-01 Rev. B Size in bytes Content 0 1 Constant 0xE4 (228). 1 1 Constant 0xA5 (165). 2 1 Destination address. 3 1 Length of command/reply body in bytes. 24 Command Body IIC In IIC the both Command and Reply prefix consist of 2 bytes. Table 4: IIC Command Prefix Structure Description Byte offset Size in bytes Content 0 1 Destination address (write address). 1 1 Length of command body in bytes. . Table 5: IIC Reply Prefix Structure Description Byte offset 4.4 Size in bytes Content 0 1 Destination address plus one (read address). This byte is sent by the host. 1 1 Length of reply body in bytes. This byte is sent by the Controller. COMMAND BODY Command body is a sequence of bytes that provide the Command (code), and any parameters typically used with the command. Table 6: Command Body Structure Description Byte offset 0 1 Byte size 1 Content Command code. Up to 49 Parameters. If a command requires no parameters, the whole command body includes only the one byte of the command code. In most commands, the command code is followed by parameters. Each parameter occupies one or several bytes. Delimiting bytes are omitted between the command code and parameters or between the parameters. Each command requires a specific format for each of its parameters. Each parameter is a numerical value. All formats are binary and presented as little endian (the least significant byte appears first). XCD0458001-01 Rev. B 25 Reply Body The following Command parameter formats are used. Table 7: Command Parameter Formats Format Number of bytes Range Int8 1 -128 to +127 Int16 2 -32768 to +32767 Real 4 -3.4*1038 to +3.4*1038 approximately (complying with IEEE 754) ID 2 0 to 65535 Some commands require a parameter that specifies a Controller variable. The variable is referenced by its numerical ID. Refer to paragraph 4.7.5 on page 44 for a list of variable and their IDs. 4.5 REPLY BODY The Reply body is a sequence of bytes in the following order. Table 8: Reply Body Structure Description Byte Offset Byte Size Content 0 1 Command code - copied from replied command. 1 1 Result: 1 - Command accepted. 2 - Command rejected. 2 Total Up to 48 Extension. 2 ÷ 50 For most commands, the Controller sends back only two bytes, omitting the extension. XCD0458001-01 Rev. B 26 Reply Body 4.5.1 REPLY BODY FORMAT FOR SPECIFIC COMMANDS Read Version (19) The Reply body structure for a Read Version command contains up to 12 Bytes of information. Table 9: Reply Body Structure Description for the Read Version Command Byte Offset Byte Size Content 0 1 Command code - copied from replied command 1 1 Result: 1 - Command accepted. 2 - Command rejected 2 4 Version - each Byte defines one number of the software version. The first Byte is LSB and the fourth Byte is MSB. 6 4 Serial number - INT(32) 10 2 Application code - INT(32) Total 12 Report (26) The Report command can return both XMS and pseudo-Variables and can contain up to 42 Bytes of information. • The requested XMS variable is reported in 4-byte Real format complying with IEEE 754. The requested pseudo-variable is reported in 4-byte special format. • Table 10: Reply Body Structure Description for the Report Command Byte Offset Byte Size Content 0 1 Command code - copied from the replied command. 1 1 Result: 1 - Command accepted. 2 - Command rejected. 2 4 Variable 1 in Real format. 6 4 Variable 2 in Real format (if requested). … … … 38 4 Variable 10 in Real format (if requested). Total 6 ÷ 42 XCD0458001-01 Rev. B 27 Commands Table 4.6 COMMANDS TABLE The following table provides a list of Commands recognized by the XCD software. The table includes: • • • • • Command Command Code Parameters used with the command Parameter formats - the number in parenthesis specifies the size in Bytes of the parameter. Description Table 11: Commands Table Command Code Parameters Format Description Move 1 position Real (4) Move to absolute position.position defines new target position (units for linear or rotary stage). variable value ID (2) Assignment. The value is assigned to the variable. Assign Int16 2 Int16(4) Assign 3 variable value ID (2) Real (4) Home 4 method origin (opt) velocity1 (opt) velocity2 (opt) Int8 (1) Real (4) Real (4) Real (4) Assignment. The value is assigned to the variable. Initiate a Homing operation. The command contains the homing method, point of origin, and optional velocity. origin - (optional) defines the position at the home point. If no value is entered the system assumes zero as the origin. velocity1 - (optional) defines the first stage velocity velocity 2 - (optional) defines the second stage velocity. If omitted, the system takes the velocity1 value. XCD0458001-01 Rev. B 28 Commands Table Table 11: Commands Table Command Code Parameters Format Description Velocity loop 6 Velocity Real Execute velocity loop control. The velocity parameter defines the required velocity for the stage (linear or rotary units per sec). NOTE: To avoid jerky movements when changing velocity make changes in small increments. Open loop 7 Save param- 13 eters command Real (4) Execute open loop control. Parameter command defines command value in percents, from -100 to +100. addr 90 Int8 (1) (0x5A) nt8 (1) Save parameter values into flash memory. At the next start-up, the Controller reads the parameters from the flash and starts with the stored parameters instead of default values. The parameters are required to prevent unintentional use of the command. • Addr specifies communication address of the Controller. • The second parameter is constant 90 (0x5A). XCD0458001-01 Rev. B 29 Commands Table Table 11: Commands Table Command Code Parameters Format Description Set address 16 addr 90 Int8 (1) Change communication address. (0x5A) Int8 (1) newaddr Int8 (1) The first two parameters are required to prevent unintentional use of the command. • addr specifies the current communication address of the Controller. • The second parameter is constant 90 (0x5A). • newaddr specifies a new communication address of the Controller. Enable 17 - - Enable servo loop. While servo loop is enabled, the motor actively keeps current position and fixes deviation provided by an external force. Disable 18 - - Disable servo loop. While servo loop is disabled, the motor passively resists to an external force. However, the piezo motor provides a relatively high passive force that in many cases is sufficient to keep the position. Read version 19 - - Read version. The command requests information about Controller firmware. See paragraph on page 27/ XCD0458001-01 Rev. B 30 Commands Table Table 11: Commands Table Command Code Parameters Format Description Monitor 20 channel Variable scale Int8 (1) The Monitor command converts the specified Variable to an analog output voltage. ID (2) Real (4) • channel defines analog output to use: • 0 - AOUT0 • 1 - AOUT1. • • variable specifies variable to monitor. scale defines a conversion factor. In each cycle, the Controller retrieves the value of the Variable, multiplies it by the scale and assigns a voltage between 0 and 3.3 V. V=Var*scale*(1.65/ 100)+1.65 While active, the analog output is disconnected from the corresponding AOUT variable. To stop monitoring apply Monitor Address (21) with all zeros in parameters. XCD0458001-01 Rev. B 31 Commands Table Table 11: Commands Table Command Code Parameters Format Description Monitor address 21 channel address scale Int8 (1) The Monitor address command converts the specified RAM address to an analog output voltage. Int16 (2) Real (4) • channel defines analog output to use: • 0 - AOUT0 • 1 - AOUT1. • address specifies address to monitor. • scale defines a conversion factor. In each cycle, the Controller retrieves the value of the address, multiplies it by the scale and assigns a voltage between 0 and 3.3 V. V=Var*scale*(1.65/ 100)+1.65 While active, the analog output is disconnected from the corresponding AOUT variable. To stop monitoring apply Monitor Address (21) with all zeros in parameters. Kill 23 - - Kill motion. Current motion is terminated, and the Controller provides deceleration using KDEC parameter. Report Int16 25 XCD0458001-01 Rev. B var1 Int16 (2) Report variable values. var2 (opt) … Int16 (2) … var10 (opt) Int16 (2) The command requests current variable values. From 1 to 10 variables can be requested in one command. Additionally to XMS variables, the command accepts IDs of pseudo-variables. 32 Commands Table Table 11: Commands Table Command Code Parameters Format Description Report 26 var1 ID (2) Report variable values. var2 (opt) … ID (2) … The command requests current variable values. From 1 to 10 variables can be requested in one command. Additionally to XMS variables, the command accepts IDs of pseudo-variables. var10 (opt) Configure Position Pulse Incremental 32 33 ID (2) code Int16 (2) value Real (4) start increment count Real (4) Real (4) Int32 Configure the Controller. The command provides configuration of the Controller. Start position compare pulse generation (incremental). • start - specifies the first position, once the motor feedback compares to t star, the Controller generate the first pulse. • increment - specifies the distance between pulses in mm. The next position for compare is set as previous position plus increment. The value is either positive or negative. • count - specifies the number of pulses. If count is one, single pulse at start point is produced. 4.6.1 PSEUDO-VARIABLES Pseudo-variables are not XMS variables and cannot be used in the XMS script. Pseudo-variables have IDs, which are different from any XMS variable. The only command that accepts pseudo-variables is Report (26). In the parameters of the Report command, the pseudo-variable IDs can be used in any combination with the XMS variable IDs. XCD0458001-01 Rev. B 33 Commands Table The following table specifies available pseudo-variables along with the corresponding 4 bytes in the Controller's reply. The 4 bytes in the reply are filled with special content, not necessarily in Real format. Table 12: Pseudo-Variables with Corresponding 4 Bytes in Controller's Reply ID PseudoVariable Comments Required Motion Parameters XCD0458001-01 Rev. B 34 Commands Table Table 12: Pseudo-Variables with Corresponding 4 Bytes in Controller's Reply ID PseudoVariable 900 Status Comments Corresponding 4 bytes in Controller's reply contain a bit mask with the following bits: 0 - Script Run flag • 0 - not running • 1 - script is running 1 - S_QUEUE flag 2 - S_MOVE flag 3 - S_BUSY flag 4-7 - reserved 8 - Open Loop flag • 0 - disabled • 1 - motor PWM is enabled 9 - Velocity Loop flag • 0 - disabled • 1 - velocity loop is enabled 10 - Position Loop flag • 0 - disabled • 1 - position loop is enabled 11 - reserved 12 - BiQuad filter enabled 13-15 - reserved 16 - Mode • 0 - Linear mode(AB5), high resolution • 1 - Normal Mode(AB1), low resolution 17 - Status • 0 - HR motor flag • 1 - EDGE motor 18 - Inverse Feedback 19 - Inverse Drive Output 20 - Simulation mode 21-23 - reserved 24 - Logical Motion flag (internal) 25 - Hold Position flag (internal) 26 - Kill flag (internal) 27-31 - reserved XCD0458001-01 Rev. B 35 Commands Table Table 12: Pseudo-Variables with Corresponding 4 Bytes in Controller's Reply ID 901 PseudoVariable Comments Program Status Corresponding 4 bytes in Controller's reply are interpreted as follows: Bits 0-15: Currently executed program line Bits 16-31: Status values: • 0 - program was not executed • 1 - execution is in progress • 2 - program finished successfully • 3 - program was terminated by a user • 100 and above - error code (program failed) 902 Safety Disable Corresponding 4 bytes in the Controller reply contain a bit mask with the following bits: Bit 0 - Negative Limit Bit 1 - Positive Limit Bit 2 - Emergency Stop Bit 3 - Motor Not Connected 0 = indicates enabled safety signal 1 = indicates disabled safety signal. Default setting is all faults enabled. 903 Safety Inverse Corresponding 4 bytes in Controller's reply contain a bit mask with the following bits: Bit 0 - Negative Limit Bit 1 - Positive Limit Bit 2 - Emergency Stop 0 = indicates active-high polarity (fault occurs if the signal has high level) 1 = indicates active-low polarity. Default setting is all signals are active-low. 906 XCD0458001-01 Rev. B DZMAX Blackout Shows the blackout time as a number between 1 and 256. Each number is an increment of 0.05 msec. For example 20 = 1 msec. 36 Commands Table Table 12: Pseudo-Variables with Corresponding 4 Bytes in Controller's Reply ID PseudoVariable 990 UART address Comments Controller address for UART communication. A number in the range 0 to 255. The default value is zero. If the Controller address is zero, the Controller accepts any destination address. If the destination address is zero (broadcasting), Controller accepts the command irrespective of Controller address. If both Controller and destination addresses are non-zero, the Controller answers only if the destination address matches the Controller address. 991 IIC address Controller address for IIC communication. An even number in range from 2 to 254. The default value is 164 (0xA4). If the destination address is non-zero, the Controller accepts the command only if the destination address matches the Controller address. If the destination address is zero (broadcasting), Controller accepts the command irrespective of Controller address. 4.6.2 CONTROLLER CONFIGURATION XMS command config and host command Configure (32) allow changing different Controller parameters. BKM To read the Controller’s configuration settings, the host should use the Report command. Both, the script and the host commands, supply two parameters: the first parameter defines a configuration code, and the second provides a XCD0458001-01 Rev. B 37 Commands Table configuration value. The following table lists available configuration codes and their corresponding configuration value description. Table 13: Configuration Codes and Configuration Value Description Code Value 80 CONFIG - Activates calibration using the parameters PWMvalue, PWMwidth, and Threshold. Each parameter is formatted as a Real number. • • • PWMvalue - specifies PWM level in percent of the maximum. If omitted, the default value is 50%. PWMwidth - specifies time in milliseconds of the PWM pulse. Between PWM pulses, the pause is PWMwidth/2. If omitted, the default value is 10 msec. Threshold - specifies minimum motion in millimeters. If the maximum motion at any frequency exceeds the Threshold, the operation is considered successful. If it is less than the threshold it is considered as failed. If omitted, the default value is 0.01 mm. The operation uses an internal frequency table from 153 kHz to 165 kHz, in 2 kHz steps. 200 IIC master write command. • • • Address - IIC addresses, transmitted as one Byte Command - ASIC command, transmitted as one Byte Parameter - two-Byte parameter, transmitted lower Byte first. The function initiates IIC write, but doesn't wait for its termination. If another CONFIG 200 is executed while the previous one is in action, the Controller terminates currently executed write, and initiates new operation. 900 Servo Configuration - The value is a bitmask; only the following bits are meaningful: 12 - BiQuad (1 - enabled, 0 - disabled) 16 - PWM Resolution • 0 - Linear mode(AB5), high resolution • 1 - Normal mode(AB1), low resolution 18 - Inverse feedback direction 19 - Inverse drive output 20 - Simulation mode 902 Safety Disable - The value is a bitmask; only the following bits are meaningful: 0 - Negative Limit Switch (1 - disabled, 0 - enabled) 1 - Positive Limit Switch (1 - disabled, 0 - enabled) 2 - Emergency (1 - disabled, 0 - enabled) 3 - Motor Not Connected (1 - disabled, 0 - enabled) XCD0458001-01 Rev. B 38 XCD Motion Script (XMS) Description Table 13: Configuration Codes and Configuration Value Description Code Value 903 Safety Inverse - The value is a bitmask; only the following bits are meaningful: 0 - Negative Limit Switch (1 - inverse, 0 - normal) 1 - Positive Limit Switch (1 - inverse, 0 - normal) 2 -Emergency (1 - inverse, 0 - normal) 4.7 990 UART address - The value specifies Controller address for UART communication and can be any number in range from 0 to 255. The default value is zero; if the Controller address is zero, the Controller accepts any destination address. If the destination address is zero (broadcasting), Controller accepts the command irrespective of Controller address. If both Controller and destination addresses are non-zero, the Controller answers only if the destination address matches the Controller address. 991 IIC address - The value specifies Controller address for IIC communication; use only even numbers in range from 2 to 254. The default value is 164 (0xA4). If the destination address is non-zero, the Controller accepts the command only if the destination address matches the Controller address. If the destination address is zero (broadcasting), Controller accepts the command irrespective of Controller address. XCD MOTION SCRIPT (XMS) DESCRIPTION XCD Motion Scripts contain commands and variables that are defined by numbers, units, and expressions. 4.7.1 NUMBERS Floating Point Values All numbers in XMS program are floating point values complying with the IEEE 754 definition of single precision arithmetic. The values range is from -3.4*1038 to +3.4*1038 approximately. Literal Constants In the XMS program, literal constant can appear in different formats. The format of the literal constant has no affect on its internal presentation; the XCD0458001-01 Rev. B 39 XCD Motion Script (XMS) Description Controller converts each constant to a floating point number before using it in calculations.: Table 14: Literal Constants Formats in XMS 4.7.2 Format Examples Integer 1, 20, -1078 Real 0.1, 20.35, 0.000009 Scientific 1e-5, 2.3e10 Hexadecimal 0x07FF, 0x1E23 UNITS The Controller supports predefined measuring units for physical values. For example, position or distance in XMS program is always specified in millimeters. Table 15: Measuring Units for Physical Values in XMS 4.7.3 Value Example of Variables Position, distance POS, RPOS, FPOS, TPOS units for stage (linear or rotary) Velocity VEL, RVEL, FVEL units for stage (mm or degrees/radians per sec) Acceleration ACC units for stage (mm or degrees/radians per sec) Time TIME units for stage (mm or degrees/radians per sec) Scaled values AIN0, AOUT1, DOUT Percents of maximum (%) Measuring Unit EXPRESSIONS Expression is a formula for calculating numerical value. In its simplest form, the expression consists of a single variable or literal constant. General expression may include the following elements: • • • • XCD0458001-01 Rev. B Variables, such as: VEL, V10, IN_0 Literal constants, such as: 10, -0.0001, 0x0FFF Parenthesis: (and) Arithmetical operations: +, -, *, / 40 XCD Motion Script (XMS) Description • • 4.7.4 Compare operations: = (equal), <> (non-equal), < (less), <= (less or equal), > (greater), >= (greater or equal) Logical operations: & (and), | (or), ^ (exclusive or) COMMANDS Command is the major building block of a motion program. Table 16 on page 41 includes syntax definition statements. The statements are structured as follows: • • bold - text specifies literal terms, which appear in the script exactly as specified. Italic - specifies syntax units explained in the right column. Every syntax unit belongs to one of the following groups: variable - one of the variable names expression - arithmetical/logical expression command - any sequence of the Controller commands For example, in definition move absolute_position, absolute_position is an expression that generates variety of possible lines, for example: move 750 move TPOS+225 move V19*300+600 Definition variable = expression generates assignment commands, for example: V9 = V9 +1 VEL = V10*10 XMS Command Syntax The following table describes the XMS command syntax. Table 16: Command Syntax Description Command Syntax Comments variable = expression Assignment. The expression is calculated and its result is assigned to the variable named in the left side. move position Move to absolute position. position is an expression that defines a new target position. If command enable was not executed before, command move also enables the servo loop. After motion execution, the servo loop remains enabled, and the motor keeps final position. XCD0458001-01 Rev. B 41 XCD Motion Script (XMS) Description Table 16: Command Syntax Description Command Syntax Comments nmove position Non-waiting move to absolute position. The command is equivalent to move, but the program does not wait for motion end, and continues executing the next command in parallel and asynchronously to motion progress. To synchronize again to motion execution, the program should wait for motion termination using an empty loop, such as: while S_MOVE end kill Kill motion Current motion is terminated, and the Controller enables deceleration using KDEC parameter. enable Enable servo loop.While servo loop is enabled, the motor actively keeps current position and fixes deviation provided by an external force. Command enable is equivalent to command move FPOS. disable Disable the servo loop. While the servo loop is disabled, the motor doesn't resist actively to external force. However, the piezo motor provides relatively high passive force that in many cases is sufficient to keep the position. home method, position, velocity1, Homing.method selects one of the standard homing method. velocity2 • • • position (optional) is an expression that sets position value in the home point. If omitted, zero is taken. velocity1 is an expression that defines velocity at the first stage of homing procedure. If omitted, VEL value is taken. velocity2 is an expression that defines velocity at the second stage of homing procedure. If omitted, velocity1 value is taken. velocityloop velocity Velocity loop. The Controller switches to velocity-loop operation. Velocity defines the target velocity in the stage’s units (mm or degrees/radians per sec). openloop command Open loop. The Controller switches to open-loop operation; command is an expression that defines drive output value. XCD0458001-01 Rev. B 42 XCD Motion Script (XMS) Description Table 16: Command Syntax Description Command Syntax Comments set variable = expres- Set special variable. The command resembles assignment, but unlike regular assignment causes special actions. The command applies to limited set of variables that are readonly and cannot be addressed in regular assignment. sion Only the following variables can be specified in the command: • • • set FPOS= Defines a new motor position. set TIME=0 The command resets TIME to zero and restarts counting. Right-side value is ignored; counting restarts from zero. set S_IND=0 The command resets S_IND to zero and restarts position latch function. delay time Delay time is an expression that defines the delay time in milliseconds. if expression Conditional statement. If the expression yields a non-zero value, commands1 are executed, else commands2 are executed. The <else command2> close can be omitted. commands1 else commands2 end for variable = initial to final step command end FOR loop. The commands within a loop are repeated specified number of times. The loop header defines the loop variable (one of user variables V0-V19), initial value of the loop variable, final value of the loop variable, and step. Loop variable is incremented by step on each repetition. while expression com- WHILE loop. The commands within a loop are repeated mands while expression yields non-zero value. end config code, value Configure the Controller. The command provides configuration of the Controller. pause Pause program execution. The command effectively provides breakpoint functionality. When the command is encountered, the program stops execution and waits for host commands. Use the command for program debugging with XCD NanoCommander. XCD0458001-01 Rev. B 43 XCD Motion Script (XMS) Description Table 16: Command Syntax Description Command Syntax Comments ppi start, increment, Start position compare pulse generation (incremental). start specifies the first position; once the motor feedback compares to start, the Controller generates the first pulse. increment specifies the distance between pulses in mm; the next position for compare is set as previous position plus increment. The value is either positive or negative. count specifies the number of pulses; if count is one, single pulse at start point is produced. See paragraph 5.4 on page 51. count 4.7.5 VARIABLES All variable names in the XMS program are predefined; i.e. the user can use only these predefined variable names. The XMS variables are subdivided into two classes: • • System variables; each system variable has predefined meaning, for example: • VEL - required motion velocity • FPOS - feedback position User variables with predefined names: V0, V1, V2 … V19. A user variable has no predefined meaning, and can store any number required in a program. All parameter values are displayed in the application’s units. For example, mm and mm/sec for linear stages, and degrees and degrees/sec for rotary stages. Table 17: Required Motion Parameters ID Name Comments 1 VEL Velocity 2 ACC Acceleration 4 KDEC Kill deceleration - used in fault conditions; e.g., if limit switch is activated. XCD0458001-01 Rev. B 44 XCD Motion Script (XMS) Description Table 18: Instant Reference Motion Variables ID Name Comments 5 TPOS Target position 6 RPOS Reference position 7 RVEL Reference velocity 8 RACC Reference acceleration Table 19: Instant Feedback Motion Variables ID Name Comments 9 FPOS Feedback position 10 FVEL Feedback velocity 12 PE Position error 52 POSI Position latched on index pulse. This variable is Read Only. Refer to paragraph 5.2 on page 50 for additional information. Table 20: Time variable ID Name Comments 38 TIME Elapsed time in milliseconds. Table 21: Position Compare Variable ID Name Comments 54 PPW Position compare pulse width in milliseconds. XCD0458001-01 Rev. B 45 XCD Motion Script (XMS) Description Table 22: Servo Loop and Drive Configuration ID Name Comments 13 KP Position loop gain 14 KV Velocity loop gain 15 KI Integral loop gain 16 LI Integrator Limit % of full command 17 BQA1 Bi-Quad filter parameters 18 BQA2 Bi-Quad filter parameters 19 BQB0 Bi-Quad filter parameters 20 BQB1 Bi-Quad filter parameters 21 BQB2 Bi-Quad filter parameters 22 ENR Encoder resolution (millimeters per one encoder count) 23 MFREQ Motor frequency (PWM frequency) 24 SPRD Servo loop sampling period (milliseconds) 40 DZMIN Dead zone min (Nanomotion proprietary algorithm) 41 DZMAX Dead zone max (Nanomotion proprietary algorithm) 42 ZFF Zero feed forward (Nanomotion proprietary algorithm) 43 FRP Friction in positive direction 44 FRN Friction in negative direction 45 DOUT Instant drive output (% of maximal output) Table 23: Safety ID Name Comments 39 DOL Drive output limit (% of maximal output) 53 DOFFS Drive output offset (% of maximal output) 47 SLP Software limit positive 48 SLN Software limit negative 49 PEL Position error limit XCD0458001-01 Rev. B 46 XCD Motion Script (XMS) Description Table 23: Safety ID Name Comments 51 MTL Motion Time limit Table 24: Analog Inputs/Outputs ID Name Comments 30 AIN0 Analog input % 31 AIN1 32 AIN2 33 AIN3 34 AOUT0 Analog output % 35 AOUT1 The analog output value in the range of -100% to +100% is converted to an output voltage V in the range of 0 to 3.3 volts. The AOUT voltage is calculated based on the formula: The analog input voltage V in the range of 0 to 3.3 volts is converted to AIN value in the range of -100% to +100%. The AIN value is calculated based on the formula: AIN=100*(V-1.65) /1.65 V = AOUT*1.65/100 + 1.65 Analog Inputs are not supported in all SW versions or Driver cards. Refer to the user manual for your Driver card. Table 25: User Variables ID Name Comments 1000÷ 1019 V0 - V19 User variables Table 26: Flags (accepted values are 0 or 1) ID Name Comments 2000 IO_0 Digital input 0 (GPIO1 on Motherboard) XCD0458001-01 Rev. B 47 XCD Motion Script (XMS) Description Table 26: Flags (accepted values are 0 or 1) ID Name Comments 2001 IO_1 Digital input 1 (GPIO2 on Motherboard) 2004 IO_2 Digital output 0 (GPIO3 on Motherboard) 2005 IO_3 Digital output 1 (GPIO4 on Motherboard) 2008 S_QUEUE The motion queue is full. While the motion queue is full (S_QUEUE is 1), the nmove command is disabled and returns error. 2009 S_MOVE The motion is in progress. The flag toggles to 1 at motion start (e.g. once move command executes). The flag toggles to 0 at the end of the command profile, once RPOS achieves TPOS. 2010 S_BUSY Servo loop is busy. The flag is 1 while the servo loop is active. After the move/nmove command, the flags toggles to 1 synchronously with S_MOVE, but toggles to 0 (zero) usually later than S_MOVE, once the FPOS enters ±DZMIN interval around TPOS. 2011 S_IND Index position latched. The flag indicates if the encoder index was encountered and POSI variable latched valid index position. 2012 S_HOME Homing is successful. The flag is 0 after Controller powerup. The Controller toggles the flag to 1 after a successful Home operation. The flag indicates that absolute feedback position is available. The flag also can be assigned either in XMS script or by host command Assign (3). XCD0458001-01 Rev. B 48 CHAPTER 5 XMS SPECIAL FUNCTIONS AND EXAMPLES This section contains XMS special functions and examples of XMS operations. 5.1 STAGE LOCATION INFORMATION XCD Controller does not have Stage location information. The XCD Encoder provides velocity and direction information, but does not provide information about absolute position. In order for the Controller to determine the location of the Stage it must run a HOME command. The command has one required parameter, and three optional parameters. HOME method, position, velocity1, velocity2 • s s s s • • • method - required parameter that defines the Homing method. 50 - home on the negative hard-stop 51 - home on the positive hard-stop 60 - Homing on the negative hard-stop and index pulse 61 - Homing on the positive hard-stop and index pulse position - sets position value at the home point. The default value is zero. velocity1 - defines the velocity during the first stage of the homing procedure. The default value is VEL. velocity2 - defines the velocity during the second stage of the homing procedure. The default value is velocity1. In the following image the HOME method is 50, Home on negative hard-stop. If the position is not included in the command the position is marked as 0. This Home position will be used in all motor movements from this point forward. Figure 1: Homing on the Negative hard-stop XCD0458001-01 Rev. B 49 Position Latch and Encoder Index 5.2 POSITION LATCH AND ENCODER INDEX The encoder provides special input for position latch. This input should be connected to encoder index output. The function is used internally in Home functions based on encoder index. Positive pulse on the input causes immediate latching of the current encoder position in variable POSI. The related delay is at nanosecond level and provides one-encoder-count resolution of the latched position. Figure 2: Home and Position Latch Position latch function operates with two XMS variables: • • POSI - real variable S_IND - flag S_IND is zero after Controller start up. Positive pulse on the latch input toggles S_IND to one and latches current encoder position in variable POSI. The value one in S_IND indicates that the latch input was activated and the value of POSI is valid. As long S_IND remains one the next activation of the latch input will not be acted on. To repeat a position latch function, reset S_IND to zero (S_IND = 0). 5.3 XMS EXAMPLE The following XMS example implements a sequence of actions similar to home 60,0,10 command, given the position latch input is connected to encoder index output. Example for Home 60, 0, 10 Implementation Command Description VEL=10 Move at velocity 10 mm/sec. nmove -10000 Infinite move in negative direction. XCD0458001-01 Rev. B 50 Position Compare Example for Home 60, 0, 10 Implementation Command Description while PE>-1 Check if the motor stuck at negative hard-stop. end disable Stop motion immediately. set S_IND=0 Reset S_IND to zero, activate position latching. nmove +10000 Infinite move in positive direction. while S_IND=0 Wait for index pulse. end kill Kill motion. while S_BUSY=0 Wait for motion termination. end set FPOS=FPOS-POSI 5.4 Set axis origin to index position. POSITION COMPARE Position Compare function produces pulses on a Controller output once the motor feedback position compares to a predefined value. The function is supported in hardware; related delay is about 0.1 microseconds. Therefore, the pulse can be used for operating devices synchronously to motor position, e.g. for taking video frames. 5.4.1 POSITION COMPARE ACTIVATION The function is activated with either XMS command ppi or Host command Position Pulse Incremental (33). In both cases, up to three parameters are specified: • • • start specifies the first position; once the motor feedback compares to start, the Controller generates the first pulse. increment specifies the distance between pulses in mm; the next position for compare is set as previous position plus increment. The increment is rounded to integer number of encoder pulses. count specifies number of pulses; if count is one, single pulse at start point is produced. Some of the parameters can be omitted. If increment and count are omitted, the Controller produces only one pulse once the motor achieves start position. If all parameters are omitted, no pulses are produced. The function without parameters effectively cancels currently active Position Compare function. XCD0458001-01 Rev. B 51 Position Compare 5.4.2 POSITION COMPARE OPERATION Being activated with either XMS or Host command, the Position Compare function remains active until the requested number of pulse is produced. If a new ppi or Host (33) command is executed while a previous Position Compare is still active, the previous command is canceled immediately, and the new command starts operating. If the new command is issued with no parameters, the previous function is canceled, but no new function is activated. Once a command activates Position Compare function, no pulse is produced immediately, but the Controller begins comparing feedback position with start value. The first pulse is generated once the compare result changes from notequal to equal. The pulse width is defined by PPW value (pulse width in milliseconds). The Controller adjusts pulse width at the time of function activation; therefore, all pulses requested in a function have the same width. Assigning a new value to PPW has no effect on already active Position Compare function, but will affect the forthcoming commands. Once a position compare occurs, the Controller produces the pulse, and verifies the remaining number of pulses. If all requested pulses have been produced, the Controller deactivates the function avoiding further pulse generation. Otherwise, the Controller adds increment to the current compare value and continues comparing. Position Compare Timing Table 1: 5.4.3 Parameter Value Unit Delay from encoder pulse to output compare pulse 0.1 µsec Minimal width of compare pulse 0.067 µsec Maximal width of compare pulse 273.6 µsec Maximal rate of compare pulses 20 kHz Minimal period of the compare pulses (minimal time between adjacent pulses) 50 µsec POSITION COMPARE EXAMPLE The following XMS fragment shows possible use of ppi command. Table 2: Command Description PPW=0.001 Set pulse width 1 microsecond. move 2.1 Move to position 2.1 mm. ppi 2.2,0.002,201 Request 201 pulses starting at position 2.2 mm with increment 2 µm. XCD0458001-01 Rev. B 52 Position Compare Table 2: Command Description move 2.7 Move to position 2.7 mm. The following diagram shows the result: Figure 3: Motor position compare example 5.4.4 TIME VARIABLE The Controller provides high resolution time service through the variable TIME. This variable provides time in milliseconds elapsed since the Controller start-up, or since the last executed command set TIME=0. The resolution of time counting is 50 µsec. therefore the variable may read fractional values, such as 2345.05. Time counting has the following limitations: • • After about two days of uninterrupted counting TIME variable rolls down to zero and starts new counting cycle. After about 12 minutes of uninterrupted counting the resolution of TIME begins to gradually deteriorate. Command set TIME=0 resets the Time value to zero and restarts counting. To use full resolution, the command should be executed in the application XCD0458001-01 Rev. B 53 XMS Script Examples periodically, so that using of TIME occurs not later than 12 minutes past the last set TIME=0. 5.4.5 SAFE TIME MEASURING The following example shows how to safely use TIME variable for measuring motion time. The XMS program repeats motion 100 times, measures full motion time (up to the motor physically enters DZMIN interval) and stores minimum motion time in V3 and maximum motion time in V4. Example of TIME Variable for Measuring Motion Time Command Description V3=10000 Initialize V3 with big value. V4=0 Initialize V4 with small value. for V19=0 to 99 Repeat 100 times. move 5 Move to initial point. while S_BUSY end Wait for physical motion end. set TIME=0 Reset TIME. move 15 Move. while S_BUSY end Wait for physical motion end. V0=TIME Latch elapsed time. if V0<V3 Update minimum time. V3=V0 End if V0>V4 Update maximum time. V4=V0 end 5.5 move 5 Return to initial point end Repeat XMS SCRIPT EXAMPLES This section provides example XMS scripts for both linear and rotary applications. XCD0458001-01 Rev. B 54 XMS Script Examples 5.5.1 XMS SCRIPT FOR A LINEAR APPLICATION The following linear motion program executes a set of motions. Each motion is positioned to a point in the range of 0 to 20 mm Linear Motion Program Example Command Description V10=999 Seed of random number generator assigned to variable V10. while 1 WHILE loop executes forever, as condition expression is always nonzero. home 50 Homing, method 50 to the left hard-stop for V1=0 to 5 FOR loop executes 6 times, loop variable V1 changes from 0 to 5. // Force-back move Comment. for V0=0 to 5 Inner FOR loop executes 6 times, loop variable V0 changes from 0 to 5. VEL=10+V0*35 Set a required motion velocity. Velocity starts from 10 mm/sec, then rises to 45, 80, 115, 150, and finally reaches 185 mm/sec. move 5 Move to absolute position 5 mm. move 15 Move to absolute position 15 mm. end End of inner FOR loop. move 0 Move to absolute position 0 mm. // Incremental move forward for V0=0 to 3 Comment. Inner FOR loop executes 4 times, loop variable V1 changes from 0 to 5. move RPOS+4 Move to relative position, increment 4 mm. delay 100 Delay for 100 milliseconds. End // Incremental move backward for V0=0 to 3 move RPOS-4 delay 100 End // Variable step forward for V0=1 to 8 End of inner FOR loop. Comment. Inner FOR loop executes 4 times, loop variable V1 changes from 0 to 5. Move to relative position, increment -4 mm. Delay for 100 milliseconds. End of inner FOR loop. Comment. Inner FOR loop executes 8 times, loop variable V1 changes from 1 to 8. move RPOS+0.5*V0 Move to relative position, increments 0.5, 1, 1.5, etc. delay 100 End // Variable step backward XCD0458001-01 Rev. B Delay for 100 milliseconds. End of inner FOR loop. Comment. 55 XMS Script Examples Linear Motion Program Example Command for V0=1 to 8 Description Inner FOR loop executes 8 times, loop variable V1 changes from 1 to 8. move RPOS-0.5*V0 Move to relative position, increments -0.5, -1, -1.5, etc. delay 100 Delay for 100 milliseconds. end end // Positioning to random points for V1=0 to 200 // random number generator (11 bits) V10=V10*993+1 V10=V10&0x07FF End of inner FOR loop. End of outer FOR loop. Comment. FOR loop executes 201 times, loop variable V1 changes from 0 to 200. Comment. At each cycle generate a random number between 0 and 2048. Symbol & designates logical AND. Literal 0x07FF is hexadecimal constant, equal to decimal 2047. Comment. // V10 is random number in the range of 0 to 2048 move 18*V10/2048 Move to random absolute position in the range from 0 to 18 mm. delay 100 Delay for 100 milliseconds. end End 5.5.2 End of FOR loop. End of WHILE loop. XMS SCRIPT FOR A ROTARY APPLICATION The following motion program performs a series of tests on a rotary stage with hard-stops to determine the stage’s ability to operate correctly. The program locates the stage’s hard stops, identifies the index, and then runs a four hour conditioning program. Rotary Application with Hard-stop Motion Program Example Command Description // Program HR2 motor Rotary Stage encoder renishaw 1184000 counts/rev scale in deg // setting motor controller configuration config 900,0x00091000 //inverse output (bit19)High res (bit 16=0), enable biquad (bit 12) // setting controller motor parameters // home zero 0.5mm from HS ENR =360/1184000 define user units in degrees V0=0 user variable for Home offset DZMIN = ENR DZMIN is set equal to Encoder resolution DZMAX = 15*ENR DZMAX is set to 15 times the Encoder resolution PEL=5 Sets maximum position error to 5 degrees ZFF = 0.003 Zero Feed Forward is set to 0.003 degrees FRN = 10 Negative Friction is set to 10% FRP = 10 Positive Friction is set to 10% XCD0458001-01 Rev. B 56 XMS Script Examples Rotary Application with Hard-stop Motion Program Example Command Description MTL = 60000 Maximum Time Limit is set to 60 seconds KP = 300 KV = 0.5 KI = 300 LI = 60 VEL = 40 Velocity is set to 40 deg/sec ACC = 500 Acceleration is set to 500 deg/second2 KDEC = 1000 Kill deceleration at 1000 deg/sec2 //Find the negative hard-stop nmove -500 move in a negative direction to a position that is larger than the hard-stop. In this case while PE>-0.5 The loop continues as long as the position error (PE) is greater than -0.5 degree. end disable When the PE is less than -0.5 stop the loop because the hard-stop has been found, and disable motor. //Find the Position Index and set the Index Position to Home offset (V0) nmove 360 set S_IND=0 while S_IND=0 end kill delay 100 set FPOS=FPOS-POSI-V0 For V0=0 set the index position to 0 position //Find Home offset nmove -360 while PE>-0.5 end disable // V0=FPOS+185 This value is the distance of the Index from the middle of the stage set FPOS=-5 Set the negative hardstop position to -5 degrees VEL=120 set the velocity to 120 deg/sec V2=0 is the maximum positive position error when the reference velocity is in the constant velocity range. V3=0 is the minimum position error when the reference velocity is in the constant velocity range. V4=0 is the maximum positive PWM (DOUT) V5=0 is the minimum negative PWM (DOUT) //Finds maximum and minimum position error, and maximum and minimum DOUT over the total stage travel during a four hour period V19=TIME start time while (TIME-V19) < (4*3600000) execute the following lines when the current time minus start time is less than 4 hours nmove 360 delay 2 XCD0458001-01 Rev. B 57 XMS Script Examples Rotary Application with Hard-stop Motion Program Example Command Description while RVEL<VEL while in the acceleration stage (RVEL<VEL) the loop will continue end while RVEL=VEL if PE>V2 Measures the maximum and minimum position error and the DOUT in the constant velocity range. V2=PE end if PE<V3 V3=PE end if DOUT<V4 V4=DOUT end while S_BUSY end delay 1000 nmove 0 delay 2 while RVEL>-VEL end while RVEL=-VEL if PE>V2 while in the acceleration stage (RVEL>-VEL) the loop will continue Measures the maximum and minimum position error and the DOUT in the constant velocity range. V2=PE end if PE<V3 V3=PE end if DOUT>V5 V5=DOUT end while S_BUSY end delay 1000 end XCD0458001-01 Rev. B 58 CHAPTER 6 COMMUNICATION EXAMPLES This section provides examples of command and response sequences and Byte. 6.1 EXPLANATION OF COMMAND-RESPONSE SEQUENCE This example shows the sequence for the REPORT [0x1A (26)] command with the variable STATUS [0x384 (900)]. The REPORT command can include up to ten variables. Each variable is identified by four Bytes. In the command and reply examples below, the Bytes are shown in the order they are transmitted via RS232. Figure 1: Byte Sequence for REPORT STATUS Command The Command prefix contains four Bytes. The first two are constant values. The third Byte is the address of the Controller and the fourth Byte is the length of the Command body, in this case three Bytes. The fourth position in the sequence begins the Command body and defines the Command. In this case REPORT (26). The next Bytes define the variables for the Command. In this example the Variable code is 900 (0x384) and requires two Bytes, defined by the fifth and sixth positions. Because the Bytes that define the Variable are transmitted as little endian, the LSB (0x84) appears first in the stream and the MSB (0x03) appears second. Table 1: Command Prefix and Body Contents Byte Offset Byte Value Hex (decimal) Comments 0 0xE4 (228) Constant 0xE4 (228) 1 0xA5 (165) Constant 0xA5 (165) 2 0xA4 (164) Destination address 3 0x03 (3) Length of the command body 4 0x1A (26) Command REPORT 5 0x84 (132) LSB of variable STATUS (900) 6 0x03 (3) MSB of variable STATUS (900) XCD0458001-01 Rev. B 59 Explanation of Command-Response Sequence The Reply also contains a prefix and body. Figure 2: Byte Sequence of REPORT STATUS Reply The Reply prefix contains four Bytes. The first two are constant values. The third Byte is the destination address, the Host that send the Command. The fourth Byte is the length of the reply. The Reply body begins at Byte offset 4. This position is the code of the command being replied to. Byte offset 5 indicates if the Command was accepted. Byte offsets 6 thru 9 provide the 31 bits available in the STATUS reply Table 2: Byte Offset Byte Value Hex (decimal) Comments 0 0xE4 (228) Constant 0xE4 (228). 1 0xA5 (165) Constant 0xA5 (165). 2 0x00 (0) Destination address. 3 0x06 (6) Length of the reply body. 4 0x1A ( ) Last command code. 5 0x01 (1) Command accepted 6 0x0D ( ) Bits 0- 7 7 0x17 ( ) Bits 8-15 8 0x09 ( ) Bits 16-23 9 0x01 ( ) Bits 24-31 The 31 bits of the STATUS variable reply, Byte offsets 6-9, are shown below: Table 3: Bit Function 0 Script Run flag 1 S_QUEUE flag 2 S_MOVE flag 3 S_BUSY flag 4-7 reserved 8 Open Loop flag 9 Velocity Loop flag XCD0458001-01 Rev. B 60 RS232 examples Table 3: 6.2 Bit Function 10 Position Loop flag 11 reserved 12 BiQuad filter enabled 13 Second BiQuad filter enable 14 non-stop mode 15 reserved 16 Low Resolution flag 17 HR motor flag (always 0) 18 Inverse Feedback 19 Inverse Drive Output 20 Simulation mode 21-23 reserved 24 Logical Motion flag (internal) 25 Hold Position flag (internal) 26 Kill flag (internal) 27-31 reserved RS232 EXAMPLES The examples below show RS232 byte sequences for few typical commands. Destination and controller address for RS232 communication is zero. 6.2.1 MOVE MOTOR TO POSITION 2.5 (MILLIMETERS) The Host sends the following sequence of bytes: Table 4: Byte Offset Byte Value Comments 0 0xE4 (228) Constant 0xE4 (228). 1 0xA5 (165) Constant 0xA5 (165). 2 0x00 (0) Destination address. 3 0x05 (5) Length of the command body. 4 0x01 (1) Command MOVE 5 0x00 (0) 2.5 (Real format) XCD0458001-01 Rev. B 61 RS232 examples Table 4: Byte Offset Byte Value 6 0x00 (0) 7 0x20 (32) 8 0x40 (64) Comments The Controller responds with acknowledge: Table 5: 6.2.2 Byte Offset Byte Value Comments 0 0xE4 (228) Constant 0xE4 (228). 1 0xA5 (165) Constant 0xA5 (165). 2 0x00 (0) Destination address. 3 0x02 (2) Length of the reply body. 4 0x01 (1) Last command code. 5 0x01 (1) Acknowledge - command accepted. SET MOTION VELOCITY 70 (MM/SEC) The Host sends the following sequence of bytes: Table 6: Byte Offset Byte Value Comments 0 0xE4 (228) Constant 0xE4 (228) 1 0xA5 (165) Constant 0xA5 (165) 2 0x00 (0) Destination address. 3 0x07(7) Length of the command body 4 0x03 (3) Command ASSIGN 5 0x01 (1) ID of VEL variable 6 0x00 (0) 7 0x00 (0) 8 0x00 (0) 9 0x8C (140) 10 0x42 (66) XCD0458001-01 Rev. B 70 (Real format) 62 RS232 examples The Controller responds with acknowledge: Table 7: 6.2.3 Byte Offset Byte Value Comments 0 0xE4 (228) Constant 0xE4 (228). 1 0xA5 (165) Constant 0xA5 (165). 2 0x00 (0) Destination address. 3 0x02 (2) Length of the reply body. 4 0x03 (3) Last command code. 5 0x01 (1) Acknowledge - command accepted. READ FEEDBACK POSITION The Host sends the following sequence of bytes: Table 8: Byte Offset Byte Value Comments 0 0xE4 (228) Constant 0xE4 (228). 1 0xA5 (165) Constant 0xA5 (165). 2 0x00 (0) Destination address. 3 0x03(3) Length of the command body. 4 0x1A (26) Command REPORT 5 0x09 (9) ID of FPOS variable 6 0x00 (0) The Controller responds with sending actual position (FPOS) value; assume actual position is 3.11 mm: Table 9: Byte Offset Byte Value Comments 0 0xE4 (228) Constant 0xE4 (228). 1 0xA5 (165) Constant 0xA5 (165). 2 0x1A (26) Last command code. 3 0x01 (1) Acknowledge - command accepted. 4 0x3D (61) 3.11 (Real format) XCD0458001-01 Rev. B 63 IIC examples Table 9: 6.3 Byte Offset Byte Value 5 0x0A (10) 6 0x47 (71) 7 0x40 (64) Comments IIC EXAMPLES The examples below show IIC byte sequences for few typical commands. All examples imply default IIC controller address 0xA4. If actual controller address was changed, the destination and controller address fields should be changed accordingly. 6.3.1 MOVE MOTOR TO POSITION 2.5 (MILLIMETERS) The Host sends the following sequence of bytes: Table 10: Byte Offset Byte Value Comments 0 0xA4 (164) Destination address. 1 0x05 (5) Length of the command body. 2 0x01 (1) Command MOVE 3 0x00 (0) 2.5 (Real format) 4 0x00 (0) 5 0x20 (32) 6 0x40 (64) The Controller responds with acknowledge: Table 11: Byte Offset Byte Value Comments 0 0xA5 (165) Destination address plus one (sent by the host). 1 0x02 (2) Length of the reply body. 2 0x01 (1) Last command code. 3 0x01 (1) Acknowledge - command accepted. XCD0458001-01 Rev. B 64 IIC examples 6.3.2 SET MOTION VELOCITY 70 (MM/SEC) The Host sends the following sequence of bytes: Table 12: Byte Offset Byte Value Comments 0 0xA4 (164) Destination address. 1 0x07(7) Length of the command body. 2 0x03 (3) Command ASSIGN 3 0x01 (1) ID of VEL variable 4 0x00 (0) 5 0x00 (0) 6 0x00 (0) 7 0x8C (140) 8 0x42 (66) 70 (Real format) The Controller responds with acknowledge: Table 13: 6.3.3 Byte Offset Byte Value Comments 0 0xA5 (165) Destination address plus one (sent by the host). 1 0x02 (2) Length of the reply body. 2 0x03 (3) Last command code. 3 0x01 (1) Acknowledge - command accepted. READ FEEDBACK POSITION The Host sends the following sequence of bytes: Table 14: Byte Offset Byte Value Comments 0 0xA4 (164) Destination address. 1 0x03(3) Length of the command body 2 0x1A (26) Command REPORT 3 0x09 (9) ID of FPOS variable XCD0458001-01 Rev. B 65 IIC examples Table 14: Byte Offset Byte Value 4 0x00 (0) Comments The Controller responds with sending actual position (FPOS) value; assume actual position is 3.11 mm: Table 15: Byte Offset Byte Value Comments 0 0xA5 (165) Destination address plus one (sent by the host). 1 0x06 (6) Length of the reply body. 2 0x1A (26) Last command code. 3 0x01 (1) Acknowledge - command accepted. 4 0x3D (61) 3.11 (Real format) 5 0x0A (10) 6 0x47 (71) 7 0x40 (64) XCD0458001-01 Rev. B 66 INDEX address communication . . . . . . . . . . . . . . . . . . . .23 Assign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 destination . . . . . . . . . . . . . . . . . . . . . . . 23 host . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 config XMS command . . . . . . . . . . . . . . . . . . . 37 configuration codes . . . . . . . . . . . . . . . . . . . 38 Configure . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 host command . . . . . . . . . . . . . . . . . . . . 37 C D A Command sequence explanation . . . . . . . . . . . . . . .59 command body format . . . . . . . . . . . . . . . . . . . . . .25 prefix . . . . . . . . . . . . . . . . . . . . . . . . . . .24 report explanation . . . . . . . . . . . . . . . . . . . .59 command parameter format . . . . . . . . . . . . . . . . . . . . . . . . . . .26 command syntax config . . . . . . . . . . . . . . . . . . . . . . . . . . .43 delay . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 disable . . . . . . . . . . . . . . . . . . . . . . . . . .42 enable . . . . . . . . . . . . . . . . . . . . . . . . . . .42 for end . . . . . . . . . . . . . . . . . . . . . . . . . .43 home . . . . . . . . . . . . . . . . . . . . . . . . . . .42 if else . . . . . . . . . . . . . . . . . . . . . . . . . . .43 kill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 move . . . . . . . . . . . . . . . . . . . . . . . . . . . .41 nmove . . . . . . . . . . . . . . . . . . . . . . . . . . .42 openloop . . . . . . . . . . . . . . . . . . . . . . . . .42 pause . . . . . . . . . . . . . . . . . . . . . . . . . . .43 ppi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 variable= . . . . . . . . . . . . . . . . . . . . . . . .41 while end . . . . . . . . . . . . . . . . . . . . . . . .43 commands . . . . . . . . . . . . . . . . . . . . . . . . . .28 communication address . . . . . . . . . . . . . . . . . . . . . . . . . .23 channel . . . . . . . . . . . . . . . . . . . . . . . . . .23 controller . . . . . . . . . . . . . . . . . . . . . . . .23 example IIC . . . . . . . . . . . . . . . . . . . . . . . . . . .64 RS232 . . . . . . . . . . . . . . . . . . . . . . . .61 host . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 protocol . . . . . . . . . . . . . . . . . . . . . . . . . .8 communication address broadcasting . . . . . . . . . . . . . . . . . . . . . .23 default . . . . . . . . . . . . . . . . . . . . . . . . . .23 XCD0458001-01 Rev. B Disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 DZMAX blackout . . . . . . . . . . . . . . . . . . . . . 36 E Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 encoder index . . . . . . . . . . . . . . . . . . . . . . . 50 F flag IO_0 . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 IO_1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 IO_2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 IO_3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 S_BUSY . . . . . . . . . . . . . . . . . . . . . . . . . 48 S_HOME . . . . . . . . . . . . . . . . . . . . . . . . 48 S_IND . . . . . . . . . . . . . . . . . . . . . . . . . . 48 S_MOVE . . . . . . . . . . . . . . . . . . . . . . . . . 48 S_QUEUE . . . . . . . . . . . . . . . . . . . . . . . . 48 H Home . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 home . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 method . . . . . . . . . . . . . . . . . . . . . . . . . 49 position . . . . . . . . . . . . . . . . . . . . . . . . . 49 velocity . . . . . . . . . . . . . . . . . . . . . . . . . 49 I IIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 address . . . . . . . . . . . . . . . . . . . . . . 37, 39 master write command . . . . . . . . . . . . . 38 K Kill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 L little endian . . . . . . . . . . . . . . . . . . . . . . . . . 59 67 M Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 Monitor address . . . . . . . . . . . . . . . . . . . . . .32 Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 O Open loop . . . . . . . . . . . . . . . . . . . . . . . . . . .29 P POSI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 Position . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 position compare . . . . . . . . . . . . . . . . . . . . .51 count . . . . . . . . . . . . . . . . . . . . . . . . . . .51 increment . . . . . . . . . . . . . . . . . . . . . . . .51 start . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 program status . . . . . . . . . . . . . . . . . . . . . . .36 pseudo-variable . . . . . . . . . . . . . . . . . . . . . .33 UART address . . . . . . . . . . . . . . . . . . . . 37, 39 user variables . . . . . . . . . . . . . . . . . . . . . . . 44 X XCD Commander installation . . . . . . . . . . . . . . . . . . . . . . . . 9 interface . . . . . . . . . . . . . . . . . . . . . . . . . 8 work flow . . . . . . . . . . . . . . . . . . . . . . . . . 9 XCD Motion Script . . . . . . . . . . . . . . . . . . . . . 8 XMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 command syntax . . . . . . . . . . . . . . . . . . . . . . . 41 example . . . . . . . . . . . . . . . . . . . . . . . . . 50 floating point values . . . . . . . . . . . . . . . 39 literal constants . . . . . . . . . . . . . . . . . . . 39 units . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 variables . . . . . . . . . . . . . . . . . . . . . 40, 44 system . . . . . . . . . . . . . . . . . . . . . . . 44 user . . . . . . . . . . . . . . . . . . . . . . . . . 44 R Read version . . . . . . . . . . . . . . . . . . . . . . . . .30 Report . . . . . . . . . . . . . . . . . . . . . . . . . . .32, 33 RS232 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 S safety disable . . . . . . . . . . . . . . . . . . . . .36, 38 safety inverse . . . . . . . . . . . . . . . . . . . . .36, 39 Save parameters . . . . . . . . . . . . . . . . . . . . .29 servo configuration . . . . . . . . . . . . . . . . . . . .38 servo loop tuning . . . . . . . . . . . . . . . . . . . . . . . . . . .15 Set FPOS . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 S_IND . . . . . . . . . . . . . . . . . . . . . . . . . . .43 TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 Set address . . . . . . . . . . . . . . . . . . . . . . . . . .30 S_IND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 system variables . . . . . . . . . . . . . . . . . . . . . .44 T time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 U UART RS232 . . . . . . . . . . . . . . . . . . . . . . . . . . .24 XCD0458001-01 Rev. B 68 XCD0458001-01 Rev. B 69