smp motion programming manual - soft...

124
SMP Motion Programming Manual Revision 2.36 © 2011 Soft Servo Systems, Inc.

Upload: others

Post on 24-Feb-2021

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP Motion Programming Manual

Revision 2.36 © 2011 Soft Servo Systems, Inc.

Page 2: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Warning / Important Notice

Warning

The product described herein has the potential – through misuse, inattention, or lack of understanding – to create conditions that could result in personal injury, damage to equipment, or damage to the product(s) described herein. Machinery in motion and high-power, high-current servo drives can be dangerous; potentially hazardous situations such as runaway motors could result in death; burning or other serious personal injury to personnel; damage to equipment or machinery; or economic loss if procedures aren’t followed properly. Soft Servo Systems, Inc. assumes no liability for any personal injury, property damage, losses or claims arising from misapplication of its products. In no event shall Soft Servo Systems, Inc. or its suppliers be liable to you or any other person for any incidental collateral, special or consequential damages to machines or products, including without limitation, property damage, damages for loss of profits, loss of customers, loss of goodwill, work stoppage, data loss, computer failure or malfunction claims by any party other than you, or any and all similar damages or loss even if Soft Servo Systems, Inc., its suppliers, or its agent has been advised of the possibility of such damages. It is therefore necessary for any and all personnel involved in the installation, maintenance, or use of these products to thoroughly read this manual and related manuals and understand their contents. Soft Servo Systems, Inc. stands ready to answer any questions or clarify any confusion related to these products in as timely a manner as possible. The selection and application of Soft Servo Systems, Inc.’s products remain the responsibility of the equipment designer or end user. Soft Servo Systems, Inc. accepts no responsibility for the way its controls are incorporated into a machine tool or factory automation setting. Any documentation and warnings provided by Soft Servo Systems, Inc. must be promptly provided to any end users. This document is based on information that was available at the time of publication. All efforts have been made to ensure that this document is accurate and complete. However, due to the widely varying uses of this product, and the variety of software and hardware configurations possible in connection with these uses, the information contained in this manual does not purport to cover every possible situation, contingency or variation in hardware or software configuration that could possibly arise in connection with the installation, maintenance, and use of the products described herein. Soft Servo Systems, Inc. assumes no obligations of notice to holders of this document with respect to changes subsequently made. Under no circumstances will Soft Servo Systems, Inc. be liable for any damages or injuries resulting from any defect or omission in this manual. Soft Servo Systems, Inc. makes no representation or warranty, expressed, implied, or statutory with respect to, and assumes no responsibility for the accuracy, completeness, sufficiency, or usefulness of the information contained herein. NO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS OF PURPOSE SHALL APPLY.

_____________________________________________________________________________________ i

Page 3: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Warning / Important Notice

Important Notice

The information contained in this manual is intended to be used only for the purposes agreed upon in the related contract with Soft Servo Systems, Inc. All material contained herein is subject to restricted rights and restrictions set forth in the contract between the parties. These manuals contain confidential and proprietary information that is not to be shared with, nor distributed to, third parties by any means without the prior express, written permission of Soft Servo Systems, Inc. No materials contained herein are to be duplicated or reproduced in whole or in part without the express, written permission of Soft Servo Systems, Inc. Although every effort and precaution has been taken in preparing this manual, the information contained herein is subject to change without notice. This is because Soft Servo Systems, Inc. is constantly striving to improve its products. Soft Servo Systems, Inc. assumes no responsibility for errors or omissions. All rights reserved. Any violations of contractual agreements pertaining to the materials herein will be prosecuted to the full extent of the law.

Due to the preread/block buffering aspect of macro statement execution, it is possible that macro statements using system variables may be evaluated, parsed, and delivered to the block buffer BEFORE the previous lines have been executed, and before the relevant system parameters have been updated. Therefore, the evaluation of a macro statement containing a system variable may not evaluate as expected. IF YOU DO NOT PROGRAM IN BLOCK DELAYS BEFORE STATEMENTS INVOLVING SYSTEM VARIABLES, YOU WILL GET UNEXPECTED RESULTS IN THE EXECUTION OF YOUR MACRO PROGRAMS. For more information, see Section 15.1: Preread Function/Block Buffering – Problems and Workaround.

CAUTION !

_____________________________________________________________________________________ ii

Page 4: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Contents

Table of Contents

............................................................................................................................................................................................ i Warning............................................................................................................................................................................. ii Important Notice.......................................................................................................................................................................... iii Table of Contents

................................................................................................................................................................................... v List of Tables................................................................................................................................................................................ vi List of Figures

......................................................................................... 1-1 Chapter 1: Overview of the SMP Motion Programming Language1.1 Description of the SMP Motion Programming Language............................................................................... 1-1

............................................................................. 1-1 1.2 Components of the SMP Motion Programming Language.................................................................................. 1-1 1.3 Numerals in the SMP Motion Programming Language

...................................................................................................... 1-2 1.4 Blocks of Code and Duplicate Parameters............................................................................................................................................... 2-1 Chapter 2: Address Descriptions

................................................................................................................................... 3-1 Chapter 3: Format for Motion Programs............................................................................................................. 3-1 3.1 General Format for Motion Programs

................................................................................................................... 3-1 3.2 Format for Distance and Feedrate.......................................................................................................................................... 3-1 3.3 Block Delete Code

............................................................................................................................................... 3-2 3.4 Comment Code......................................................................................................................................... 3-2 3.5 Optional Skip Code

.................................................................................................................... 3-2 3.6 How SMP Handles Unused Data....................................................................................................... 4-1 Chapter 4: Order of Operations for Motion Programming

............................................................................................................................................ 5-1 Chapter 5: Subprogram Functions............................................................................................................ 5-1 5.1 Description of Subprogram Functions

.................................................................................................. 5-1 5.2 Required Format for Subprogram Functions............................................................ 5-1 5.3 Possible Parameters That Can Be Used With Subprogram Functions

................................................................................................................. 5-1 5.4 Example of Subprogram Functions............................................................................................................. 5-2 5.5 Variations on Subprogram Functions

.................................................................................................................... 5-2 5.6 Notes for Subprogram Functions........................................................................................................................... 6-1 Chapter 6: G Codes (Preparatory Functions)

........................................................................................................................ 6-1 6.1 Modes and Modal Commands...................................................................................................................................... 6-2 6.2 Summary of G Codes

.................................................................................................................. 6-5 6.3 Detailed Explanations of G Codes............................................................................................ 6-5 6.3.1 Rapid Positioning (No Interpolation) (G00)

................................................ 6-7 6.3.2 Rapid Traverse with Specified Acceleration/Deceleration Rate (G00.1)...................................................................................................................... 6-8 6.3.3 Linear Interpolation (G01)

........................................................................................................... 6-9 6.3.4 Circular Interpolation (G02, G03).......................................................................................................... 6-14 6.3.5 Helical Interpolation (G02, G03)

.............................................................. 6-16 6.3.6 Positive / Negative Exponential Interpolation (G02.3, G03.3).......................................................................................................................................... 6-17 6.3.7 Dwell (G04)

.............................. 6-18 6.3.8 Three-Dimensional Dynamic Look-Ahead Contour Control On / Off (G05, G08)........................................................................................................... 6-20 6.3.9 Programmable Data Input (G10)

................................................................................................... 6-25 6.3.11 Inch / Metric Data Input (G20, G21)........................................................... 6-26 6.3.12 Automatic Zero Return to/from Reference Points (G28, G29).......................................................... 6-28 6.3.13 Automatic Zero Return To Additional Reference Points (G30)

.............................................................................................................................. 6-29 6.3.14 Skip Cutting (G31)................................................................. 6-31 6.3.15 Tool Radius Compensations (TRC) (G40, G41 and G42)

................... 6-32 6.3.16 Positive/Negative Tool Length Compensation/ Compensation Cancel (G43, G44, G49)............................................................................................................... 6-34 6.3.17 Scaling Off / On (G50, G51)

............................................................................................... 6-36 6.3.18 Mirror Image Off / On (G50.1, G51.1).......................................................................................... 6-38 6.3.19 Local Coordinate System Selection (G52)

..................................................................................... 6-39 6.3.20 Machine Coordinate System Selection (G53)...................................................................................... 6-40 6.3.21 Workpiece Coordinate Selection (G54-G59)

6.3.22 Exact Stop Check Mode, Continuous Cutting Mode and Continuous Cutting Mode With Block Rollover (G61, G64, G64.1) ............................................................................................................ 6-41

.................................................................................................................... 6-43 6.3.23 Simple Macro Call (G65)

_____________________________________________________________________________________ iii

Page 5: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Contents

.................................. 6-44 6.3.24 Coordinate System Rotation/Coordinate System Rotation Cancel (G68, G69).............................................................................. 6-47 6.3.25 Absolute / Incremental Programming (G90, G91)

....................................................................................... 6-48 6.3.26 Workpiece Coordinate Programming (G92)..................................... 6-48 6.3.27 Linear Interpolation Feedrate Include / Exclude Rotary Axes (G310, G311)

............................................................................................................................. 7-1 Chapter 7: M Codes (Miscellaneous Codes).................................................................................................................................... 8-1 Chapter 8: Tool Functions and T Codes

...................................................................................................................................... 8-1 8.1 Overview of T Codes.................................................................................................................................................... 8-1 8.2 Tool Offsets

................................................................................................................................................. 9-1 Chapter 9: Macro Programming............................................................................................................................ 9-1 9.1 What Is A Macro Program?

........................................................... 9-1 9.2 Differences Between Simple (Non-Macro) Subprograms and Macros............................................ 9-2 9.3 Differences Between Macro Statements and Motion Programming Statements

........................................................................................................................ 9-3 9.4 General Format Requirements................................................................................................................................................................ 10-1 Chapter 10: Variables

................................................................................................................................ 10-1 10.1 Overview of Variables...................................................................................................................................... 10-1 10.2 Types of Variables

........................................................................................................ 10-2 10.3 Specifying and Referencing Variables.......................................................................................................................... 10-2 10.3.1 Specifying a Variable

........................................................................................................................ 10-3 10.3.2 Referencing a Variable........................................................................................................................................... 10-4 10.4 Variable Values

.......................................................................................................... 10-4 10.4.1 Allowable Values for Variables..................................................................................................... 10-4 10.4.2 Rounding of Referenced Variables

.............................................................................................. 10-4 10.5 Processing Null and Uninitialized Variables............................................................................ 10-4 10.5.1 Uninitialized Variables in a Mathematical Formula

............................................................................. 10-5 10.5.2 Uninitialized Variables in a Movement Command.......................................................................... 10-5 10.5.3 Uninitialized Variables in a Conditional Expression

.................................................................................................................................................. 11-1 Chapter 11: System Variables................................................................................................................... 11-1 11.1 Overview of System Variables

.......................................................................................... 11-2 11.2 System Variables for Interfacing with the PLC.................................................................................................. 11-4 11.3 System Variables for Tool Compensation

11.4 System Variables for Timers....................................................................................................................... 11-4 ................................................................................................... 11-5 11.5 System Variables for Modal Information

................................................................................................. 11-7 11.6 System Variables for Position Information............................................................................................ 11-8 11.7 System Variables for Workpiece Coordinates

............................................................................................ 12-1 Chapter 12: Mathematical Operations and Logical Operations................................................................................... 12-1 12.1 Summary of Mathematical and Logical Operations

....................................................................................... 12-3 12.2 Format of Mathematical and Logical Operations.................................................................................................................................... 12-4 12.3 Order of Operations

................................................................................................................................................ 12-4 12.3.1 Nesting.......................................................................................................................... 12-4 12.3.2 Priority of Operations

.................................................................................................................................... 12-4 12.4 Precision and Errors.............................................. 12-4 12.4.1 Precision and Errors Related to Mathematical and Logical Operations

................................................................... 12-5 12.4.2 Precision and Errors Related to Conditional Expressions............................................................... 12-6 12.4.3 Errors Related to Null Variables or Uninitialized Variables

...................................................................................................... 13-1 Chapter 13: Flow of Control – Branching and Repetition.......................................................................................................................... 13-1 13.1 Overview of Flow Control

............................................................................................ 13-1 13.2 GOTO Statement (Unconditional Branching)................................................................................... 13-2 13.3 Conditional Statements and Comparison Operators

................................................................................................................................................ 13-3 13.4 IF Statement..................................................................................................... 13-3 13.4.1 IF GOTO (Conditional Branching)

...................................................................................................... 13-4 13.4.2 IF THEN (Conditional Execution)................................................................. 13-4 13.4.3 IF ELSE ENDIF (Conditional Execution with Branching)

.................................................................................. 13-5 13.5 WHILE DO END Statement (Conditional Looping)........................................................................................................................................................ 13-6 13.6 Nesting

............................................................................................................................. 13-6 13.6.1 Acceptable Nesting.......................................................................................................................... 13-7 13.6.2 Unacceptable Nesting

_____________________________________________________________________________________ iv

Page 6: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Contents

......................................................................... 13-7 13.6.2.1 Overlapping DO Ranges of WHILE Statements13.6.2.2 GOTO Statements That Branch The Flow Of Control Within A DO END Loop Of A WHILE Statement................................................................................................................................................... 13-7

.............................................................................................................................. 13-8 13.6.2.3 Infinite Loops....................................................................................................................................... 14-1 Chapter 14: Calling Macro Programs

............................................................................................................................ 14-1 14.1 Overview of Macro Calls................................................................................................................................ 14-2 14.2 Argument Assignment

............................................................................................................................ 14-3 14.3 Simple Macro Call (G65)............................................................................................................................. 14-4 14.4 G65 Macro Call Nesting

........................................................ 14-5 14.5 Custom Macro Calls Using G Codes, M Codes, S Codes or T Codes............................................................................................................................................. 14-5 14.5.1 Overview

................................. 14-6 14.5.2 Custom G Code, M Code, S Code or T Code Macro Call Function Parameters.............................................................................................. 14-6 14.5.2.1 Macro Program Folder (Full Path)

...................................................................................................... 14-7 14.5.2.2 Output File Name (Full Path)............................................................................................................................. 14-8 14.5.2.3 S Code Setting............................................................................................................................. 14-9 14.5.2.4 T Code Setting

........................................................................................................................ 14-10 14.5.2.5 M Code Settings......................................................................................................................... 14-11 14.5.2.6 G Code Settings

............................................................................................................................... 15-1 Chapter 15: Macro Statement Processing............................................................... 15-1 15.1 Preread Function/Block Buffering – Problems and Workaround

.................................................................................................................. 15-2 15.2 Single Block and Optional Skip.............................................................................................. 16-1 Chapter 16: Macro Examples: Automatic Tool Change (ATC)

..................................................................................................................................................... 16-1 16.1 Overview.................................................................................................................................. 16-1 16.2 ATC – the SMP Way

................................................................................................... 16-1 16.3 ATC Example #1: Simple ATC Function................................................................. 16-3 16.4 ATC Example #2: ATC Using Customized G, M and T Codes

............................................................................................................................................. 17-1 Chapter 17: Direct Digital Output................................................................................................................................................................................................. I Index

List of Tables

................................. 1-2 Table 1-1: Summary of Numeric Interpretation in the SMP Motion Programming Language.............................................................................................. 2-1 Table 2-1: Summary of Address Descriptions (1 of 2).............................................................................................. 2-2 Table 2-2: Summary of Address Descriptions (2 of 2)

.................................................................................................................................. 4-1 Table 4-1: Order of Operations.................................................................................................................. 6-2 Table 6-1: Summary of G Codes (1 of 3).................................................................................................................. 6-3 Table 6-2: Summary of G Codes (2 of 3).................................................................................................................. 6-4 Table 6-3: Summary of G Codes (3 of 3)

.............................................................................................................................. 7-1 Table 7-1: Summary of M Codes............................................................................................................. 11-1 Table 11-1: Summary of System Variables

........................................................................................ 11-2 Table 11-2: System Variables for PLC Interface (1 of 2)

........................................................................................ 11-3 Table 11-3: System Variables for PLC Interface (2 of 2)............................................................................ 11-4 Table 11-4: System Variable Numbers for Tool Compensations

................................................................................................................ 11-4 Table 11-5: System Variables for Timers............................................................................................. 11-6 Table 11-6: System Variables for Modal Information

.......................................................................................... 11-7 Table 11-7: System Variables for Position Information..................................................................................... 11-8 Table 11-8: System Variables for Workpiece Coordinates

................................................................ 12-1 Table 12-1: Summary of Mathematical and Logical Operations (1 of 3)

................................................................ 12-2 Table 12-2: Summary of Mathematical and Logical Operations (2 of 3)

................................................................ 12-3 Table 12-3: Summary of Mathematical and Logical Operations (3 of 3)..................................................................................................... 13-2 Table 13-1: Summary of Comparison Operators

........................................ 14-1 Table 14-1: Summary of Differences between M98 Subprogram Call and Macro Calls........................................................... 14-2 Table 14-2: Summary of Argument Assignment Protocol for SMP Macros

_____________________________________________________________________________________ v

Page 7: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Contents

List of Figures

............................................................................................................................ 1-1 Figure 1-1: Typical Block of Code..................................................................................................... 3-1 Figure 3-1: Typical Format for Motion Programs

....................................................................................................................... 5-1 Figure 5-1: Main Program (Example).................................................................................................. 5-2 Figure 5-2: OMoveXY.dat (Subprogram Example)

........................................................................................................................................ 6-5 Figure 6-1: Rapid Traverse................................................................................................................................ 6-8 Figure 6-2: Linear Interpolation

.............................................................................................................................. 6-9 Figure 6-3: Circular Interpolation............................................................................................... 6-10 Figure 6-4: G02/G03 in the XY, ZX and YZ Planes

.............................................................................................................................. 6-11 Figure 6-5: G02/G03 Limitation.................................................................. 6-12 Figure 6-6: Positive and Negative Arc Radii for Circular Interpolation

............................................................................. 6-13 Figure 6-7: Unacceptable Parameters for Circular Interpolation...................................... 6-13 Figure 6-8: Arc Movement Produced by Incorrect Parameters for Circular Interpolation

............................................................................................................................. 6-14 Figure 6-9: Helical Interpolation.................................................................................................................... 6-16 Figure 6-10: Exponential Interpolation

..................................................................................... 6-26 Figure 6-11: Automatic Return to Reference Points (G28)Figure 6-12: Automatic Return from Reference Points (G29)................................................................................. 6-26

................................................................... 6-28 Figure 6-13: Automatic Return to Additional Reference Points (G30)................................................. 6-29 Figure 6-14: Difference between G01 Linear Interpolation and G31 Skip Cutting

.............................................................................................................................. 6-31 Figure 6-15: Tool Radius Offset

.............................................................................................................................. 6-32 Figure 6-16: Tool Length Offset............................................................................................................ 6-34 Figure 6-17: Scaling Function, Example #1............................................................................................................ 6-34 Figure 6-18: Scaling Function, Example #2

........................................................................................................................ 6-37 Figure 6-19: Mirror Image Function................................................................................................................................. 6-38 Figure 6-20: G52 Explanation

...................................................................................................................................... 6-38 Figure 6-21: G52 Example......................................................................................... 6-40 Figure 6-22: Workpiece Coordinate Selection Example

................................................................................................ 6-44 Figure 6-23: Coordinate System Rotation Function

................................................................................................ 6-45 Figure 6-24: Coordinate System Rotation Example.................................................................................... 6-47 Figure 6-25: Absolute/Incremental Programming Example

.................................................................................. 6-48 Figure 6-26: Workpiece Coordinate Programming Example............................................................................................................... 9-2 Figure 9-1: Format for a Macro Subroutine

.................................................................... 16-1 Figure 16-1: Part Program That Calls the Macro Program O9006.dat.................................................................................................................. 16-2 Figure 16-2: Macro Program O9006.dat

..................................................................................................................... 16-3 Figure 16-3: Example O1111.dat File

..................................................................................................................... 16-3 Figure 16-4: Example O2222.dat File

..................................................................................................................... 16-3 Figure 16-5: Example O3333.dat File................................................................................................................. 16-4 Figure 16-6: Example ATCTest.dat File

................................... 16-5 Figure 16-7: Example of ATC: Transformation of ATCTest.dat into the tempdata.dat File

_____________________________________________________________________________________ vi

Page 8: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 1: Overview of the SMP Motion Programming Language

Chapter 1: Overview of the SMP Motion Programming Language

1.1 Description of the SMP Motion Programming Language

The SMP motion programming language consists of blocks of code made up of F codes, G codes, M codes, N codes, T codes, etc. The most commonly used code is the G code, which is why this coding system is also sometimes referred to as “G code” or “G-code motion programming.” The G Codes are a wide range of preparatory codes that prepare the machine to treat the information that follows in a distinct manner and to execute it. In essence, G codes determine the mode of the SMP system. G Codes are described in detail in Chapter 6: G Codes (Preparatory Functions). M codes define miscellaneous functions related to machine control. These codes work like on/off switches for the functions they control. The M codes are described in detail in Chapter 7: M Codes (Miscellaneous Codes). T codes define the tool selection command. T codes are described in Chapter 8: Tool Functions and T Codes.

1.2 Components of the SMP Motion Programming Language

The G-code coding system used by SMP products is made up of words. These words are strung together to form blocks of code. A block of code (or “instruction”) is one or more words together that are grouped together on one line. A word is an address followed by numbers. The address defines the meaning of the number that follows the address. In other words, SMP uses the address to determine what the number stands for. A list of addresses recognized by SMP is included in Chapter 2: Address Descriptions. A typical block of code starts with the sequence number of the block, and looks like this:

block of code

N100 G00 X13.0 Z3.0

Figure 1-1: Typical Block of Code

1.3 Numerals in the SMP Motion Programming Language

The numerals that accompany the parameters X and Z for G codes can be floating point values or integer values. Floating point numerals are always absolute values defining the distance or position for that parameter. These values are physical dimensions that you can set to be interpreted as either millimeters or inches, by using the G20/21 inch/metric settings in a motion program. (See Section 6.3.12: Inch / Metric Data Input (G20, G21).) Integer numerals may be interpreted one of two ways, depending on the setting of the “Integer Programming with Machine Unit Enable” parameter specified in the SMP Console or a customized SMP application.

numeral – this is the value that defines the distance or position for the parameter; this value may be a physical dimension (inches or millimeters), or it may be interpreted as a multiple of the “Machine Unit” parameter

address word

_____________________________________________________________________________________ 1-1

Page 9: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 1: Overview of the SMP Motion Programming Language

1) When the “Integer Programming with Machine Unit Enable” parameter is disabled, integer values in the motion program are treated as absolute values defining distance or position – physical values in either mm or inch (depending on G20/21 inch/metric setting in the motion program).

2) When the “Integer Programming with Machine Unit Enable” parameter is enabled, integer values are

treated as the multiple of the “Machine Unit” parameter. The machine unit is the least input increment for the SMP system – the minimum unit of linear movement or distance that the actuator can be commanded to move.

See the Reference Manual for SMP Parameters for more information on the “Integer Programming with Machine Unit Enable” parameter and the “Machine Unit” parameter. The following table summarizes the way numerals in the SMP motion programming language are interpreted:

DATA UNIT WHEN INTEGER PROGRAMMING IS DISABLED

DATA UNIT WHEN INTEGER PROGRAMMING IS ENABLED DATA TYPE

mm or inch machine unit parameter setting Integer

mm or inch mm or inch Floating-Point

Table 1-1: Summary of Numeric Interpretation in the SMP Motion Programming Language

As an example, with Integer Programming with Machine Unit Enable = 0, the “14” in “G00 X14 Y14.5” would be interpreted as 14.0 mm or 14.0 inches, and the “14.5” would be interpreted as 14.5 mm or 14.5 inches. With Integer Programming with Machine Unit Enable = 1, the “14” in “G00 X14 Y14.5” would be interpreted as 14.0 machine units, and the “14.5” would still be interpreted as 14.5 mm or 14.5 inches. If the machine unit is set to 0.001 mm, then “X14” will be converted to 0.014 mm.

It is very important that you be aware of this distinction in how integer numerals can be interpreted, or you could get unintended results.

CAUTION !

1.4 Blocks of Code and Duplicate Parameters

It’s very important for each block to be on a separate line. If you try to put two blocks on the same line, they get combined together. This could have serious consequences: let’s say you wanted to move from Point A to Point B in the first block, and from Point B to Point C in the second block. If you put both blocks on the same line, the parameters from the second block are ignored, and you will get movement from Point A to Point B only – there will be no movement to Point C. Any time a parameter is defined more than once on the same line, the first instance of that parameter is used for the execution of the block. Any other instances of that parameter are ignored. For instance, in the block “N100 G00 X13.0 Z3.0 X2.0 X9.5,” only the X13.0 would be considered. The other two instances of the X parameter (X2.0 and X9.5) would be ignored.

_____________________________________________________________________________________ 1-2

Page 10: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 1: Overview of the SMP Motion Programming Language

If you put two or more blocks on the same line, you are likely to get unintended consequences.

CAUTION ! The maximum length of a block of code is 85 characters per line.

_____________________________________________________________________________________ 1-3

Page 11: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 2: Address Descriptions

Chapter 2: Address Descriptions

The address defines the meaning of the number that follows the address. An address may have more than one meaning. If an address has more than one meaning, the multiple meanings are listed here.

ADDRESS DESCRIPTION

A A axis absolute or incremental coordinate value designation

B B axis absolute or incremental coordinate value designation

C C axis absolute or incremental coordinate value designation

1. D axis absolute or incremental coordinate value designation 2. tool diameter code: D • integer value: interpreted as an index in the tool offset table (example: “G41 D1”)

• floating-point value: interpreted as a nominal tool diameter value (example: “D12.5”)

E E axis absolute or incremental coordinate value designation

1. feedrate [NOTE: feedrate is modal – the feedrate specified with this code is effective until a new value is specified; it doesn’t need to be specified for each block.] F

2. initial feedrate for exponential interpolation (G02.3, G03.3)

preparatory function (see Chapter 6: G Codes (Preparatory Functions)) G

H address of tool length offset value (G41, G42, G43, G44)

1. arc center modifier for the X axis (G02, G03) I 2. helix angle in exponential interpolation (G02.3, G03.3)

3. scaling factor for X axis (G50, G51)

1. arc center modifier for the Y axis (G02, G03) J 2. taper angle in exponential interpolation (G02.3, G03.3)

3. scaling factor for Y axis (G50, G51)

1. arc center modifier for the Z axis (G02, G03) K 2. scaling factor for Z axis (G50, G51)

1. data category (G10) L 2. number of times to repeat macro (G65)

3. 16-bit direct digital output (see Chapter 17: Direct Digital Output)

miscellaneous function (See Chapter 7: M Codes (Miscellaneous Functions)) M

Table 2-1: Summary of Address Descriptions (1 of 2)

_____________________________________________________________________________________ 2-1

Page 12: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 2: Address Descriptions

ADDRESS DESCRIPTION

N block / sequence number

1. subprogram name call 2. dwell time in milliseconds (G04) 3. 3D-DLACC on/off (G05, G08) 4. data index (G10)

P 5. axis number (G10, for L20, L30, L108 or L10909) 6. specifies which additional reference point (G30) 7. scaling factor for all axes (G50, G51) 8. number of workpiece coordinate system to select (G54.1) 9. macro number (G65)

1. the error allowance of the circular motion (G02, G03) Q 2. end point feedrate for exponential interpolation (G02.3, G03.3)

1. subprogram repetition 2. arc radius designation (G02, G03) 3. constant for exponential interpolation (G02.3, G03.3) 4. data value (G10) R 5. smoothing mode (G10, for L106 or L107) 6. smoothing time (G10, for L108) 7. position loop gain value (G10, for L10909) 8. angular displacement in degrees (G68)

tool function (See Chapter 8: Tool Functions and T Codes) T

U U axis absolute or incremental coordinate value designation

V V axis absolute or incremental coordinate value designation

W W axis absolute or incremental coordinate value designation

1. X axis absolute or incremental coordinate value designation (or end point, center point, coordinate component, etc.)

X 2. dwell time in seconds (G04) 3. data value for X axis (G10) 4. X axis tool length compensation (G43, G44)

1. Y axis absolute or incremental coordinate value designation (or end point, center point, coordinate component, etc.) Y 2. data value for Y axis (G10)

3. Y axis tool length compensation (G43, G44)

1. Z axis absolute or incremental coordinate value designation (or end point, center point, coordinate component, etc.) Z 2. data value for Z axis (G10)

3. Z axis tool length compensation (G43, G44)

Table 2-2: Summary of Address Descriptions (2 of 2)

NOTE: D, F, M and T are all independent codes, with no parameters (i.e. “F1500” is a valid, single line of code).

_____________________________________________________________________________________ 2-2

Page 13: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 3: Format for Motion Programs

Chapter 3: Format for Motion Programs

3.1 General Format for Motion Programs

A program is made up of blocks of code. A program typically starts with the program number, followed by blocks of code, and ending with either M02 or M30 (explained in Chapter 7: M Codes (Miscellaneous Codes)). A typical program looks like this:

blocks of code

program end code

%Program Title N100 G00 X13.0 Z3.0 . . . N500 G01 X4.0 Z5.0 M02 %

Figure 3-1: Typical Format for Motion Programs

Either the “%” symbol or a carriage return ( ) is required at the end of all motion program files.

No lower-case letters are recognized except for a subprogram name. If a lower case letter is accidentally included other than for a subprogram name, it will be ignored.

CAUTION !

3.2 Format for Distance and Feedrate

All numbers must include a decimal point unless you intend to specify an integer number. To enter negative numbers, use a minus sign (e.g. X-5.0).

3.3 Block Delete Code

Block delete code can be included in motion programs as an aid to the programmer and to anyone who may want to use or edit the code at some time in the future. Block delete code is specified by placing a “%” at the beginning of a line. Block delete code is not executed – the “%” unconditionally comments out the whole G code line. Block delete code must be on separate lines from blocks of code. A “%” placed anywhere on a line except the beginning of the line will be ignored, and the words following the “%” will be executed, or will cause an error. An example of block delete code follows: % This is a line of block delete code

_____________________________________________________________________________________ 3-1

Page 14: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 3: Format for Motion Programs

3.4 Comment Code

Comment code can also be included in motion programs as an aid to the programmer and to anyone who may want to use or edit the code at some time in the future. Comment code is specified as comment code by placing it in between parentheses “(” and “)” anywhere on a G code line. An example of comment code: N01 G00 X0 Z0 (This is a comment)

3.5 Optional Skip Code

Optional Skip Code refers to code that is skipped (not executed) when the Optional Skip switch in Auto Mode is turned on. You can specify a line of code as Optional Skip Code by placing a “/” (forward slash) at the beginning of the line. The forward slash must be the first character in the line of code; otherwise, you will get a parse error.

3.6 How SMP Handles Unused Data

Unused data is data that is not recognized by SMP as conforming to the SMP Motion Programming Language. Such code will be ignored.

_____________________________________________________________________________________ 3-2

Page 15: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 4: Order of Operations for Motion Programming

Chapter 4: Order of Operations for Motion Programming

The order of operations for motion programming determines the order in which SMP processes a block of code.

DESCRIPTION EXAMPLE

N Numbers (Block Numbers) N1234 1

Comment Statements (this is a comment) 2

Block Delete Codes “%” 3

Subprogram Calls M98 4

Optional Skip Codes “/” 5

G Code Modals G01, G90 6

Auxiliary Codes M08, S1000, T01 7

One-Shot G Codes G04, G53, G92, G54 8

Motion Commands X100.0 Y100.0 F3000 9

Table 4-1: Order of Operations

_____________________________________________________________________________________ 4-1

Page 16: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 5: Subprogram Functions

Chapter 5: Subprogram Functions

5.1 Description of Subprogram Functions

If there are repeated blocks or sequences, then they can be stored as a subprogram. A subprogram can be called from the main program as needed. M98 is used to call the subprogram and M99 is used to return operation from the subprogram back to main program. The subprogram is the same as a normal program, except that the end of subprogram is M99. The name of subprogram itself always begins with “O” as the first character.

5.2 Required Format for Subprogram Functions

M98 P R M99

5.3 Possible Parameters That Can Be Used With Subprogram Functions

P – subprogram name (without the first character “O”) R – number of repetitions (maximum number of repetitions: 999,999)

5.4 Example of Subprogram Functions

% (Main Program) (Subprogram: OMoveXY) G20 (Inch mode) G53 X0 Y0 (Back to machine Zero) G92 X0 Y0 (Reset work coordinate) #101 = 1.0 (Global macro variable for X movement destination) #102 = 2.0 (Global macro variable for Y movement destination) M98 PMoveXY R5 (Movement subprogram call) M02 (Program end) %

Figure 5-1: Main Program (Example)

_____________________________________________________________________________________ 5-1

Page 17: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 5: Subprogram Functions

% OMoveXY G04 (Exact stop) G10 L108 X50 Y50 (Set X and Y axes Acc/Dec time 50 ms) G90 (Absolute positioning) G01 X#101Y#102 F50.0 (Linear move XY) G04 (Exact stop) G10 L108 X1000 Y1000 (Set X and Y axes Acc/Dec time to 1 sec) G00 X0Y0 (Rapid back to program zero) #101 = #101 + 1.0 (Increment X movement destination) #102 = #102 + 2.0 (Increment Y movement destination) M99 (Subprogram return) %

Figure 5-2: OMoveXY.dat (Subprogram Example)

5.5 Variations on Subprogram Functions

The subprograms can also call other subprograms (which can in turn call other subprograms). The nesting depth of subprogram calls is up to eight levels.

5.6 Notes for Subprogram Functions

• When R is omitted, then the subprogram is just called once. • The maximum number of repeated callings is 999,999. • The main program and its associated subprograms should be stored in same file folder. • The subprogram call (M98) cannot be with any motion in the same block. If it is, the motion in that block will

be ignored.

_____________________________________________________________________________________ 5-2

Page 18: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Chapter 6: G Codes (Preparatory Functions)

6.1 Modes and Modal Commands

G codes are categorized into groups. Most groups are modal groups, as explained in the next paragraph. Only Group 00 is nonmodal. A mode is a particular functioning condition. A modal group is a group of two or more related modes. Only one mode in a modal group can be active at a time. The default mode is the mode in a modal group that is automatically activated if no other mode from that modal group is programmed in the code. Modal codes are codes that set a mode. That mode stays in effect until it is cancelled by another code from the same modal group. Many G codes are modal. F codes, which specify feedrate, are also modal. For instance, modal group 01 (selection of a movement system) is made up of four modes: G00 (rapid positioning), G01 (linear interpolation), G02 (clockwise circular interpolation), and G03 (counterclockwise linear interpolation). Only one of these four modes in modal group 01 can be active at one time. G00 is the default mode. Therefore, if the SMP reads the following code: X200. Z150. F200 it will interpret that block of code as applying to rapid positioning mode, because that is the default mode for the selection of a movement system. If your next block of code is: G01 X5.0 Z157 that will change the selection of a movement system to linear interpolation. All position commands will be applied to linear interpolation modes until another mode from modal group 01 is programmed. Nonmodal codes stay in effect only for the blocks that they are programmed. They are one-shot codes. Afterwards, their function is turned off automatically. All G codes in Group 00 are nonmodal. More than one G code may be programmed in a block, such as “G00 G90,” but they must be from different groups. If more than one G code from the same group is programmed in one block of code, the one that is programmed last will be executed, and will cancel out the other G codes from that group. For example, “G01 X10.0 G00 Y20.0” will actually move both X and Y in rapid motion (G00) rather than linear interpolation (G01).

_____________________________________________________________________________________ 6-1

Page 19: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.2 Summary of G Codes

G-CODE GROUP DESCRIPTION

G00 01 rapid positioning (rapid traverse)

G00.1 01 rapid traverse with specified acceleration/deceleration rate

G01 01 linear interpolation

G02 01 circular or helical interpolation (clockwise)

G03 01 circular or helical interpolation (counterclockwise)

G02.3 01 positive exponential interpolation

G03.3 01 negative exponential interpolation

G04 00 dwell

G05 00 dynamic look-ahead contour control on/off

G08 00 dynamic look-ahead contour control on/off

G10 00 programmable data input

G17 02 XY plane selection

G18 02 ZX plane selection

G19 02 YZ plane selection

G20 06 inch data input

G21 06 metric data input

G28 00 automatic zero return to the reference point

G29 00 automatic return from the reference point

G30 00 automatic return to 2nd, 3rd and 4th reference points

G31 00 skip cutting

Table 6-1: Summary of G Codes (1 of 3)

_____________________________________________________________________________________ 6-2

Page 20: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

G-CODE GROUP DESCRIPTION

G40 07 tool radius compensation cancel

G41 07 tool radius compensation right

G42 07 tool radius compensation left

G43 08 positive tool length compensation

G44 08 negative tool length compensation

G49 08 tool length compensation cancel

G50 11 scaling off

G51 11 scaling on

G50.1 22 mirror image off

G51.1 22 mirror image on

G52 00 local coordinate system selection

G53 00 machine coordinate system selection

G54 14 workpiece coordinate 1 selection

G55 14 workpiece coordinate 2 selection

G56 14 workpiece coordinate 3 selection

G57 14 workpiece coordinate 4 selection

G58 14 workpiece coordinate 5 selection

G59 14 workpiece coordinate 6 selection

G61 15 exact stop check mode

G64 15 continuous cutting mode

G64.1 15 continuous cutting mode with block rollover

Table 6-2: Summary of G Codes (2 of 3)

_____________________________________________________________________________________ 6-3

Page 21: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

G-CODE GROUP DESCRIPTION

G65 00 simple macro call

G68 16 coordinate system rotation

G69 16 coordinate system rotation cancel

G90 03 absolute programming

G91 03 incremental programming

G92 00 workpiece coordinate programming

G310 31 linear interpolation feedrate include rotary axes

G311 31 linear interpolation feedrate exclude rotary axes

Table 6-3: Summary of G Codes (3 of 3)

In addition to these preset G codes, you can create customized G codes using custom G code macro calls. See Section 14.6: Custom Macro Calls Using G Codes, M Codes or T Codes for more information.

_____________________________________________________________________________________ 6-4

Page 22: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3 Detailed Explanations of G Codes

Note that the following explanations assume that the tool is moving and that the part is not moving, rather than the other way around.

6.3.1 Rapid Positioning (No Interpolation) (G00)

Description The G00 command is used for rapid positioning of a tool. This command will move a tool to a specified position in the workpiece system. The tool will move along each axis at its rapid traverse rate (see Section 3.2.2: Rapid Feedrate in the Reference Manual for SMP Parameters and Functions) for that axis until it reaches the specified position on that axis. Acceleration and deceleration are based on the “Smoothing Time” parameter (see Section 9.3: Smoothing Parameters in the Reference Manual for SMP Parameters and Functions).

Figure 6-1: Rapid Traverse Z

X

start point

end point

path taken with rapid positioning mode

path taken with linear interpolation mode

Do not use this code for cutting, as the path from point to point is uncertain, and depends upon the rapid traverse rate for the machine tool set by the machine tool builder.

CAUTION !

Required Format G00 X Y Z A B C D E

Parameters Typically Used With G00 X – coordinate value for the X axis Y – coordinate value for the Y axis Z – coordinate value for the Z axis A – coordinate value for the A axis B – coordinate value for the B axis C – coordinate value for the C axis D – coordinate value for the D axis E – coordinate value for the E axis NOTE: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

_____________________________________________________________________________________ 6-5

Page 23: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Example G00 X30.5 Y0.0 Z-5.0

SMP Parameters Which Affect G00 The NC and Machine Parameter “G00 Perform Linear Interpolation” (see Section 3.3.2: G00 Perform Linear Interpolation (Rapid Feed Type) in the Reference Manual for SMP Parameters and Functions) affects how G00 codes are executed. If “G00 Perform Linear Interpolation” is enabled, then G00 will be executed with linear interpolation at the highest possible speed (constrained by the rapid feedrate of each axis). If “G00 Perform Linear Interpolation” is disabled, then G00 will be executed as normal rapid traverse, with no interpolation. The NC and Machine Parameter “Rapid Feedrate” (see Section 3.2.2: Rapid Feedrate in the Reference Manual for SMP Parameters and Functions) affects the speed at which the G00 movement is executed.

Other G-Codes Which Affect G00 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position).

_____________________________________________________________________________________ 6-6

Page 24: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.2 Rapid Traverse with Specified Acceleration/Deceleration Rate (G00.1)

Description The G00.1 command is used for rapid positioning of a tool. Like G00, this command will move a tool to a specified position in the workpiece system. The tool will move along each axis at its rapid traverse rate (see Section 3.2.2: Rapid Feedrate in the Reference Manual for SMP Parameters and Functions) until it reaches the specified position on that axis, with acceleration and deceleration set by the Maximum Acceleration/Deceleration rate parameter (see Section 6.2.1: Maximum Acceleration/Deceleration Rate in the Reference Manual for SMP Parameters and Functions) for that axis (instead of using an acceleration/deceleration rate calculated in accordance with the “Smoothing Time” parameter).

Required Format G00 X Y Z A B C D E

Parameters Typically Used With G00.1 X – coordinate value for the X axis Y – coordinate value for the Y axis Z – coordinate value for the Z axis A – coordinate value for the A axis B – coordinate value for the B axis C – coordinate value for the C axis D – coordinate value for the D axis E – coordinate value for the E axis NOTE: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

Example G00.1 X30.5 Y0.0 Z-5.0

Do not use this code for cutting, as the path from point to point is uncertain, and depends upon the rapid traverse rate for the machine tool set by the machine tool builder.

CAUTION !

SMP Parameters Which Affect G00.1 The NC and Machine Parameter “G00 Perform Linear Interpolation” (see Section 3.3.2: G00 Perform Linear Interpolation (Rapid Feed Type) in the Reference Manual for SMP Parameters and Functions) affects how G00.1 codes are executed. If “G00 Perform Linear Interpolation” is enabled, then G00.1 will be executed with linear interpolation at the highest possible speed (constrained by the rapid feedrate of each axis). If “G00 Perform Linear Interpolation” is disabled, then G00.1 will be executed as normal rapid traverse, with no interpolation. The NC and Machine Parameter “Rapid Feedrate” (see Section 3.2.2: Rapid Feedrate in the Reference Manual for SMP Parameters and Functions) affects the speed at which the G00.1 movement is executed. The 3D-DLACC parameter “Maximum Acceleration/Deceleration Rate” (see Section 6.2.1: Maximum Acceleration/Deceleration Rate in the Reference Manual for SMP Parameters and Functions) determines the maximum acceleration and maximum deceleration rates for G00.1 execution.

_____________________________________________________________________________________ 6-7

Page 25: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Other G-Codes Which Affect G00.1 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position).

6.3.3 Linear Interpolation (G01)

Description The G01 command is used for moving a tool along two or more axes to provide a linear (straight line) path. This command will move a tool to a specified position in the workpiece system. The movement of the multiple axes is at a specified feedrate, which is the feedrate in the direction of movement, not the feedrate of an individual axis. The SMP calculates the linear trajectory, and synchronizes multiple motors to maintain a straight path between two points.

Figure 6-2: Linear Interpolation

Required Format G01 X Y Z A B C D E F

Parameters Typically Used With G01 X – coordinate value for the X axis Y – coordinate value for the Y axis Z – coordinate value for the Z axis A – coordinate value for the A axis B – coordinate value for the B axis C – coordinate value for the C axis D – coordinate value for the D axis E – coordinate value for the E axis

Z

X

start point

end point

path taken with rapid positioning mode

path taken with linear interpolation mode, at the specified feedrate

NOTE: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

F – feedrate (of the movement along the linear tool path) [NOTE: the feedrates for the individual axes are calculated so as to produce the specified feedrate along the linear path.]

Example G01 X30.5 Z-5.0 F10

Other G-Codes Which Affect G01 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position).

_____________________________________________________________________________________ 6-8

Page 26: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.4 Circular Interpolation (G02, G03)

Description The G02 and G03 commands are used for moving a tool along two or more axes to provide a circular path (arc). G02 specifies clockwise circular interpolation, and G03 specifies counterclockwise interpolation. This command will move a tool to a specified position in the workpiece system. The movement of the multiple axes is at a specified feedrate. You must specify either the center of the arc in incremental values relative to the tool start point (with the correct positive or negative sign), OR you must also specify the arc radius.

start point

end point specified by the X, Y and Z parameters

center point

K

Z

X

path taken with counterclockwise circular interpolation

radius I

path taken with clockwise circular interpolation

Figure 6-3: Circular Interpolation

Required Format

G17 X Y F Q G02 R G03 I J

G18 Z X F Q G02 R G03 K I

G19 Y Z F Q G02 R G03 J K

_____________________________________________________________________________________ 6-9

Page 27: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Parameters Typically Used With G02 and G03 for Circular Interpolation X – coordinate value for the X axis NOTEY – coordinate value for the Y axis Z – coordinate value for the Z axis I – arc center modifier for the X axis J – arc center modifier for the Y axis K – arc center modifier for the Z axis R – arc radius designation F – feedrate (of the movement along the circular tool path) [NOTE: the feedrates for the individual axes are calculated so as to produce the specified feedrate along the circular path.] Q – the error allowance of the circular motion, in millimeters or inches. [NOTE: If the feedrate is too fast, and causes the circular motion to exceed the error allowance specified by the “Q” parameter, the feedrate will be clamped.] NOTE: If you specify the R parameter (arc radius designation), then you cannot specify the I, J or K parameters (arc center modifiers), or you will get an error. Similarly, if you specify the I, J and/or K parameters (arc center modifiers), then you cannot specify the R parameter (arc radius designation), or you will get an error.

Examples G18 G02 X30.5 Z-5.0 R10.5 F10 Q0.1 G18 G03 X21.0 Z-7 I17.0 K-3.0 F10 Q0.1

Other G-Codes Which Affect G02 and G03 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position). The G17, G18 and G19 codes specify which plane the movement will occur in (the XY, ZX and YZ planes, respectively). If you specify G17 for XY plane selection, and then you use a G02 or G03 command with X and Z parameters, instead of X and Y parameters, you will get an error.

G02 and G03 in the XY, ZX and YZ Planes

Figure 6-4: G02/G03 in the XY, ZX and YZ Planes

: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

X

Y

Z

X

Y

Z

G03

G02

G03

G02

G03

G02

XY Plane YZ Plane ZX Plane

_____________________________________________________________________________________ 6-10

Page 28: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Limitations

• Circular interpolation can only be performed in a two-axis plane. It is not possible to apply circular interpolation to three or more axes.

• In order to avoid the G code programming error “Invalid center point for circlular interpolation,” the

difference between r1 and r2 (as shown in the following example) has to meet this condition: 2 2r

as demonstrated with the following example:

X10 Y10 G17 G3 Y30 I5 J10 %

Figure 6-5: G02/G03 Limitation

where:

r1 = the distance from the start point to the specified center point r2 = the distance from the end point to the specified center point m1 = the machine unit value of the X axis (specified in the “Axis Ctrl” tab in the Parameters Window

in the SMP Console (see Section 9.2.2 Machine Unit (Minimum Resolution) in the Reference Manual for SMP Parameters and Functions)

m2 = the machine unit value of the Y axis (specified in the “Axis Ctrl” tab in the Parameters Window in the SMP Console (see Section 9.2.2 Machine Unit (Minimum Resolution) in the Reference Manual for SMP Parameters and Functions)

d = the difference between the true center point and the specified center point

1 – r2 < (m1) + (m2)

X

Y

10

10

30

15

20 d

r1

r2

start point

end point

_____________________________________________________________________________________ 6-11

Page 29: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Variations To program a full circle, omit coordinates for the end point (or specify an end point which is the same as the start point), and specify the center points of the circle using the I, J and K arc center modifiers. The end point will then be considered the same as the start point, and a 360° arc (a circle) will be specified. The arc radius may be specified as either positive or negative. A positive arc radius will produce an arc of less than or equal to 180°, while a negative arc radius will produce an arc of equal to or greater than 180°, as shown in the following figure: X

Figure 6-6: Positive and Negative Arc Radii for Circular Interpolation

start point

end point specified by the X, Y and Z parameters

center point

Z

radius

center point

path taken if the arc radius is specified as positive (i.e. R5.0)

radius

path taken if the arc radius is specified as negative (i.e. R−5.0)

If you specify an end point that is the same as the start point, and you specify an arc radius with the R parameter, you will get an error.

CAUTION !

If you specify the arc radius with the R parameter, and the end point is not along the arc specified by that radius, you will get an error. This only occurs when the distance between the end point and the start point is greater than twice the specified radius. In this case, no center point can be calculated from which to base the arc, because no arc with the radius specified could be wide enough to bridge the two points.

CAUTION !

_____________________________________________________________________________________ 6-12

Page 30: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Figure 6-7: Unacceptable Parameters for Circular Interpolation

If you specify the center points of the circle using the I, J and K parameters (arc center modifiers), and the end point specified by the X, Y and Z parameters is not on the arc, an arc movement will still be performed, followed by a linear movement to reach the end point.

Figure 6-8: Arc Movement Produced by Incorrect Parameters for Circular Interpolation

start point

end point specified by the X, Y and Z parameters

Z

radius (specified by the R parameters) X

radius (specified by the R parameters)

start point

end point specified by the X, Y and Z parameters

center point specified by the I, J and K parameters

K

Z

X

linear movement to reach the end point

I

path taken with counterclockwise circular interpolation

_____________________________________________________________________________________ 6-13

Page 31: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.5 Helical Interpolation (G02, G03)

Description The G02 and G03 commands can be used for helical interpolation, as well as for circular interpolation. With helical interpolation, the tool moves in a spiral: circular interpolation of two axes is synchronized with circular interpolation of two other optional axes. You specify a helical interpolation command in the same way as a circular interpolation command, except for two differences: 1) The addition of coordinate values for one or two additional axes. 2) The feedrate that you specify with the F parameter is not the feedrate along the arc of the helical spiral; it is the

tangential feedrate along the projected arc of the circular interpolation path. Therefore, the feedrate along the arc of the helical spiral is as follows:

F x length of the arc along the helical path length of the arc along the tangential path

See Section 6.3.4 Circular Interpolation (G02, G03) for other G codes that affect G02 and G03, and for variations and for warnings.

Z

Y

path taken with circular interpolation in the XZ plane [NOTE: the feedrate specified by the F parameter is along this projected path.]

X

path taken with helical interpolation

Figure 6-9: Helical Interpolation

Required Format

G17 X Y Z/A F G02 R G03 I J

G18 Z X Y/A F G02 R G03 K I

G19 Y Z X/A F G02 R G03 J K

_____________________________________________________________________________________ 6-14

Page 32: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Parameters Typically Used With G02 and G03 for Helical Interpolation X – coordinate value for the X axis NOTEY – coordinate value for the Y axis : these coordinate values could be absolute or

incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect) Z – coordinate value for the Z axis

A – coordinate value for the A axis I – arc center modifier for the X axis J – arc center modifier for the Y axis K – arc center modifier for the Z axis R – arc radius designation F – feedrate (of the movement along the projected circular tool path, not along the helical tool path) [NOTE: the feedrates for the individual axes are calculated so as to produce the specified feedrate along the projected circular path.] NOTE: If you specify the R parameter (arc radius designation), then you cannot specify the I, J or K parameters (arc center modifiers), or you will get an error. Similarly, if you specify the I, J and/or K parameters (arc center modifiers), then you cannot specify the R parameter (arc radius designation), or you will get an error.

Examples G18 G02 X30.5 Z-5.0 R10.5 Y20.0 F10 G19 G03 X21.0 Y-7 J17.0 K-3.0 Z20.0 A4.0 F10

_____________________________________________________________________________________ 6-15

Page 33: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.6 Positive / Negative Exponential Interpolation (G02.3, G03.3)

Description The G02.3 and G03.3 commands are used for exponential interpolation, in which the rotation of a workpiece changes exponentially with respect to movement about the rotary axis (Axis A). G02.3 specifies positive exponential interpolation, and G03.3 specifies negative exponential interpolation. This command incorporates linear interpolation with respect to the linear axis (Axis X) to enable tapered groove machining with a constant helix angle.

Figure 6-10: Exponential Interpolation

A

X

ΔX

ΔA

A

Z

X β1β3 β2

β1 = β2 = β3 = constant helix angle

I

J

Required Format G02.3

Parameters Typically Used With G02.3 and G03.3 X – end point coordinate value for the X axis Y – end point coordinate value for the Y axis Z – end point coordinate value for the Z axis I – taper angle (range: 0 - 89°) J – helix angle (range: 0 - 89°) R – the constant for exponential interpolation (see equations below) F – initial feedrate (includes the feedrate on the rotary axis) Q – end point feedrate (includes the feedrate on the rotary axis) NOTE: The feedrate varies by interpolation between F and Q along the linear axis travel.

NOTE: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

X Y Z I J R F Q G03.3

_____________________________________________________________________________________ 6-16

Page 34: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Equations Related to G02.3 and G03.3

travel along the linear axis: X(θ) = R e – 1

θ K 1

tan(I)

travel along the rotary axis: A(θ) = – 1 360 ω θ 2π

tan(J) where K = tan(I) ω = 0 for positive rotation (G02.3) and ω = 1 for negative rotation (G03.3), and θ is the angle of rotation in radians When the tool moves from X1 to X2 along the linear X axis, the angle moved about the rotation axis is calculated with the following equation:

Δθ = K ℓn + 1 – ℓn + 1 (X2)(tan(I))

R(X1)(tan(I))

RExample G02.3 X30.5 Y2.0 Z-5.0 I10.0 J30.0 R1.0 F20 Q10

Other G-Codes Which Affect G02.3 and G03.3 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position).

6.3.7 Dwell (G04)

Description This command specifies a delay in program execution. Shifting to the next block is delayed for the number of minutes specified by the parameters.

Required Format

P X G04

Possible Parameters That Can Be Used With G04 P – The time specified without a decimal point (in milliseconds). X – The time specified with a decimal point (in seconds).

Examples G04 P5000 (to dwell five seconds) G04 X3.0 (to dwell three seconds)

_____________________________________________________________________________________ 6-17

Page 35: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.8 Three-Dimensional Dynamic Look-Ahead Contour Control On / Off (G05, G08)

Description This three-dimensional dynamic look-ahead contour control (3D-DLACC) function is designed for high-speed, precision machining. The essence of this look-ahead function is to generate the position command output pulse in a more intelligent manner than the conventional method of generating the position command, so that the position command follows the programmed path much more accurately. The problem with the conventional method of generating the position command is that the output pulse generated by the block commands has to go through a smoothing filter to avoid jerky motion. The drawback of the smoothing filter is that the movement of position command is delayed along each axis without coordination. In other words, the integrity of interpolation is broken, and the accuracy of tool-path trajectory is lost. With the look-ahead technology, the SMP controls the acceleration and deceleration of the movement along the commanded trajectory. In other words, the acceleration and deceleration of each axis is coordinated with interpolation. Therefore, the need for a smoothing filter that deteriorates the accuracy of the position command is eliminated, so the final result is an accurately generated position command that faithfully follows the commanded trajectory without jerky motion, and optimized acceleration and deceleration of each axis to achieve the maximum cutting feedrate.

Possible Parameters That Can Be Used With G05, G08 P – Specifies whether to turn 3D-DLACC on or off.

Required Format There are only four possibilities for the effective usage of G05/G08: G05 P10000 to turn ON dynamic look-ahead contour control G05 P0 to turn OFF dynamic look-ahead contour control G08 P1 to turn ON dynamic look-ahead contour control G08 P0 to turn OFF dynamic look-ahead contour control (G05 P10000 is equivalent to G08 P1, and G05 P0 is equivalent to G08 P0)

Example G90G00X0Y0 (X and Y axes return to zero)

G08 P1 (3D-DLACC ON)

G91G01F20000.0 (Incremental linear feed)

X50.0Y100.0

X50.0Y-100.0

X50.0Y100.0

X50.0Y-100.0

G08 P0 (3D-DLACC OFF)

G04 X1.0 (Dwell)

G90G00X0.0Y0.0 (X and Y axes return to zero)

M02 (Program end)

_____________________________________________________________________________________ 6-18

Page 36: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

This program starts the motion from X-Y plane program zero point, turns on DLACC, performs “saw teeth” shape movements, then turns off 3D-DLACC, and finally returns to program zero point after a dwell.

Notes All M/S/T codes are supported, and can be commanded when 3D-DLACC is on. This includes M98/M99 subprogram calls.

Limitations

• Any usage of G05/G08 other than the four possibilities listed in the “Required Format” section will be ignored. • Only the following supported G codes can be commanded when 3D-DLACC is on:

G00 Rapid traverse G01 Linear interpolation G02, G03 CW/CCW circular or helical interpolation G04 Dwell G17-G19 XY/ZX/YZ plane selection G20, G21 Inch/metric data input G28, G29 Automatic return to/from reference point G30 Automatic return to 2nd, 3rd, 4th reference points G50, G51 Scaling off/on G50.1, G51.1 Mirror image off/on G52 Local coordinate system selection G53 Machine coordinate system selection G54-G59 Workpiece coordinate system 1-6 selection G54.1 Additional workpiece coordinate system selection G61 Exact stop check mode G64 Continuous cutting mode G64.1 Continuous cutting mode with block rollover G65 Simple macro call G90 Absolute command programming G91 Incremental command programming G92 Workpiece coordinate programming G310, G311 Linear interpolation feedrate include/exclude rotary axes

NO G CODES OTHER THAN THOSE LISTED ABOVE SHOULD BE COMMANDED WITH 3D-DLACC. If an incompatible G code (a G code not listed above) is used with 3D-DLACC, the motion program will stop at the first instance of an incompatible G code, and you will see an error message.

CAUTION !

Reference It is strongly recommended that you review Chapter 6: Dynamic Look-Ahead Contour Control Parameters and Usage in the Reference Manual for SMP Parameters and Functions for additional information.

_____________________________________________________________________________________ 6-19

Page 37: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.9 Programmable Data Input (G10)

Required Format G10 L__ P__ R__

OR

G10 L__ X__ Y__ Z__ ……

Possible Parameters That Can Be Used With G10 L – specifies the data category P – specifies the data index R – specifies the data value X – specifies the data value for the X axis Y – specifies the data value for the Y axis Z – specifies the data value for the Z axis

Data Input Categories The currently supported data input categories (specified by the L parameter) are listed as follows:

L10 – Tool Length Compensation•

o Description: Specifies the tool length compensation, specifically, the tool length offset Type A.

o Parameters:

P parameter: 1 to 8 (specifies axis number)

R parameter: Z axis tool length compensation

o Reference

It is strongly recommended that you review Section 6.3.16: Positive/Negative Tool Length Compensation/Compensation Cancel (G43, G44, G49) for additional information.

• L11 – Tool Radius Compensation

o Description: Specifies the tool radius compensation, specifically, the tool length offset Type A.

o Parameters:

P parameter: 1 to 8 (specifies axis number)

R parameter: total value for tool radius compensation (including geometry and wear tool offset

values)

o Reference

It is strongly recommended that you review Section 6.3.15: Tool Radius Compensations (G40, G41 and G42) for additional information.

_____________________________________________________________________________________ 6-20

Page 38: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

• L20 – Axis Type Settings

o Description: Specifies the axis type of up to 8 axes; supports both types of G10 formats.

o Parameters:

P parameter: 1 to 8 (specifies axis number)

R parameter: Axis type

Valid Values for R Parameter:

1 Normal

2 Rotary

3 Rotary Single Turn (Rotary ST)

10 PLC Axis

o Examples

G10 L20 P2 R10 // Changes axis 2 (Y) into a PLC axis

G10 L20 X2 Y10 // Changes axis X into a rotary axis and axis Y into a PLC axis

o Reference

It is strongly recommended that you review Section 2.2.2: Axis Type in the Reference Manual for SMP Parameters and Functions for additional information.

• L30 – In Position Width

o Description: Specifies the in position width of a particular axis; supports both types of G10 formats.

o Parameters:

P parameter: 1 to 8 (specifies axis number)

R parameter: In position width

o Examples

G10 L30 P2 R0.1 // Changes the in position width of axis 2 (Y) to 0.1

G10 L30 X0.2 Y0.1 // Changes the in position width of axis X to 0.2 and the in position width

of axis Y to 0.1

o Reference

It is strongly recommended that you review Section 10.6: In Position Width in the Reference Manual for SMP Parameters and Functions for additional information.

_____________________________________________________________________________________ 6-21

Page 39: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

• L106 – Smoothing (Acc/Dec) Mode Settings For Rapid Motion (G00)

o Description: Specifies the smoothing (acceleration/deceleration) mode setting of all axes in rapid

motion (G00)

o Parameters:

P parameter: Unused

R parameter: Smoothing (acceleration/deceleration) mode

Valid Values for R Parameter:

NO_SMOOTHING 0 // No velocity smoothing

SMOOTH_LINEAR 1 // Trapezoidal velocity profile

SMOOTH_BELLSHAPE 2 // Bell-Shaped velocity profile

SMOOTH_EXPONENTIAL 3 // Exponential velocity profile

o Reference

It is invalid to set smoothing mode before acceleration/deceleration motion has finished. We recommend using G04 exact stop before every G10 L106 command.

CAUTION !

It is strongly recommended that you review Section 9.2.3: Smoothing Time (Regular Smoothing Time) and Section 9.2.4: Examples of Smoothing Time for the Three Types of Acceleration/Deceleration Filters in the Reference Manual for SMP Parameters and Functions for additional information.

• L107 – Smoothing (Acc/Dec) Mode Settings For Cutting Motion (G01) )

o Description: Specifies the smoothing (acceleration/deceleration) mode setting of all axes in cutting

motion (G01)

o Parameters:

P parameter: Unused

R parameter: Smoothing (acceleration/deceleration) mode

Valid Values for R Parameter:

NO_SMOOTHING 0 // No velocity smoothing

SMOOTH_LINEAR 1 // Trapezoidal velocity profile

SMOOTH_BELLSHAPE 2 // Bell-Shaped velocity profile

SMOOTH_EXPONENTIAL 3 // Exponential velocity profile

It is invalid to set smoothing mode before acceleration/deceleration motion has finished. We recommend using G04 exact stop before every G10 L107 command.

CAUTION !

o Reference

It is strongly recommended that you review Section 9.2.3: Smoothing Time (Regular Smoothing Time) and Section 9.2.4: Examples of Smoothing Time for the Three Types of Acceleration/Deceleration Filters in the Reference Manual for SMP Parameters and Functions for additional information.

_____________________________________________________________________________________ 6-22

Page 40: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

• L108 – Smoothing (Acc/Dec) Time Settings

o Description: Specifies the smoothing (acceleration/deceleration) time setting for each axis; supports

both types of G10 formats.

o Unit: milliseconds

o Parameters:

P parameter: Axis number (Range: 1 ~ 16)

R parameter: Smoothing (acceleration/deceleration) time value.

Valid Values for R Parameter: vary depending on servo loop update rate, as follows:

1 KHz or lower: 0 ~ 5000 (ms)

2 KHz: 0 ~ 2500 (ms)

4 KHz: 0 ~ 1250 (ms)

o Examples:

G04 (Exact stop)

G10 L108 X50 Y50 (Sets X and Y axes smoothing time to 50 ms)

G10 L108 P1 R1000 (Sets axis X smoothing time to 1000 ms)

It is invalid to set smoothing time before acceleration/deceleration motion has finished. We recommend using G04 exact stop before every G10 L108 command.

CAUTION !

• L10909 – Position Loop Gain Settings

o Description: Specifies the position loop gain setting of each axis; supports both types of G10 formats.

o Unit: Hz

o Parameters:

P parameter: Axis number (Range: 1 ~ 16)

R parameter: Position loop gain value (Range: 0 ~ 999999.9 Hz)

o Notes: Position loop gain can be set at any time in the program.

o Examples:

G10 L10909 X10 Y5 (Sets X axis position loop gain to 10 Hz, and Y axis to 5 Hz)

G10 L10909 P1 R15 (Sets X axis position loop gain to 15 Hz)

A high position loop gain value could lead to system vibration and instability, which might cause damage to the machine. Please be very careful in setting values. Refer to Section 10.2: Position Loop Gain in the Reference Manual for SMP Parameters and Functions.

!

_____________________________________________________________________________________ 6-23

Page 41: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Torque Control with G10 (MECHATROLINK II/III only) G10 can also be used for torque control of any Sigma III or Sigma V servo axis in a MECHATROLINK II/III servo network. Torque control allows the user to send torque commands to set the torque of individual axes to a percentage of the axes’ rated torque. To start torque control, use G10 to set the axis type of an axis to a special “torque axis.” Subsequent G01 commands to that axis will be interpreted as torque commands. Example: N10 G00 X10.0 Y10.0 Z10.0 N20 G10 L20 P3 R12 N30 G01 X50.0 Y100.0 Z20.0 F3000.0 N40 Z0.0 N50 G10 L20 P1 R12 N60 X50.0 N70 G04 X3.0 N80 G10 L20 P1 R1 N90 G10 L20 P3 R1 N100 X200.0 Y200.0 Z200.0 N20: Change Z axis to torque axis. N30: Position command sent to X and Y; torque command sent to Z. The F parameter only applies to X and Y. The Z axis will output 20% of its rated torque until X and Y reach their target positions. N40: Set Z axis torque to 0. N50: Change X axis to torque axis. N60, N70: Set X axis to apply 50% torque for 3 seconds. N80: Revert X axis to normal axis. N90: Revert Y axis to normal axis. N100: Move X, Y, and Z to their commanded positions. Notes: -This feature is currently only available for Sigma III and Sigma V servo drives running on the MECHATROLINK II/III platform. - If the block before G10 (change to torque axis) does not perform an in-position check, the axis is switched to a torque axis at the point when the block before G10 starts decelerating. This means that a torque command will be applied before the block before G10 reaches its target position. If you need torque to be applied after reaching the target position, use in-position check, Dwell, etc. - Torque commands have units of %. This value is a percentage of the rated torque that you want the servo drive to apply. -If you are using Sigma-V, the rated torque is automatically obtained without any user input, but if you are using Sigma-III, the rated torque must be manually entered into the .ini file by the user. For Sigma-III drives (drives set to ServoVer=3 in the .ini file), add the following to the description of the drives in the .ini file: TorqueSpecMax=x, where x is the rated torque of your servo packs.

_____________________________________________________________________________________ 6-24

Page 42: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.10 XY/ZX/YZ Plane Selection (G17, G18 and G19)

Description The G17, G18 and G19 commands are used to select the plane in which specified movement is to occur. G17: Selects the XY plane G18: Selects the ZX plane G19: Selects the YZ plane

Possible Parameters That Can Be Used With G17, G18 and G19 None.

Example G17 G02 X5.2 Y-7.0 R3.3 F500

Notes In a system with more than four axes, the “X” refers to an X axis or some other axis parallel to the X axis. Similarly, “Y” and “Z” refer to either the Y and Z axes, or axes parallel to the Y and Z axes.

Other G-Codes Which Affect G17, G18 and G19 The G17, G18 and G19 commands are used in conjunction with G02 and G03, and G02.3 and G03.3.

Default G17 is the default mode when none of the G17, G18 or G19 codes has been programmed.

6.3.11 Inch / Metric Data Input (G20, G21)

Description The G20 and G21 commands are used to specify which measurement system you will use to specify coordinates, distances, radii, etc. G20: Input distances will be in inches G21: Input distances will be in millimeters The G20 and G21 commands are typically used at the beginning of a program. All subsequent commands including parameters specifying distance are affected by the G20 and G21 commands.

Possible Parameters That Can Be Used With G20 and G21 None.

Limitations The G20 and G21 commands only apply to linear axes – axes whose movement is linear, and for which distance is specified in inches or millimeters. The selection of an inch or a metric measurement system has no effect on rotation axes, whose values are specified in degrees.

Default G21 is the default mode when neither G20 nor G21 has been programmed.

_____________________________________________________________________________________ 6-25

Page 43: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.12 Automatic Zero Return to/from Reference Points (G28, G29)

Description The G28 and G29 commands are used to return to and to return from the reference point. The reference points are set in the SMP Console or a customized SMP application. G28: Return to the reference position G29: Return from the reference position The G28 command is used to return the tool from the start point (the current tool position) to the reference point, via an intermediate point, the coordinates of which are specified by the parameters. The G29 command is used to return the tool from the reference point (the current tool position) to a destination point specified by the parameters, via an intermediate point specified by the G28 command.

Figure 6-11: Automatic Return to Reference Points (G28)

reference point

Z

X

start point

path commanded by G28

intermediate point (specified by the parameters used with the G28 command)

reference point

Z

X

destination point (specified by the parameters used with the G29 command)

path commanded by G29 intermediate point

(specified by the parameters used with the G28 command)

Figure 6-12: Automatic Return from Reference Points (G29)

Required Format X Y Z A B C D E G28 G29

Possible Parameters That Can Be Used With G28 and G29 X – coordinate value for the X axis Y – coordinate value for the Y axis

_____________________________________________________________________________________ 6-26

Page 44: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Z – coordinate value for the Z axis A – coordinate value for the A axis B – coordinate value for the B axis C – coordinate value for the C axis D – coordinate value for the D axis E – coordinate value for the E axis NOTE: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

Example G28 X0.5 Z7.8 G29 X7.5 Z2.1

Other G-Codes Which Affect G28 and G29 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position).

_____________________________________________________________________________________ 6-27

Page 45: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.13 Automatic Zero Return To Additional Reference Points (G30)

Description The G30 command is used to return the tool from the start point (the current tool position) to an additional, specified reference point, via an intermediate point, the coordinates of which are specified by the parameters. The additional reference points are set in the SMP Console or a customized SMP application (see Section 7.11: Reference Position #2, Section 7.12: Reference Position #3 and Section 7.13: Reference Position #4 in the Reference Manual for SMP Parameters and Functions for additional information). additional

reference point

Z

X

start point

path commanded by G30 intermediate point

(specified by the parameters used with the G30 command)

Figure 6-13: Automatic Return to Additional Reference Points (G30)

Required Format G30 X Y Z A B C D E P

Possible Parameters That Can Be Used With G30 X – coordinate value for the X axis Y – coordinate value for the Y axis Z – coordinate value for the Z axis A – coordinate value for the A axis B – coordinate value for the B axis C – coordinate value for the C axis D – coordinate value for the D axis E – coordinate value for the E axis P – specifies which additional reference point (P2, P3, etc.) – if not specified, P2 is the default NOTE: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

Example G30 P3 X0.5 Z7.8 G29 X7.5 Z2.1

Other G-Codes Which Affect G30 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position).

_____________________________________________________________________________________ 6-28

Page 46: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.14 Skip Cutting (G31)

Description This one-shot command for linear interpolation allows you to specify commands in a motion program that should be cancelled (not completed) if the G6.6 PLC Skip Signal switch changes (either rising or falling edge) while this command is being executed. Once the G6.6 PLC Skip Signal switch changes, command execution terminates and the next block of the motion program starts to be executed. Like the G01 command, the G31 command is used for moving a tool along two or more axes to provide a linear (straight line) path. This command will move a tool to a specified position in the workpiece system (as long as the G6.6 PLC Skip Signal switch doesn’t change). The movement of the multiple axes is at a specified feedrate, which is the feedrate in the direction of movement, not the feedrate of an individual axis. The SMP calculates the linear trajectory, and synchronizes multiple motors to maintain a straight path between two points.

Required Format G31 X Y Z A B C D E F

Parameters Typically Used With G31 X – coordinate value for the X axis Y – coordinate value for the Y axis Z – coordinate value for the Z axis A – coordinate value for the A axis B – coordinate value for the B axis C – coordinate value for the C axis D – coordinate value for the D axis

NOTE: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

E – coordinate value for the E axis F – feedrate (of the movement along the linear tool path) [NOTE: the feedrates for the individual axes are calculated so as to produce the specified feedrate along the linear path.]

Example

20.0

Blocks of Code with G01: N10 G91 G01 X20.0 Z10.0; N11 Z10.0;

end point

Z

X

start point

tool movement

20.0 10.0

20.0

Blocks of Code with G31: N10 G91 G31 X20.0 Z10.0; N11 Z10.0;

end point

Z

X

start point

tool movement with G31 and the G6.6 PLC signal changing during G31 execution

20.0 10.0

tool movement with G01 or with G31 and the G6.6 PLC signal remaining the same

the G6.6 PLC signal changes

Figure 6-14: Difference between G01 Linear Interpolation and G31 Skip Cutting

_____________________________________________________________________________________ 6-29

Page 47: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Limitations G31 is valid for one block only.

Other G-Codes Which Affect G31 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position).

_____________________________________________________________________________________ 6-30

Page 48: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.15 Tool Radius Compensations (TRC) (G40, G41 and G42)

Description G40: Tool radius compensation (TRC) cancel G41: Tool radius compensation (TRC) right G42: Tool radius compensation (TRC) left TRC enables the contour of the part to be programmed directly without taking the dimensions of the tool into account.

WORKPIECE

Center path of tool Programmed Path

Tool Tool radius NOTE: Tool diameter is input in Settings Mode for the tool offset, but tool radius is used for calculating the tool center path

Figure 6-15: Tool Radius Offset

Possible Parameters That Can Be Used With G40 – G42 None.

Other Codes Which Affect G41 and G42 A D code specifies a tool offset (i.e. “D1”). [See page 2-1 for more information on D codes.]

Limitations

• Look-ahead buffer: 100 blocks • Only motion (G00, G01, G02, G03) and non-motion (G04, M, S, B, and F codes) are eligible in TRC mode • The 1st and the last motions of TRC mode cannot be G02 or G03 • Scaling (G51), and mirror image (G51.1) must not be used when tool radius compensation is on

Default G40 is the default mode when none of the G40, G41 or G42 codes has been programmed.

Reference See Section 2.6.2: Tool Radius Compensation in the Reference Manual for SMP Parameters and Functions.

_____________________________________________________________________________________ 6-31

Page 49: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.16 Positive/Negative Tool Length Compensation/ Compensation Cancel (G43, G44, G49)

Description Tool length compensation accounts for the difference between the actual tool position and the theoretical tool position. When T codes are executed in a motion program, the program position is actually shifted to account for tool offset (as opposed to compensating each actual movement command to account for tool offset). G43: Positive tool length compensation G44: Negative tool length compensation G49: Tool length compensation cancel

Tool length offset

ACTUAL TOOL IDEAL TOOL ASSUMED FOR PROGRAMMING

Figure 6-16: Tool Length Offset

With G43, the tool length offset value is ADDED to the coordinates of the end position specified by the program (regardless of whether the absolute command [G90] or the incremental command [G91] is in effect). If the tool length offset value is a negative number, adding this negative number causes the tool to move in the negative direction. With G44, the tool length offset value is SUBTRACTED to the coordinates of the end position specified by the program (regardless of whether the absolute command [G90] or the incremental command [G91] is in effect). If the tool length offset value is a negative number, subtracting this negative number causes the tool to move in the positive direction. There are three methods of setting tool length offsets:

1) Tool Length Offset Type A (for tool length compensations in the Z-axis direction) 2) Tool Length Offset Type B (for tool length compensations in the X-, Y- or Z-axis directions) 3) Tool Length Offset Type C (for tool length compensations along any specified axis)

_____________________________________________________________________________________ 6-32

Page 50: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Required Format Z H G43

G44 Tool Length Offset Type A:

G17 Z H G43 G44

G18 Y H G43 G44

G19 X H G43 G44

Tool Length Offset Type B:

α H G43 G44

Tool Length Offset Type C:

Possible Parameters That Can Be Used With G43, G44 X – indicates X axis tool length compensation Y – indicates Y axis tool length compensation Z – indicates Z axis tool length compensation α – indicates the axis for tool length compensation (X, Y, Z, etc.) H – address of the tool length offset value. (For example, H1 is the address for the tool length offset value of Tool

#1.)

Example G43 Z50.5 H3 (If H3 corresponds to the tool length offset value of 10.0 for tool #3, then the tool will move to 50.5

+ 10.0 = 60.5)

Variations To program tool length offsets along two or more axes, use a separate block of code for each axis: G18 G43 Y H1 G19 G43 X H5

Notes Tool length offset cancel can be programmed in one of two ways:

1) Programming a G49 block of code. (This cancels offsets along all axes.) 2) Programming a G43/G44 block of code with H0. (This cancels offsets along only the specified axis,

perpendicular to the specified plane.)

Default None.

For Tool Offset Type C, you must use BOTH G49 and H0 to cancel the offset, or you will generate an alarm.

CAUTION !

_____________________________________________________________________________________ 6-33

Page 51: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.17 Scaling Off / On (G50, G51)

Description The scaling function allows you to scale commands (and therefore parts) larger or smaller, for either all axes together, or for individual axes. G50: Scaling off G51: Scaling on

start point and center point of scaling

Z

X

end point with scaling

tool movement without scaling

tool movement with scaling (magnification factor = 2.0 for all axes)

1

3

5

4 2 NOTE: X indicates order of tool movement

Figure 6-17: Scaling Function, Example #1

Z

X

end point with scaling

tool movement without scaling

tool movement with scaling (magnification factor = 2.0 for all axes)

center point of scaling

start point end point

without scaling

1

3

5

4 2

Figure 6-18: Scaling Function, Example #2

_____________________________________________________________________________________ 6-34

Page 52: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Required Format G51 X Y Z P; .

Scaling mode is in effect

.

.

. G50; G51 X Y Z I J K; .

Scaling mode is in effect

.

.

. G50;

Possible Parameters That Can Be Used With G50, G51 X – absolute coordinate value for the X axis center point of scaling Y – absolute coordinate value for the Y axis center point of scaling Z – absolute coordinate value for the Z axis center point of scaling P – specifies the magnification of scaling (0.001 – 999.999) for all axes I – specifies the magnification of scaling (0.001 – 999.999) for the X axis J – specifies the magnification of scaling (0.001 – 999.999) for the Y axis K – specifies the magnification of scaling (0.001 – 999.999) for the Z axis NOTE: If you specify the P parameter (overall magnification factor), then you cannot specify the I, J or K parameters (individual axis magnification factor), or you will get an error. Similarly, if you specify the I, J and/or K parameters (individual axis magnification factor), then you cannot specify the P parameter (overall magnification factor), or you will get an error.

Examples G51 X10.0 Y10.0 Z10.0 P2.0 G50; G51 X10.0 Y10.0 Z10.0 I2.0 J2.0 K1.0 G50;

Limitations Tool radius compensation (G41, G42) and mirror image (G51.1) must not be used when scaling is on.

Notes

• If I, J and/or K parameters are included in a command, but not all three of the I, J and K parameters are included, then the magnification factor which has not been specified remains at its previous setting from the last time G51 was executed. For instance, if I and J are specified, but K is not, K is assumed to remain at its previous setting.

• If none of the P, I, J and K parameters are specified, an error will be issued. • If X, Y and Z parameters are omitted from the command, the current position where G51 is commanded

becomes the center for scaling subsequent commands.

Default G50 is the default mode when neither G50 nor G51 has been programmed.

_____________________________________________________________________________________ 6-35

Page 53: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.18 Mirror Image Off / On (G50.1, G51.1)

Description With the mirror image function, you can command the execution of the mirror image of a set of commands for one or more axes. This is particularly helpful if you have a part that is symmetrical in one or more directions; you would only need to program part of the whole part in a subprogram, and then call the subprogram one or more times with the mirror image function on. G50.1: Mirror image off G51.1: Mirror image on

Required Format G51.1 X Y Z; . . . . G50.1 X Y Z;

Mirror image mode is in effect

NOTE: With G50.1, mirror image is cancelled only for the axes included as parameters.

Possible Parameters That Can Be Used With G50.1, G51.1 NOTEX –coordinate value for the X axis center point of the mirror image

Y –coordinate value for the Y axis center point of the mirror image Z –coordinate value for the Z axis center point of the mirror image

Example The following example demonstrates the usefulness of the mirror image function by using a subprogram for a piece of the part, and then calling that subprogram in the main program with two different axes to mirror the part about. Main Program: Subprogram O100.dat: N0010 G00 G90; G00 G90 X50.0 Z30.0; N0020 M98 P100; G01 X70.0; N0030 G51.1 X40.0; G01 Z20.0; N0040 M98 P100; G01 X60.0; N0050 G51.1 Z40.0; G01 Z10.0; N0060 M98 P100; G01 X50.0; N0070 G50.1 X0; G01 Z30.0; N0080 M98 P100; M99; N0090 G50.1 Z0; % %

: these coordinate values could be absolute or incremental, relative to the part origin or to the current tool position, depending upon whether G90 or G91 is in effect)

_____________________________________________________________________________________ 6-36

Page 54: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Z

X

mirror image axis of symmetry

start point

end point

1

13

5

4

2

20.0

50.0 10.0 70.0 20.0 80.0 30.0 60.0 40.0

30.0

0.0

50.0

10.0

70.0

80.0

60.0

40.0

0.0

6

9

11

7

8

14

12

10

15

27

21

26

25 24

23

16

22

19

18 17

20

3

NOTE: X indicates order of tool movement

Figure 6-19: Mirror Image Function

Limitations Tool radius compensation (G41, G42) and scaling (G51) must not be used when mirror image is on.

Notes If the G51.1 command is specified with only one parameter (one axis), then the rotation direction is reversed for arc commands.

Other G-Codes Which Affect G50.1, G51.1 The G90 and G91 codes specifying absolute and incremental programming, respectively, affect whether the coordinates you specify will be treated as absolute coordinates (relative to the part origin) or incremental coordinates (relative to the current tool position).

Default G50.1 is the default mode when neither G50.1 nor G51.1 has been programmed.

_____________________________________________________________________________________ 6-37

Page 55: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.19 Local Coordinate System Selection (G52)

Description This command establishes a local coordinate system for the current workpiece coordinate system, within that workpiece coordinate system. The coordinates set by the parameters become the new zero position for the current workpiece coordinate system.

Required Format G52 X Y Z

Possible Parameters That Can Be Used With G52 X – X Coordinate Component (incremental value, diameter or radius programming) Y – Y Coordinate Component (incremental value) Z – Z Coordinate Component (incremental value)

Figure 6-20: G52 Explanation

Example G52 X5.6 Z8.6

Z

X

Figure 6-21: G52 Example Machine Origin (0.0000, 0.0000)

Workpiece Coordinate System #1 (set with G54)

Local Coordinate System (set with G52) 8.6

5.6

_____________________________________________________________________________________ 6-38

Page 56: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Limitations

• G52 will only shift the current workpiece coordinate system (not all coordinate systems). • You can set different local coordinate systems for each workpiece coordinate system.

Variations

• G10 L2 P0 could be used to change the External Workpiece Zero Point Offset Value (to shift all coordinate systems).

• G10 L2 P1 ~ P6 could be used to change the corresponding Workpiece Zero Point Offset Value.

Notes To cancel the local coordinate system, and return to the workpiece coordinate system, you must use the G52 command with each parameter set to zero. In other words, if you set up your local coordinate system using “G52 X5.6 Z8.6,” you must use the block “G52 X0 Z0” to cancel the local coordinate system.

This command only works with absolute coordinates. You must not try to specify incremental coordinates, or this G52 code will be ignored.

CAUTION !

6.3.20 Machine Coordinate System Selection (G53)

Description When this command is executed, the coordinate system is set to the machine coordinate system for this one block of code only, and the tool is moved to these coordinates (relative to the machine origin) by rapid positioning. Each consecutive block of code will be relative to the coordinate system that was in effect prior to this block of code.

Required Format G53 X Y Z A B C D E

Possible Parameters That Can Be Used With G53 X – coordinate value for the X axis Y – coordinate value for the Y axis Z – coordinate value for the Z axis A – coordinate value for the A axis B – coordinate value for the B axis C – coordinate value for the C axis D – coordinate value for the D axis E – coordinate value for the E axis

Example G53 X0.0 Y0.0 Z0.0 A0.0 (which will move the tool back to the machine origin)

_____________________________________________________________________________________ 6-39

Page 57: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.21 Workpiece Coordinate Selection (G54-G59)

Description These codes are used to select different coordinate systems that correspond to different workpieces. Up to six coordinate systems can be selected using G54-G59: G54 Workpiece Coordinate System #1 G55 Workpiece Coordinate System #2 G56 Workpiece Coordinate System #3 G57 Workpiece Coordinate System #4 G58 Workpiece Coordinate System #5 G59 Workpiece Coordinate System #6 By setting the coordinate system in such a way that the zero point is set to a fixed piece on the workpiece, you make programming that workpiece very simple. You can use the same blocks of G code to cut six different workpieces, simply by moving the reference point.

Possible Parameters That Can Be Used With G54 – G59 None. The coordinates of the workpiece coordinate systems are established within the SMP Console, or within a customized SMP application.

Example

Z

X

Machine Origin (0.0000, 0.0000)

Workpiece Coordinate System #1

Workpiece Coordinate System #4

Workpiece Coordinate System #5

Workpiece Coordinate System #6

Workpiece Coordinate System #2

Workpiece Coordinate System #3

G54

G58

G56 G55

G57 G59

Figure 6-22: Workpiece Coordinate Selection Example

Notes The G54 – G59 codes are used to select (not set up) different coordinate systems. These six coordinate systems need to be set up in advance of using these codes to select the coordinate systems.

_____________________________________________________________________________________ 6-40

Page 58: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Reference You can set up the workpiece coordinate systems in the SMP Console or in a customized SMP application. See the SMP Console Operator’s Manual.

If you should call a G54, G55, G56, G57, G58 or G59 code with any parameters, they will be ignored.

CAUTION !

You should check the workpiece coordinate system setup on your machine tool prior to running a part program that uses the G54 – G59 codes.

CAUTION !

G54 – G59 blocks of code should appear on separate lines, with no parameters.

CAUTION !

6.3.22 Exact Stop Check Mode, Continuous Cutting Mode and Continuous Cutting Mode With Block Rollover (G61, G64, G64.1)

Description In Exact Stop Check Mode, all move commands (such as G00, G01, G02 and G03) are executed with the tool decelerating at the end point, and with an in-position check after each move command. The next block is not executed until the in-position check is performed. Continuous Cutting Mode is used mainly to cancel G61, Exact Stop Check Mode. In Continuous Cutting Mode, no in-position check is made at the end of each block. Instead, program execution continues automatically with the next block. In Continuous Cutting Mode With Block Rollover, no tool deceleration occurs and no in-position check is made at the end of each block. Instead, program execution continues automatically with the next block (similar to G64/ Continuous Cutting Mode). Continuous Cutting Mode With Block Rollover uses “block rollover” technology to provide more accurate feedrate control and smoother motion, especially for high-speed, small segment contour control. G61: Exact Stop Check Mode G64: Continuous Cutting Mode G64.1: Continuous Cutting Mode With Block Rollover

_____________________________________________________________________________________ 6-41

Page 59: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Detailed Description of the Block Rollover Function (G64.1) When a single block of code cannot be completed in one servo loop/cycle time (as determined by the interpolation rate of the servo interface system), the remainder of that block of code is completed in subsequent servo loop(s). When the last servo loop for a single block of code only needs to move a small portion of the distance moved in the previous servo loop(s), but in the same cycle time, the velocity is adjusted to slow axis movement for this lesser distance in the same time frame. The block rollover function prevents this change in velocity by moving the remainder of one block to the next block and recalculating the interpolation for the next block. For example, suppose you have a part program consisting of a series of 0.25 mm segments, and you run the machine at 6000 mm/min. 6000 mm/min is the equivalent of 0.1 mm/ms. Let’s assume the servo interface platform has an interpolation rate of 1 ms, so the SMP Engine interpolates the trajectory every 1 ms, meaning that our SMP moves the axes 0.1 mm every interpolation cycle. If the SMP happens to execute a block of 0.25 mm, it takes three interpolation cycles (= 3 ms) to execute the block. But, as you can see, the motion behaves like this: in the first millisecond, it moves 0.1 mm; in the second millisecond, it also moves 0.1 mm; and in the third millisecond (the third cycle) it moves 0.05 mm. As a result, the velocity is not very smooth, but the trajectory can be kept accurate. If the smoothing time (Ts) is big, then the irregular velocities (0.1 mm/ms, 0.1 mm/ms and 0.05 mm/ms) will be smoothed out, but at the cost of losing the trajectory accuracy. But, if you reduce Ts for more accuracy, then the SMP Engine strictly follows this unsmooth velocity (0.1 mm/ms, 0.1 mm/ms and 0.05 mm/ms), causing an unsmooth, "jerky" motion. Obviously, if the velocity commands are so unsmooth, the servos cannot catch up with these frequent changes of the velocity commands, resulting in huge servo errors, causing a huge trajectory error, which is obviously undesirable. For milling, this would create bad traces on the milling surface. In the above case, with block rollover, the SMP Engine moves 0.1 mm only for two cycles, and adds the remainder of 0.05 mm to the next block (let's assume it is 0.25 mm), making a 0.3 mm segment. In this way, the SMP Engine can follow the trajectory more accurately while making the velocity very smooth.

Possible Parameters That Can Be Used With G61, G64, G64.1 None.

Example G61 G01 X9.3 Z2.7 F500

Notes Use Exact Stop Check Mode when sharp edges are required for the corners of a workpiece. Use Continuous Cutting Mode or Continuous Cutting Mode With Block Rollover at all other times.

Default G64 is the default mode when none of the G61, G64 or G64.1 codes has been programmed.

_____________________________________________________________________________________ 6-42

Page 60: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.23 Simple Macro Call (G65)

Description Using customized macros is very similar to calling a subprogram from a main motion program, except with the added advantage that you can use variables in macros. This means that macros are more reusable than subprograms. For instance, you can have one macro for a bolt hole, and just change the variables (arguments) you assign when you call the macro (with customized macro instructions). If you were using a subprogram for programming a bolt hole, you would need a different subprogram for each size bolt hole. The format of a macro is the same format as a subprogram:

0 Macro number; · · · · · M99; %

body of macro

A simple macro call is a one-shot command in which a macro is called once using G65 (although it may be executed more than once, depending upon the L parameter, the number of times the macro is to be repeated).

Required Format G65 P L <argument assignment>

Possible Parameters That Can Be Used With G65 P – macro number L – number of times to repeat the execution of the macro (1 by default) In addition to these two parameters, macros are called with argument assignments, which are not considered to be parameters.

Example G65 P100 Z20.0 R2.5 F500

Limitations

• G65 must be specified before any argument. • The macro program (the subroutine) must be in the same file as the part program file that calls the macro

program.

Reference See the Chapter 14: Calling Macro Programs for additional information.

_____________________________________________________________________________________ 6-43

Page 61: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.24 Coordinate System Rotation/Coordinate System Rotation Cancel (G68, G69)

Description The coordinate system rotation command allows you to rotate a programmed shape in two dimensions. This is particularly helpful if you have a workpiece that has been rotated at some angle from the programmed position on the machine; it allows you to modify a part program using a rotation command, rather than rewrite a part program. This coordinate system rotation command is also helpful when creating identical shapes that are rotated from a center. G68: Coordinate system rotation G69: Coordinate system rotation cancel

Figure 6-23: Coordinate System Rotation Function

Required Format

Possible Parameters That Can Be Used With G68, G69 X – absolute coordinate value for the X axis center point of rotation for values specified subsequent to G68 Y – absolute coordinate value for the Y axis center point of rotation for values specified subsequent to G68 Z – absolute coordinate value for the Z axis center point of rotation for values specified subsequent to G68 R – specifies the angular displacement in degrees [NOTE: a positive value denotes counterclockwise rotation; a

negative value denotes clockwise rotation.]

Z

X

center point of rotation

rotation angle

G17 X Y G18 Z X G19 Y Z G68 R; . . . . G69;

Coordinate system rotation mode is in effect [NOTE: G17, G18 and G19 must NOT be designated again]

_____________________________________________________________________________________ 6-44

Page 62: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Example The following example demonstrates the usefulness of the coordinate system rotation function by using a subprogram for a piece of the part, and then calling that subprogram in the main program at several different angles. Main Program: Subprogram O100.dat: % %O100 G53 G18 G00 X0. Y0. G00 G90 X0. Y0. G00 G91 X10. Y40. M98 P100 Y70. G68 X0. Y0. R45 X-20. M98 P100 Y-70. G68 X0. Y0. R90 X20. M98 P100 G90 G68 X0. Y0. R135 G69 M98 P100 M99 G68 X0. Y0. R180 % M98 P100 G68 X0. Y0. R225 M98 P100 G68 X0. Y0. R270 M98 P100 G68 X0. Y0. R315 M98 P100 M02 %

Y

X

start point

40.0

110.0 0.0

-10.0

10.0 0.0

Figure 6-24: Coordinate System Rotation Example

_____________________________________________________________________________________ 6-45

Page 63: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Limitations

• G codes related to reference position return (G28, G29 and G30), and G codes for coordinate system selection (G52, G53, G54-G59, G54.1) must not be used when coordinate system rotation mode is on.

o If you are using tool radius compensation (G41, G42), AND scaling mode (G51) AND coordinate system rotation mode, the commands should be specified in the following order:

G51; (starts scaling mode) G68; (starts coordinate system rotation mode) . . G41; (starts tool radius compensation mode) . .

o If you are using scaling mode (G51) AND coordinate system rotation mode, but NOT tool radius compensation mode (G41, G42), the commands should be specified in the following order:

G51; (starts scaling mode) G68; (starts coordinate system rotation mode) . . G69; (ends coordinate system rotation mode) G50; (ends scaling mode)

Notes

• If X, Y and Z parameters are omitted from the command, the current position where G68 is commanded becomes the center of rotation.

• When R is not specified, R is assumed to be 0.0 degrees. • Tool radius compensation (G41, G42), mirror image (G51.1), and scaling (G51) are executed after the

coordinate system is rotated. • If scaling mode (G51) is effective with a coordinate system rotation mode command is issued, the coordinate

value of the center of rotation will e scaled, but not rotation angle R.

Default G68 is the default mode when neither G68 nor G69 has been programmed.

_____________________________________________________________________________________ 6-46

Page 64: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.25 Absolute / Incremental Programming (G90, G91)

Description The G90 and G91 commands are used to tell the machine whether you’ll be commanding movement with absolute coordinates or incremental coordinates. G90: absolute programming (absolute coordinates, relative to the part origin) G91: incremental programming (incremental coordinates, relative to the current tool position)

Possible Parameters That Can Be Used With G90, G91 None.

Example Suppose you want to program the movement from start point to end point shown in the following figure, with G01 (linear interpolation).

Z

X

start point

end point

8.0 23.0

3.0

14.0

15.0

11.0

Figure 6-25: Absolute/Incremental Programming Example

You could program this movement with either G90 or G91, as shown: G90 G01 X14.0 Z23.0 OR G91 G01 X11.0 Z15.0

Default G90 is the default mode when neither G90 nor G91 has been programmed.

_____________________________________________________________________________________ 6-47

Page 65: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

6.3.26 Workpiece Coordinate Programming (G92)

Description The G92 command is used to set up a workpiece coordinate system. With this command, you are setting the zero point at specified coordinates that are on the workpiece. This makes programming simple, because all commands related to that workpiece are relative to a point on the workpiece, rather than relative to the machine origin.

Required Format G92 X Y Z A B C D E

Possible Parameters That Can Be Used With G92 X – coordinate value for the X axis Y – coordinate value for the Y axis Z – coordinate value for the Z axis A – coordinate value for the A axis B – coordinate value for the B axis C – coordinate value for the C axis D – coordinate value for the D axis E – coordinate value for the E axis

Example G92 X5.6 Z8.2

Z'

X'

Workpiece Origin (0.0000, 0.0000)

8.2

5.6

Current position (which becomes 5.6, 8.2 in the workpiece coordinate system)

Z

X

Machine Origin

Figure 6-26: Workpiece Coordinate Programming Example

6.3.27 Linear Interpolation Feedrate Include / Exclude Rotary Axes (G310, G311)

Description G310 and G311 are used to specify whether the specified feedrate includes rotary axes or not. G310: linear interpolation feedrate includes rotary axes G311: linear interpolation feedrate excludes rotary axes

_____________________________________________________________________________________ 6-48

Page 66: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 6: G Codes (Preparatory Functions)

Possible Parameters That Can Be Used With G310, G311 None.

Examples Assume axis A is a rotary axis, and axes X, Y, Z are normal axes (linear table driven by a ball screw). The following G-codes: G310; G91 G01 X30.0 Y40.0 A50.0 F3000 Will cause each axis to move at the speed shown below: X axis speed = = 1,272.8 mm/min 3000 x 30.0

30.02 + 40.02 + 50.02

Y axis speed = = 1,697.1 mm/min 30

00 x 40.0

30.02 + 40.02 + 50.02 A axis speed = = 2,121.3 deg/min 30

00 x 50.0

30.02 + 40.02 + 50.02 While the following G-codes: G311; G91 G01 X30.0 Y40.0 A50.0 F3000 Will cause each axis to move at the speed shown below: X axis speed = = 1,800.0 mm/min 30

00 x 30.0

30.02 + 40.02 Y axis speed = = 2,400.0 mm/min 30

00 x 40.0

30.02 + 40.02 A axis speed = = 3,000.0 deg/min 30

00 x 50.0

30.02 + 40.02

Default G310 is the default mode when neither G310 nor G311 has been programmed.

_____________________________________________________________________________________ 6-49

Page 67: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 7: M Codes (Miscellaneous Codes)

Chapter 7: M Codes (Miscellaneous Codes)

If there is more than one possible meaning, both meanings are listed.

M-CODE DESCRIPTION

M00 program temporary stop

M01 program optional stop

M02 program end

M30 program end and rewind

subprogram call from a main program (ex.: M98 PTest_1 R3 calls subprogram OTest_1.dat in the same folder as the parent program, and repeats it three times)

M98

return to main program from a subprogram OR returns the flow of execution to the M99 beginning of the main program (if used in the main program)

Table 7-1: Summary of M Codes

Except for M98 and M99, all M codes listed here are programmed in the default LadderWorks PLC sequence program provided with your SMP product. In order to use these M codes (i.e. M00, M01, etc.), you must put the relevant PLC programming code for each M code in the customized PLC sequence program for your machine. We recommend you use the default LadderWorks PLC sequence program as the starting point for your customized PLC sequence program. In addition to these preset M codes, you can create customized M codes using custom M code macro calls. See Section 14.5: Custom Macro Calls Using G Codes, M Codes or T Codes for more information. NOTE: General M codes are processed after any motion specified in the same block is completed. Therefore, if you want your M code to be executed first, specify it in a separate line of code prior to the block of code specifying the motion you want it to precede.

_____________________________________________________________________________________ 7-1

Page 68: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 8: Tool Functions and T Codes

Chapter 8: Tool Functions and T Codes

8.1 Overview of T Codes

Description T codes are 3-digit codes used to select the tool and associated offset number.

Required Format Txxx

Parameters xxx – tool number (and offset number) 1 ~ 256 (3-digit)

Notes

• T0 is used to cancel any active tool offset value • Only tool number xxx is sent to PLC through binary format (F26.0 ~ F26.7) • For each new tool number, a one-shot T strobe signal (F07.3) is also sent to PLC

8.2 Tool Offsets

Each set of tool offsets consists of the following: • Length Geometry Offset (diameter or radius programming) • Length Wear Offset (diameter or radius programming) • Radius Geometry Offset • Radius Wear Offset When the specified tool offset number is selected, the offset values for Length and Radius are the sum of the corresponding Geometry Offset and the corresponding Wear Offset, respectively: Offset Data = Geometry Offset + Wear Offset The Tool Radius Offset is used as Tool Radius Compensation (TRC) with G40, G41 or G42.

Notes

• When a T code is commanded, the associated Tool Radius Offset will become effective. But the Tool Length Offset will not be effective unless either G43 or G44 modal is active and an H code is called explicitly (refer to Section 6.3.17: Positive / Negative Tool Length Compensation/ Compensation Cancel (G43, G44, G49)).

• If a T code is programmed in the same line with motion commands, they will be processed in parallel. And the motion will be processed with the new tool radius offset.

_____________________________________________________________________________________ 8-1

Page 69: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 8: Tool Functions and T Codes

Example N00100 T1 G00 X1.0 Y2.0 The Tool #1 signal will be sent to PLC, and tool radius offset #1 will become active. At the same time, motion “G00 X1.0 Y2.0” will be processed with tool radius offset #1. The above is equivalent to: N00100 T1 N00110 G00 X1.0 Y2.0

Custom T Codes You can create customized T codes using custom T code macro calls. See Section 14.5: Custom Macro Calls Using G Codes, M Codes or T Codes for more information.

_____________________________________________________________________________________ 8-2

Page 70: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 9: Macro Programming

Chapter 9: Macro Programming

9.1 What Is A Macro Program?

A macro is one instruction that is included in a motion program and that represents a sequence of simpler instructions, known as a macro (either a macro subroutine or a macro subprogram, depending on where the macro code is located and how it is called). In a way, macro programs are like simple programs or batch files. SMP systems support sophisticated custom macros that allow you to use variables and flow control structures such as loops. In this way, you can use program logic to eliminate redundant programming of machine functions, such as milling multiple pockets. Macros significantly simplify motion programming and reduce motion programming time by allowing reuse of programming pieces such as user-defined canned cycles. The extensive macro programming capabilities available with SMP systems will save time and reduce operator errors. Macro programs are written in the SMP motion programming language, which is similar to the BASIC programming language. You will find it easy to learn to program macros for SMP systems. Macros can be used as subroutines, contained in the same file as the main program (and called using the G65 simple macro call). Or, macros can be used as separate macro subprograms, either residing in the same folder as the main program (and called using an M98 subprogram call), or residing anywhere, even on a network (using custom G, M, S or T macro calls).

9.2 Differences Between Simple (Non-Macro) Subprograms and Macros

Using a simple NC subprogram (without the macro programming option) for motion programming allows reuse of code for repeating the same exact machining operation, but it is limited in terms of reusability and it is not very powerful. Using macro subroutines (or macro subprograms) is very similar to calling a simple NC subprogram from a main motion program, except with the added advantage that you can use variables, control structures and mathematical and logical operations in macros. This means that macros are much more powerful, more versatile and more reusable than simple NC subprograms. For instance, you can have one macro for a bolt hole, and just change the variables (arguments) you assign when you call the macro (with macro instructions). If you were using a simple (non-macro) subprogram for programming a bolt hole, you would need a different subprogram for each size bolt hole. The format of a macro subroutine is the same format as a simple NC subprogram:

_____________________________________________________________________________________ 9-1

Page 71: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 9: Macro Programming

· · G65 Macro number · · % O Macro number · · · · · M99 – returns the flow of control to the calling program %

body of macro subroutine

main program

Figure 9-1: Format for a Macro Subroutine

NOTES:

1) Using M99 in the main motion program returns the flow of control to the beginning of that main part program, resulting in an infinite loop.

2) Either the “%” symbol or a carriage return is required at the end of all NC and macro files.

9.3 Differences Between Macro Statements and Motion Programming Statements

Macro statements are blocks of code in a subprogram or a motion program that must meet one of the following criteria:

1) Contains an arithmetic or logical operation (see Chapter 12: Mathematical Operations and Logical Operations)

2) Contains a control statement (see Chapter 13: Flow of Control – Branching and Repetition) 3) Contains a macro call command (see Chapter 14: Calling Macro Programs)

Any statement (block of code) not meeting the above criteria is considered to be a motion programming statement. When a macro statement is executed, single block mode does not apply; i.e., the machine does not stop execution.

_____________________________________________________________________________________ 9-2

Page 72: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 9: Macro Programming

9.4 General Format Requirements

1) A space is required between keywords and values.

For instance:

GOTO99 INVALID GOTO 99 VALID [#11GT0] INVALID [#11 GT 0] VALID

2) Brackets “[ ]”must be used around conditional expressions and in mathematical and logical operations.

Parentheses “( )”are invalid in these cases, and are used only for comments in the code. For instance:

(#11 GT 0) INVALID [#11 GT 0] VALID

_____________________________________________________________________________________ 9-3

Page 73: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 10: Variables

Chapter 10: Variables

10.1 Overview of Variables

As has been previously described, the SMP motion programming language consists of blocks of code made up of F codes, G codes, M codes, N codes, S codes, T codes, etc. Both motion programs and subprograms specify positions and distances associated with these codes directly. That is to say, the numerals that accompany the parameters for these F/G/M/N/T codes are exact physical dimensions, or exact feedrates, or scaling factors, etc. The SMP motion programming language allows you to specify either a numeric value or a variable number. When a variable number is used, the variable value can be assigned when the macro program is called from the motion program, or the variable value can be calculated within the macro program, based on other numeric values or variables.

10.2 Types of Variables

There are six types of variables in the SMP motion programming language:

1) The Null Variable (#0). The value of this variable is always null. You cannot assign a value to this variable.

DO NOT USE A NULL VARIABLE.

Using a null variable (#0) in any line of code (in mathematical formulas, movement commands or conditional expressions) will cause an error, or unintended results.

CAUTION ! 2) Local Variables (#1-#99). Local variables are used within a local program scope, which may be a macro

program, a subprogram or the main program. Local values are only held as long as the local scope exists. For example, both the main program and a macro program called from the main program can have a local variable #1, but they are separate variables with separate values that exist only within their scope. The value of local variables within a macro program is lost (initialized to null) when the macro program returns to the motion program. You can assign values to local variables when you call a macro program from within a motion program, or you can use local variables to hold the results of logical or mathematical operations.

3) Numbered Global Variables (#100-#499). Numbered global variables are used by the SMP system and are

shared across multiple macro programs. The value is saved in the SMP system after a macro program (which may have assigned or changed the value of the global variable) returns to the motion program. These variables lose their values when the control is completely shut down (powered off). Numbered global variables have file scope – that is, if a global variable is defined in a file (whether it is the main program, a subprogram, or a macro program; whether or not it is defined inside a subroutine), its value is only visible in that file.

4) Symbolic Global Variables (#axxx - #zxxx) . The SMP system allows the use of symbolic variables, with meaningful variable naming (such as #position), for the convenience of the user. These symbolic variables must be all lower case, preceded by a “#” sign, and contain no numbers.

_____________________________________________________________________________________ 10-1

Page 74: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 10: Variables

Symbolic global variables, like numbered global variables, are used by the SMP system and are shared across multiple macro programs. The value is saved in the SMP system after a macro program (which may have assigned or changed the value of the global variable) returns to the motion program. These variables lose their values when the control is completely shut down (powered off). Symbolic global variables also have file scope. A symbolic global variable name can be up to 64 characters.

You will get unpredictable results if you specify a symbolic global variable that does not begin with “#,” or that uses upper case letters or mixes upper and lower case letters, or that includes numbers in the name. Either the variable will be ignored or there will be an error, depending on whether or not the variable name conflicts with keywords.

CAUTION !

5) Numbered Permanent Variables (#500-#999). Permanent variables are used by the SMP system and are shared across multiple macro programs. These variables keep their value in the SMP system after a macro program (which may have assigned or changed the value of the global variable) returns to the motion program. They even keep their values even when the control is completely shut down (powered off), because the values are saved in the Windows registry.

6) System Variables (#3000 - #13999). System variables are used for holding data/values related to NC operations, such as positions, feedrates, tool compensation values, workpiece coordinate offsets, etc. For more information, see Chapter 11: System Variables.

10.3 Specifying and Referencing Variables

10.3.1 Specifying a Variable

All variables except symbolic variables must be assigned a number. Symbolic variables should have lower case names. All variables except symbolic variables must be specified with a number sign (“#”) followed by the variable number. The correct format is:

#n = value or mathematical expression

where “n” is the variable index number. For instance, to specify the variable #1 and give it the value of 500, the line of code would simply be:

#1 = 500 To specify the symbolic variable #position and give it the value of 23.0, the line of code would simply be:

#position = 23.0

Parentheses are invalid for specifying a variable number with an expression, and would result in an error or in unpredictable results.

CAUTION !

_____________________________________________________________________________________ 10-2

Page 75: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 10: Variables

10.3.2 Referencing a Variable

You can reference a local, global, permanent or system variable in one of two ways:

1) If you want to directly use the value of a variable, put the variable number after a word address, such as “X#4”. The value of variable #4 is used for the value of the motion programming parameter “X.” For example:

#1 = 20 #2 = 40 #position = 23.5 G01 X#1 Y#2 Z#position this is interpreted as “G01 X20 Y40 Z23.5”

2) If you want to use the value of a variable in an expression, enclose the expression in brackets (“[]”) and put

the expression after a word address, such as “X[#4+#5].” The value of variables #4 and #5 are added together, and used for the value of the motion programming parameter “X.”

You can reverse the sign of a variable value by referencing it with a minus sign (–) before the “#,” such as “X–#4.” As an example, the following line in a macro program demonstrates several ways of referencing local, global or system variables:

G17 G02 X–#4 Y[#2–#1] R#20 F[#6+#7] Q#8 An example of referencing a symbolic variable follows:

#position = 100 G00 X#position Z#position

These lines would have the same effect as “G00 X100 Z100”.

You cannot reference any variable with subprogram name calls (a “P” word address) or block/sequence numbers (an “N” word address). For instance, either of the following lines will produce an error:

N#1 M98 P100 N0020 M98 P#1

CAUTION !

VARIABLES MUST BE DEFINED/INITIALIZED BEFORE USE. Using a null variable (#0) or an uninitialized variable in any line of code (in mathematical formulas, movement commands or conditional expressions) will cause an error, or unintended results.

CAUTION !

_____________________________________________________________________________________ 10-3

Page 76: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 10: Variables

10.4 Variable Values

10.4.1 Allowable Values for Variables

Local and global variables are stored as double-precision floating-point values. A double-precision floating-point number is a 64-bit approximation of a real number. The number can be zero or can range from -1.7976931348623157E+308 to -2.2250738585072014E-307 (-1.7976931348623157 x 10308 to –2.2250738585072014 x 10-307), or from 2.2250738585072014E-307 to 1.7976931348623157E+308 (2.2250738585072014 x 10-307 to 1.7976931348623157 x 10308). Values in ranges other than these will trigger an alarm in the SMP system. When you assign a value without a decimal point, the value of the variable is assigned as a double-precision floating-point value with the maximum precision possible, approximately 15 digits of precision.

10.4.2 Rounding of Referenced Variables

When a variable is referenced and its value assigned to an address, the value is automatically rounded according to the maximum accuracy of double-precision floating-point numbers. A floating-point calculation is an arithmetic calculation done with floating-point numbers and often involves some approximation or rounding because the result of an operation may not be exactly representable. Floating-point values are limited to a finite precision. For the purposes of the machine tool and factory automation industries, this highly accurate representation of values is more than adequate, and rounding of referenced values is undetectable. For a more complete explanation, see Section 12.4: Precision and Errors.

10.5 Processing Null and Uninitialized Variables

Any variable that has not been initialized (to which no value has been assigned) is undefined, or equal to the null variable (#0). This applies to undefined local, undefined global, undefined permanent, undefined symbolic or undefined system variables. Using the null variable (#0) in any line of code will result in an error.

10.5.1 Uninitialized Variables in a Mathematical Formula

If a variable has the value of null and is used in a mathematical formula, the entire line of code is ignored, causing unintended results.

Using a null variable (#0) or an uninitialized variable in a mathematical formula will cause unintended results, and should be avoided.

CAUTION !

_____________________________________________________________________________________ 10-4

Page 77: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 10: Variables

10.5.2 Uninitialized Variables in a Movement Command

If a variable has the value of null and is used in a movement command, both the variable and the word address being referenced will be ignored, probably causing unintended results. For example:

#1 = 10 #2 = #0 G01 X#1 Y#2

“G01 X10” is the movement command that will be executed. The “Y” address will be ignored, because the value assigned to that address is undefined.

Using a null variable (#0) or an uninitialized variable in a movement command will be ignored, causing unintended results, and should be avoided.

CAUTION !

10.5.3 Uninitialized Variables in a Conditional Expression

If a variable has the value of null and is used in a conditional expression, it will cause a syntax error.

Using a null variable (#0) or an uninitialized variable in a conditional expression will cause an error, and should be avoided.

CAUTION !

_____________________________________________________________________________________ 10-5

Page 78: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 11: System Variables

Chapter 11: System Variables

11.1 Overview of System Variables

System variables are used for holding data/values related to NC operations, such as positions, feedrates, tool compensation values, etc. You can read internal NC data using system variables, and you can write to some, but not all system variables. System variables are how macro programs communicate with the PLC. As such, they are powerful and necessary for automation and for general-purpose motion program development.

VARIABLE TYPE RANGE NOTES Input from PLC (by bit) #1000 – #1015 Read only Input from PLC (16 bit word) #1032 Output to PLC (by bit) #1100 – #1115 Output to PLC (16 bit word) #1132

Read/Write (with some limitations – see Section 7.1: Preread Function/ Block Buffering – Problem and Workaround) Output to PLC (32 bit dword) #1133

1 millisecond timer #3001 G-code modal groups #4000 – #4032 B code #4102 F code #4109 H code #4111 M code #4113 Sequence number #4114

Read only

S code #4119 T code #4120 Block end point position #5001 – #5008 Current position (machine) #5021 – #5028 Current position (work) #5041 – #5048 Work coordinate 1 #5221 – #5228 Work coordinate 2 #5241 – #5248 Work coordinate 3 #5261 – #5268 Work coordinate 4 #5281 – #5288 Work coordinate 5 #5301 – #5308

Read/Write (with some limitations – see Section 7.1: Preread Function/ Block Buffering – Problem and Workaround)

Work coordinate 6 #5321 – #5328 Tool length wear compensation #10001 – #10999 Tool length geometry compensation #11001 – #11999 Tool radius wear compensation #12001 – #12999

Read/Write (with some limitations – see Section 7.1: Preread Function/ Block Buffering – Problem and Workaround)

Tool radius geometry compensation #13001 – #13999

Table 11-1: Summary of System Variables

_____________________________________________________________________________________ 11-1

Page 79: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 11: System Variables

11.2 System Variables for Interfacing with the PLC

System variables #1100 – 1115, #1132 and #1133 (for interfacing with the PLC) can be read and written to (with some limitations – see Section 15.1: Preread Function/ Block Buffering – Problem and Workaround). System variables for interfacing with the PLC are broken down as follows:

SYSTEM VARIABLE NUMBER

CORRESPONDING PLC ADDRESS INTERFACE WITH PLC

G54.0 #1000

G54.1 #1001

G54.2 #1002

G54.3 #1003

G54.4 #1004

G54.5 #1005

G54.6 #1006

G54.7 #1007

#1008 G55.0

16-bit signal from PLC to macro. The signal is read bit by bit.

G55.1 #1009

G55.2 #1010

G55.3 #1011

G55.4 #1012

G55.5 #1013

G55.6 #1014

G55.7 #1015

The 16-bit binary value of byte G54 and G55, G54 being the least

significant byte.

16-bit signal from PLC to macro. All 16 bits of the signal are read at one time.

#1032

Table 11-2: System Variables for PLC Interface (1 of 2)

_____________________________________________________________________________________ 11-2

Page 80: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 11: System Variables

SYSTEM VARIABLE NUMBER

CORRESPONDING PLC ADDRESS INTERFACE WITH PLC

F54.0 #1100

F54.1 #1101

F54.2 #1102

F54.3 #1103

F54.4 #1104

F54.5 #1105

F54.6 #1106

F54.7 #1107

#1108 F55.0

16-bit signal from macro to PLC. The signal is read bit by bit.

F55.1 #1109

F55.2 #1110

F55.3 #1111

F55.4 #1112

F55.5 #1113

F55.6 #1114

F55.7 #1115

The 16-bit binary value of byte F54 and F55, F54 being the least

significant byte.

16-bit signal from macro to PLC. All 16 bits of the signal are read at one time.

#1132

32-bit signal from macro to PLC. All 32 bits of the signal are read at one time. Acceptable values range from –2,147,483,648 to +2,147,483,648.

The 32-bit binary value of byte F56, F57, F58 and F59, F56 being

the least significant byte. #1133

Table 11-3: System Variables for PLC Interface (2 of 2)

_____________________________________________________________________________________ 11-3

Page 81: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 11: System Variables

11.3 System Variables for Tool Compensation

System variables for tool compensation values can be read and written to (with some limitations – see Section 15.1: Preread Function/ Block Buffering – Problem and Workaround). System variable numbers for tool compensation values are broken down as follows:

TOOL LENGTH COMPENSATION TOOL RADIUS COMPENSATION TOOL NUMBER

GEOMETRY WEAR GEOMETRY WEAR

#11001 #10001 #13001 #12001 1

· · ·

· · ·

· · ·

· · ·

· · ·

#11200 #10200 #13200 #12200 200

· · ·

· · ·

· · ·

· · ·

· · ·

#11999 #10999 #13999 #12999 999

Table 11-4: System Variable Numbers for Tool Compensations

11.4 System Variables for Timers

System variables for timers are broken down as follows:

SYSTEM VARIABLE NUMBER

TIMER DESCRIPTION

• Counts in 1-millisecond increments at all times #3001 • Resets to 0 each time the power is turned on

• Resets to 0 each time 2,147,483,648 milliseconds is reached

Table 11-5: System Variables for Timers

_____________________________________________________________________________________ 11-4

Page 82: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 11: System Variables

11.5 System Variables for Modal Information

System variables for modal information specified in blocks immediately preceding the current block can be read. System variables for modal information can only be read, not written to.

If you try to write to a system variable for modal information, you will get an error. This variable is write-protected.

CAUTION ! System variables for modal information are explained as follows:

_____________________________________________________________________________________ 11-5

Page 83: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 11: System Variables

SYSTEM VARIABLE NUMBER

MODAL GROUP FUNCTION

One shot G codes: G04, G05, G08, G09, G10, G27, G28, G29, G30, G31, G53, G65, G92 00 #4001

Movement commands: G00, G00.1, G01, G02, G03, G02.3, G03.3 01 #4002

Plane specification: G17, G18, G19 02 #4003

Absolute / incremental: G90, G91 03 #4004

Feed per minute / rotation per minute: G98, G99 05 #4006

Inch / millimeter: G20, G21 06 #4007

Tool radius compensation: G40, G41, G42 07 #4008

Tool length compensation: G43, G44, G49 08 #4009

Fixed cycle: G73, G74, G76, G80 – G89 09 #4010

I point / R point return: G98, G99 10 #4011

Scaling: G50, G51 11 #4012

Workpiece coordinates: G54-G59 14 #4015

Cutting mode: G61, G64, G64.1 15 #4016

Coordinate system rotation: G68, G69 16 #4017

Mirror image: G50.1, G51.1 22 #4023

Linear interpolation feedrate include/exclude rotary axes: G310, G311 31 #4032

F code n/a #4109

H code n/a #4111

M code n/a #4113

Sequence number n/a #4114

T code n/a #4120

Table 11-6: System Variables for Modal Information

As an example, the line of code “#5=#4006,” the value of variable #5 would be either 20 or 21, depending upon whether G20 or G21 was active.

_____________________________________________________________________________________ 11-6

If you specify a system variable to read modal information that corresponds to a G code modal group that cannot be used, that system variable will be assigned a value of zero.

CAUTION !

Page 84: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 11: System Variables

11.6 System Variables for Position Information

System variables for current positions can be read. System variables for position information can only be read, not written to.

If you try to write to a system variable for position information, you will get an error. This variable is write-protected.

CAUTION ! System variables for position information are explained as follows:

SYSTEM VARIABLE NUMBER

POSITION INFORMATION NOTES

Block end point (the program position at the completion of the current block) in the current workpiece coordinate system

• Tool compensation value not included #5001 – #5008

(for axes 1-8) • System variable can be read during movement 1

• Tool compensation value included Machine position (the command position measured from the machine origin) in the machine coordinate system

• System variable can be read during movement, but care should be taken in how this data is used (due to the buffering / preread function

#5021 – #5028 (for axes 1-8)

2)

• Tool compensation value included Program position (the desired position, specified by the program). This position is with respect to the workpiece coordinate system

• System variable can be read during movement, but care should be taken in how this data is used (due to the buffering / preread function

#5041 – #5048 (for axes 1-8)

1 2)

Table 11-7: System Variables for Position Information

NOTES:

1) If no G54, G55, G56, G57, G58 or G59 code has been programmed, the workpiece coordinate system will be the same as the machine coordinate system.

2) See Section 15.1: Preread Function / Block Buffering – Problems and Workaround.

_____________________________________________________________________________________ 11-7

Page 85: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 11: System Variables

An example follows, where X is Axis #1, Y is Axis #2, and the G54 workpiece coordinates are X=100 and Y=100.

G54 (sets the G54 workpiece coordinate system) G01 X10 Y10 (moves the X and Y coordinates to 10.000, 10.000 in the G54 workpiece coordinate system) G04 P10 G04 P10 G04 P10 G04 P10 G04 P10 #1=#5001

Dummy delay blocks to ensure proper evaluation of the local variables (#1, #2 and #3) used in the following lines of code – see Section 7.1: Preread Function/Block Buffering – Problems and Workaround

#2=#5021 #3=#5041

At the completion of the execution of the above code, the value of #1 would be 10.000 (the program position relative to the G54 workpiece coordinate system). The value of #2 would be 110.000 (the machine position relative to the machine coordinate system). The value of #3 would be 10.000 mm (the program position relative to the G54 workpiece coordinate system).

11.7 System Variables for Workpiece Coordinates

System variables for workpiece coordinates can be read and written to (with some limitations – see Section 15.1: Preread Function/ Block Buffering – Problem and Workaround). System variables for workpiece coordinates in various workpiece coordinate systems are explained as follows:

SYSTEM VARIABLE NUMBER

EXPLANATION

#5201 – #5208 (for axes 1-8) External workpiece coordinates

#5221 – #5228 (for axes 1-8) G54 workpiece coordinates for workpiece coordinate system #1

#5241 – #5248 (for axes 1-8) G55 workpiece coordinates for workpiece coordinate system #2

#5261 – #5268 (for axes 1-8) G56 workpiece coordinates for workpiece coordinate system #3

#5281 – #5288 (for axes 1-8) G57 workpiece coordinates for workpiece coordinate system #4

#5301 – #5308 (for axes 1-8) G58 workpiece coordinates for workpiece coordinate system #5

#5321 – #5328 (for axes 1-8) G59 workpiece coordinates for workpiece coordinate system #6

Table 11-8: System Variables for Workpiece Coordinates

_____________________________________________________________________________________ 11-8

Page 86: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 12: Mathematical Operations and Logical Operations

Chapter 12: Mathematical Operations and Logical Operations

12.1 Summary of Mathematical and Logical Operations

The SMP motion programming language includes many mathematical operations and logical operations to facilitate your macro programming. The following three tables summarize the mathematical and logical operations can be performed on variables. In the tables, the expression to the right of the operator (“=”) can contain constants, variables, or an expression containing constants and/or variables. Variables to the left of the operator (“=”) can also be replaced with an expression. #A, #B and #C represent local, global, permanent, system or symbolic variables, unless noted otherwise.

FUNCTION FORMAT NOTES

#A = #B Assignment

#A = #B + #C Sum

#A = #B - #C Difference

Product #A = #B * #C

#A = #B / #C Quotient

#A = #B ^ #C Exponent

#A = sin [#B] Sine

#A = asin [#B / #C] Arcsine

Cosine #A = cos [#B]

Arccosine #A = acos [#B / #C]

• #B and #C should be specified in units of degrees. 45 degrees and 30 minutes should be represented as 45.5°.

Tangent #A = tan [#B]

• Function “tan” performs “sin/cos”.

#A = atan [#B / #C] Arctangent

Table 12-1: Summary of Mathematical and Logical Operations (1 of 3)

_____________________________________________________________________________________ 12-1

Page 87: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 12: Mathematical Operations and Logical Operations

If you input data in radians instead of degrees for trigonometric functions you will get an error.

CAUTION !

FUNCTION FORMAT NOTES

#A = sqrt [#B] Square Root

#A = abs [#B] Absolute Value

• When the “round” function is included in an arithmetic or logic operation command, in an IF statement, or in a WHILE statement, the “round” function rounds off at the first decimal place. (If #10 = 6.6666, then #1 = round [#10] changes the value of variable #10 to 6.0.) Rounding Off

Below the Decimal Point

#A = round [#B] • When the “round” function is used in an

NC statement address, the “round” function rounds off the specified value according to the least input increment of the address. (If the least input increment is 0.001 mm, and #1 = 5.6687, then G00 X#1 moves axis X 5.669 mm.)

Rounding Down (Absolute

Value) #A = fix [#B]

• Integers are rounded up or down according to their absolute values, not their actual values. Therefore, you must be very careful when rounding negative numbers up or down.

• Rounding up an integer: the absolute value of the integer produced by the “fup” function is greater than the absolute value of the original number.

• Rounding down an integer: the absolute value of the integer produced by the “fix” function is less than the absolute value of the original number.

• Examples: Rounding Up (Absolute

Value) Say that #10 = 3.1 and #20 = –3.1. #A = fup [#B] #30 = fup [#10] ⇒ #30 = 4.0 #30 = fix [#10] ⇒ #30 = 3.0 #30 = fup [#20] ⇒ #30 = –4.0 #30 = fix [#20] ⇒ #30 = –3.0

Table 12-2: Summary of Mathematical and Logical Operations (2 of 3)

_____________________________________________________________________________________ 12-2

Page 88: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 12: Mathematical Operations and Logical Operations

FUNCTION FORMAT NOTES

Natural Logarithm #A = ln [#B]

-8• Relative error may become 10 or greater Exponential

Function #A = exp [#B] • When #A (the result of the operation) exceeds 3.65 x 1047 (for #B ≈ 110), an overflow occurs, you will get an error

Or #A = #B or #C

Xor #A = #B xor #C

• These logical operations are performed on binary numbers bit by bit

• “not” is implemented as follows:

And #A = #B and #C

• For a conditional statement, “not” changes the value from “TRUE” to “FALSE,” or from “FALSE” to “TRUE”

• For the number “0,” “0” is evaluated as “FALSE,” and the “not” operation then returns the value of “TRUE”

• For any non-zero numeric value (decimal value or binary), the numeric value is evaluated as “TRUE,” and the “not” operation then returns the value of “FALSE”

#A = not #B, #A = !#B Not

• Examples: 0 FALSE !0 TRUE 6 TRUE !6 FALSE

Table 12-3: Summary of Mathematical and Logical Operations (3 of 3)

12.2 Format of Mathematical and Logical Operations

There are three important rules for the formatting of mathematical and logical operations:

1) All mathematical functions must be specified in lower case: sin [#B].

2) Brackets must be used: sin [#B]. The use of parenthesis (i.e. “sin (#B)”) would result in an error.

3) To include comments in mathematical and logical operations, use parenthesis (“( )”).

_____________________________________________________________________________________ 12-3

Page 89: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 12: Mathematical Operations and Logical Operations

12.3 Order of Operations

12.3.1 Nesting

In addition to using brackets as part of functions, you can use brackets to specify a certain order of operations. There is no limit to the number of folds for nested brackets. For equations with brackets, expressions and functions within brackets are executed from the innermost to the outermost pairs of brackets. For instance: #1 = cos [#3 + [[#4 / #2] * #5]]

1

2

3

4

1 , , and indicate the order of operations. 2 3 4

12.3.2 Priority of Operations

Commands including mathematical and logical operations are executed in a predictable order, as follows:

1) Functions (from left to right) 2) Multiplication and division operations (*, /, and) (from left to right) 3) Addition and subtraction operations (+, –, or, xor) (from left to right)

12.4 Precision and Errors

12.4.1 Precision and Errors Related to Mathematical and Logical Operations

There is always some level of error in the execution of mathematical and logical operations. However, all SMP systems use highly precise double-precision floating-point variables, so the level of error is quite small, approximately 15 digits. The 64-bit double-precision floating point standard is described by IEEE. A double-precision floating-point word has the following internal format:

Bit 63 Sign

Bits 62-52 Exponent

Bits 51-0 Mantissa

S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

_____________________________________________________________________________________ 12-4

Page 90: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 12: Mathematical Operations and Logical Operations

The first bit is the sign bit, S, the next eleven bits are the exponent bits, 'E', and the final 52 bits are the fraction 'F'. A number n is expressed in floating point format as:

n = (-1)s * m * 2e

where “s” is the value of the sign bit, “m” is the mantissa, and “e” is the exponent. The mantissa m is "normalized," which means that it is always scaled such that it is greater than or equal to 1, and less than 2. Therefore, the ones bit (20) is always set, and is not present in the actual number. This is called an implied bit. Since the mantissa is 52 bits, plus the implied ones bit, the precision of the number is stored to 53 bits, or 253 = 900,719,925,474,100, approximately 15 digits of precision (2.2250738585072014E-307, or 2.2250738585072014 x 10-307). The effective range (excluding infinite values) of IEEE double-precision floating-point numbers is:

• Binary: ± (2-2-52 1023)

• Decimal: ~ ± 10308.25 (This value is the end point of the range with the IEEE-754 round-to-nearest

value mode applied.) The maximum value of the floating-point number is about 1.8*(10308). Floating-point numbers usually behave very similarly to the real numbers they are used to approximate. However, there are some cases where floating-point numbers do not model real numbers well because most floating-point values can't be precisely represented as a finite binary value. For example 0.1 is .0001100110011... in binary (it repeats forever), so it can't be represented with complete accuracy on a computer using binary arithmetic, which includes all PCs. Similarly, the result of arithmetic operations may need to be rounded. For example, 2/3 might yield 0.666666666666667. Because of this, you can’t assume that a result is accurate to the last decimal place. There are always small differences between the "true" answer and what can be calculated with the finite precision of any floating point processing unit. Cumulative rounding errors are possible, but are unlikely to ever be problematic.

Any time you specify division by zero, you will get an error.

CAUTION !

12.4.2 Precision and Errors Related to Conditional Expressions

Conditional expressions using EQ (equal to), NE (not equal to), GE (greater than or equal to), GT (greater than), LE (less than or equal to) or LT (less than), can also result in errors. As an example, if you are using the expression “IF [#10 EQ #20],” if there are small errors in how variables #10 and #20 have been calculated, you may get a FALSE evaluation when a TRUE evaluation would have been expected. Also, consider that both variables #10 and #20 may have been rounded off slightly, which could also affect the evaluation. To avoid this problem, you could replace the expression “IF [#10 EQ #20]” with “IF [abs [#10 – #20] LT 0.00001,” thus assuming that two values are considered to be equal if their difference does not exceed some allowable limit (0.00001 in this case)

_____________________________________________________________________________________ 12-5

Page 91: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 12: Mathematical Operations and Logical Operations

12.4.3 Errors Related to Null Variables or Uninitialized Variables

Any time you use a null variable or an uninitialized variable, you will get an error or unintended results. .

_____________________________________________________________________________________ 12-6

Page 92: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 13: Flow of Control – Branching and Repetition

Chapter 13: Flow of Control – Branching and Repetition

13.1 Overview of Flow Control

There are five types of branch and repetition statements that can be used to direct the flow of control in a macro program:

1) The GOTO statement (an unconditional branch statement). 2) The IF GOTO statement (a conditional branch statement).

3) The IF THEN statement (a conditional execution statement).

4) The IF ELSE ENDIF statement (a conditional execution with branching statement).

5) The WHILE DO END statement (conditional loop: repetition while certain conditions are met).

These branching and repetition statements are case insensitive: they can be either lower case or upper case (“IF ELSE ENDIF” or “if else endif.”

13.2 GOTO Statement (Unconditional Branching)

The GOTO statement is a very simple statement that directs the execution to a specific sequence number in the range of 1 to 99,999. The format of a GOTO statement is:

GOTO n NOTE: a space is required between “GOTO” and “n,” the sequence number

“n” refers to the sequence number. It can be specified in one of two ways:

1) As a direct number. (GOTO 1000) 2) In the format “NXXXX” (GOTO N1000)

It is strongly recommended that you use GOTO statements to branch to sequence numbers that occur later in the macro program, rather than a sequence number that comes BEFORE the GOTO statement. In other words, the flow of control should always be in the forward direction, not in the reverse direction, or it will impact processing time.

CAUTION !

If you specify a sequence number outside the range of 1 to 99,999, you will get an error.

CAUTION !

_____________________________________________________________________________________ 13-1

Page 93: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 13: Flow of Control – Branching and Repetition

It is invalid to use a variable or an expression as a sequence number. The following lines of code would each result in an error:

GOTO #1 GOTO [#1 + #2]

CAUTION !

13.3 Conditional Statements and Comparison Operators

A conditional statement is an expression that compares two values using comparison operators. These values may be constants, variables, or expressions. Conditional statements are evaluated to be either TRUE or FALSE. A non-zero numeric value is evaluated as TRUE. A zero value is evaluated as FALSE. An example follows: #1 = 100 #2 = 0 IF [#1] evaluates as TRUE IF [#2] evaluates as FALSE Comparison is done using operators summarized in the following table:

COMPARISON OPERATOR EXPLANATION ACCEPTABLE FORMATS

[#A EQ #B] = Equal to EQ [#A = #B]

[#A NE #B] ≠ Not equal to NE

[#A GT #B] > Greater than GT [#A > #B]

[#A GE #B] ≥ Greater than or equal to GE [#A >= #B]

[#A LT #B] < Less than LT [#A < #B]

[#A LE #B] ≤ Less than or equal to LE [#A <= #B]

Table 13-1: Summary of Comparison Operators

_____________________________________________________________________________________ 13-2

Page 94: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 13: Flow of Control – Branching and Repetition

Conditional statements that include the null variable (#0) will result in a syntax error.

CAUTION !

Brackets must be used: [#A EQ #B]. The use of parenthesis (i.e. “(#A EQ #B)”) would result in an error.

13.4 IF Statement

The IF statement specifies some conditional expression. It may be followed by a GOTO statement, a THEN statement, or an ELSE…ENDIF structure.

13.4.1 IF GOTO (Conditional Branching)

The format of an IF GOTO statement is:

IF [<conditional expression>] GOTO n where “n” is the sequence number. If that conditional expression is satisfied, program execution branches to sequence number n. If that conditional expression is not satisfied, program execution continues with the execution of the statement following the IF GOTO statement. As noted previously, “n” refers to the sequence number, and can be specified in one of two ways:

1) As a direct number. (GOTO 1000) 2) In the format “NXXXX” (GOTO N1000)

CAUTION!

If you specify a sequence number outside the range of 1 to 99,999, you will get an error.

CAUTION !

It is invalid to use a variable or an expression as a sequence number. The following lines of code would each result in an error:

GOTO #1 GOTO [#1 + #2]

CAUTION !

_____________________________________________________________________________________ 13-3

Page 95: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 13: Flow of Control – Branching and Repetition

13.4.2 IF THEN (Conditional Execution)

The format of an IF THEN statement is:

IF [<conditional expression>] THEN <macro statement> If that conditional expression is satisfied, the program executes the macro statement following the “THEN.” If that conditional expression is not satisfied, program execution continues with the execution of the statement following the IF THEN statement (and the macro statement following the “THEN” is not executed).

The macro statement needs to be in the same line as the IF THEN statement, or you will get an error.

CAUTION !

13.4.3 IF ELSE ENDIF (Conditional Execution with Branching)

The format of an IF ELSE ENDIF structure is:

IF [<conditional expression>] <macro statement(s)> ELSE <macro statement(s)> ENDIF

If the first conditional expression is satisfied, the program executes the macro statement(s) following “IF” (and the macro statement(s) following the “ELSE” are not executed). If that first conditional expression is not satisfied, then program execution continues with the execution of the second macro statement or set of macro statements following “ELSE” (and the macro statement(s) following the “IF” are not executed). Program execution then continues with the execution of the statement following the ENDIF statement. Only one of the two sets of macro statements in an IF ELSE ENDIF structure is executed.

_____________________________________________________________________________________ 13-4

Page 96: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 13: Flow of Control – Branching and Repetition

13.5 WHILE DO END Statement (Conditional Looping)

The WHILE DO END statement is used to specify repetition for as long as some conditional expression is met. When the conditional expression is satisfied, the blocks of code from the “DO” to the “END” statements are executed. If the conditional expression is not satisfied, the blocks of code from the “DO” to the “END” statements are not executed, and program execution continues with the block of code immediately following the “END” statement. The format of a WHILE DO END statement is:

WHILE [<conditional expression>] DO m . . . END m where m is an identification number for specifying the range of execution.

“m” numbers can be reused as many times as required:

WHILE [<conditional expression>] DO 1 . . . END 1 WHILE [<conditional expression>] DO 1 . . . END 1

If you specify an “m” number outside the range of 1 to 99,999, you will get an error.

CAUTION ! WHILE/DO/END statements can be consecutive, or can be nested inside of each other. See Section 12.3.1: Nesting for examples.

_____________________________________________________________________________________ 13-5

Page 97: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 13: Flow of Control – Branching and Repetition

13.6 Nesting

13.6.1 Acceptable Nesting

Conditional statements and repetition statements can be nested within each other, with certain logical restrictions. IF ELSE ENDIF and WHILE DO END statements can be nested with no limit to the depth of nesting. An example of acceptable nesting of WHILE DO END statements follows:

WHILE [<conditional expression>] DO 1 . . WHILE [<conditional expression>] DO 2

.

. WHILE [<conditional expression>] DO 3 . . END 3 . .

END 2 . .

END 1 The flow of control can be directed to outside of the WHILE DO END loop, an example of which follows:

WHILE [<conditional expression>] DO 1 . . IF [<conditional expression>] GOTO 100 . .

END 1 . . N100…………….. . . M99

_____________________________________________________________________________________ 13-6

Page 98: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 13: Flow of Control – Branching and Repetition

An example of acceptable nesting of an IF ELSE ENDIF statement follows:

IF [<conditional expression>] <macro statement(s)> ELSE IF [<conditional expression>] <macro statement(s)>

ELSE IF [<conditional expression>] <macro statement(s)> ELSE <macro statement(s)>

ENDIF ENDIF ENDIF

13.6.2 Unacceptable Nesting

There are several nesting conditions that that would cause an error in the execution of your macro program:

1) Overlapping WHILE DO END ranges of WHILE statements

2) GOTO statements that branch the flow of control within a DO/END Loop of a WHILE statement

3) Infinite loops

13.6.2.1 Overlapping DO Ranges of WHILE Statements It is imperative that DO/END ranges do not overlap. Overlapping DO ranges cannot logically be executed. An example of overlapping DO ranges follows:

WHILE [<conditional expression>] DO 1 . .

WHILE [<conditional expression>] DO 2 . . . . END 1 . . END 2

13.6.2.2 GOTO Statements That Branch The Flow Of Control Within A DO END Loop Of A WHILE Statement. DO/END loops cannot be entered except from the while statement. If you attempt to use a GOTO statement to send the flow of control to within a DO/END loop, you will get an error, as this cannot logically be executed (the evaluation of the conditional statement of the WHILE loop is skipped).

_____________________________________________________________________________________ 13-7

Page 99: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 13: Flow of Control – Branching and Repetition

An example of a GOTO statement that branches the flow of control within a DO/END loop follows:

IF [<conditional expression>] GOTO n . . WHILE [<conditional expression>] DO 1 . . . . Nn………. . . END 1

13.6.2.3 Infinite Loops Infinite loops will produce errors and unexpected program execution. Some conditions under which infinite loops are created include the following:

• The conditional expression for a WHILE statement is always true – none of the variables within the conditional expression are modified by statements within the DO END loop

• A DO END loop which doesn’t follow a WHILE statement

• Including M99 in the main program

_____________________________________________________________________________________ 13-8

Page 100: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

Chapter 14: Calling Macro Programs

14.1 Overview of Macro Calls

There are differences between calling macro subprograms and calling macro subroutines from within motion programs. Macro subprograms can be called using custom G, M, S or T codes, or by using the M98 subprogram call, in the format:

M98 P R where P is the subprogram name, and R specifies the number of times the subprogram should be executed.

Calls to macro subprograms using M98 have the disadvantage of not allowing the passing of variables. For example, “M98 PTest_1 R3” calls subprogram OTest_1.dat in the same folder as the parent program, and repeats it three times. The subprogram must be in a separate file from the motion program file in which the M98 subprogram call appears. The subprogram file must be in the same folder as the motion program file. Macro programs can be called from within part programs with any of the following methods:

Macro programs must be in the same folder as the part program file. 1) A subprogram macro call (M98)

Macro subroutines must be in the same file as the main program 2) A simple macro call (G65)

3) Custom G code macro call

4) Custom M code macro call Macro programs may be anywhere, even on the network

5) Custom S code macro call

6) Custom T code macro call The differences between an M98 subprogram call and other macro calls are summarized in the following table:

M98 SUBPROGRAM CALL

G65 SIMPLE MACRO CALL

CUSTOM G AND M MACRO CALLS

CUSTOM T MACRO CALL FEATURE

Arguments can be

specified (data passed)

NO YES YES YES

Calls the macro subprogram from another file in the specified macro program folder (specified with

macro parameters)

Calls the macro subprogram from another file in the specified macro program folder (specified with

macro parameters)

Calls the macro subprogram from another file in the same folder where the main program

resides

Calls the macro subroutine from

within the same file as the main

program

Calls the macro…

Table 14-1: Summary of Differences between M98 Subprogram Call and Macro Calls

_____________________________________________________________________________________ 14-1

Page 101: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

14.2 Argument Assignment

When passing arguments to macro programs, we strongly recommend using decimal points. When arguments are passed without decimal points, the units used are assumed to correspond to the least input increment of each address, which may vary according to the configuration of the SMP system. For example, the statement “G65 P9000 A10. B20. C30.” assigns the value of “10” to #1, the value of “20” to #2 and the value of “30” to #3. In other words, addresses A, B and C are used to pass arguments, which are assigned to local variables #1, #2 and #3. The argument assignment protocol for SMP macros uses all of the letters of the alphabet (once each) except G, L, N, O and P.

If you specify a G, L, N, O or P in your argument assignments, you will get an error.

CAUTION ! Addresses that need not be specified (that won’t be used by the macro program) can be omitted from the argument assignments. The values of local variables corresponding to omitted addresses are set to null. The letters and the local variables to which the letters are assigned are summarized in the following table:

ADDRESS LETTER VARIABLE NUMBER

#1 A #2 B #3 C #7 D #8 E #9 F #11 H #4 I #5 J #6 K #13 M #17 Q #18 R #19 S #20 T #21 U #22 V #23 W #24 X #25 Y #26 Z

Table 14-2: Summary of Argument Assignment Protocol for SMP Macros

_____________________________________________________________________________________ 14-2

Page 102: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

An example follows: the statement “G65 P9000 A10. B20. F2. S100.” assigns the value of “10” to #1, the value of “20” to #2, the value of “2” to #9 and the value of “100” to #19. In other words, addresses A, B, F and S are used to pass arguments, which are assigned to local variables #1, #2, #9 and #19. The values of local variables #3, #4, #5, #6, #7, #8, #11, #13, #17, #18, #20, #21, #22, #23, #24, #25 and #26 are set to null because the addresses that correspond with them were omitted from the argument assignment statement.

14.3 Simple Macro Call (G65)

A simple macro call is a one-shot command in which a macro is called once using G65 (although it may be executed more than once, depending upon the L parameter, the number of times the macro is to be repeated).

Required Format G65 P L <argument assignment>

Possible Parameters That Can Be Used With G65 P – macro number (subroutine number) L – number of times to repeat the execution of the macro program (from 1 to 9,999 – 1 by default) In addition to these two parameters, macros are called with argument assignments, which are not considered to be parameters.

Example 1 G65 P100 L3 Z20.0 R2.5 F500 – calls macro program O100.dat, which will be repeated 3 times, and assigns

the value 20.0 to address Z, 2.5 to address R and 500 to address F O100.dat – this line indicates the macro program O100.dat, which is in the same file,

and which precedes the subroutine code

_____________________________________________________________________________________ 14-3

Page 103: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

Example 2 G28 G50 X0 Z0 G65 P1 Z-5 R.5 Q1 D0.3 F20.0 M30 % O1 IF [#26-#18>0] GOTO 100 IF [#17<=0] GOTO 100 IF [#7<0] GOTO 100 IF [#9<=0] GOTO 100 #50 = #18 G00 X0 G00 Z#50 WHILE [#50-#17 > #26] DO 1 #50 = #50 - #17 G01 Z#50 F#9 #50 = #50 + #7 G00 Z#50 #50 = #50 - #7 END 1 G01 Z#26 F#9 G00 Z#18 N100 M99 %

main program macro subroutine

Limitations

• G65 must be specified before any argument. • The macro program (the subroutine) must be in the same file as the motion program file that calls the macro

program.

14.4 G65 Macro Call Nesting

Macro calls can be nested to a depth of four levels. (This does not include M98 subprogram calls.) There are local variable levels (0 to 4) pertaining to nesting. The level of the main program is level 0. Each time a macro is called, the level of the local variable is incremented by one, and the values of the local variables at the previous level are saved in the SMP system. When M99 is executed in a macro program (indicating the end of the macro program), control returns to the calling program, the local variable level is decremented by one, and the values of the local variables that existed when the macro was called are restored.

When M99 is executed in a main program, it results in an infinite loop.

CAUTION !

_____________________________________________________________________________________ 14-4

Page 104: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

14.5 Custom Macro Calls Using G Codes, M Codes, S Codes or T Codes

14.5.1 Overview

You can create customized G, M, S or T codes to call macro programs, using the MDK. This is very similar to the G65 simple macro call. Essentially, you can use this capability to create your own special, user-defined G, M, S or T code functions (written as macro programs) and call them using your own G, M, S or T code number. You can define G, M, S or T codes as specialized codes by using macro parameters to associate these codes with specific macro programs. For S and T codes, the specified macro program applies to ALL S and T codes. For G and M codes, you define specific G and M codes (up to ten of each) that you associate with different macro programs. When you use this feature, the SMP RealTime DLL searches part program files before starting G code execution and generates (creates) a temporary file (with a user-defined file name and location), in which every special G, M, S and T code (defined by the macro function parameters) is replaced with a G65 simple macro call to the specified macro program, and each macro program is appended to this temporary file as a subroutine. S and T codes are kept as parameters (arguments) in any new line involving special S or T codes that invoke a macro program. NOTE: When you use the “custom macro calls using G, M, S or T codes” feature, the temporary file is created and executed even if there are no special G, M, S or T codes in the part program.

_____________________________________________________________________________________ 14-5

Page 105: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

14.5.2 Custom G Code, M Code, S Code or T Code Macro Call Function Parameters

14.5.2.1 Macro Program Folder (Full Path)

Description The directory (folder) where all the user-created macro programs related to custom G, M, S or T codes must be stored. The SMP controller will search this folder for all macro programs.

Required Format You must include the full path for this folder, including the drive.

Example C:\Program Files\SoftServo\SMP450\ncdata\Macro\

Notes The path for this folder can be on a local drive or on a network.

Limitations This folder must already exist. If you type the path of a folder that does not exist, you will get an error message.

_____________________________________________________________________________________ 14-6

Page 106: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

14.5.2.2 Output File Name (Full Path)

Description The name and location for the temporary motion program file that is created by and executed by the SMP Motion Parser. This temporary file consists of the part program file with the following changes:

• All lines of code that contain special G, M, S or T codes are replaced with G65 simple macro calls to the corresponding user-defined macro programs

• These user-defined macro programs are appended to this temporary part program file as macro subroutines

Required Format You must include the full path for this file, including the drive.

Example C:\Program Files\SoftServo\ SMP450\ncdata\Macro\tempdata.dat

Limitations • The location for this temporary file must be in a local folder, not on a network or a non-system drive.

• This folder must already exist. If you type the path of a folder that does not exist, you will get an error

message.

Notes • When you use the “custom macro calls using G, M, S or T codes” feature, this temporary file is created

whether or not there are any special G, M, S or T codes.

• Because this temporary part program file is executed by the ServoWorks G-Code parser and not the original part program file, M98 blocks will look for subprograms in the folder containing the temporary file and not the original part program file. To have M98 blocks look for subprograms in the folder containing the original part program file, set the output file to be in the same folder as the original part program file.

_____________________________________________________________________________________ 14-7

Page 107: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

14.5.2.3 S Code Setting Description The name of the macro program to be called for each instance of an S code in the user’s part program.

Required Format An integer between 1 and 999999999 (with no commas).

Example 3333 (This would cause all S codes to invoke a macro program file named “O3333.dat”)

Limitations • You cannot call a macro program with an S code from within a macro program. All S codes in macro

programs are treated as ordinary S codes. For example, if S1000 is defined as a custom S code macro call to O1234.dat, if “S500” appears in O1234.dat, it will NOT be treated as a macro call.

• No nesting of calls using S codes is allowed. In other words, if S codes are defined to call a macro program, any S codes in that macro program (subroutine) will be treated as ordinary S codes, and will not call that macro program again.

• All S codes in subprograms called with M98 are treated as ordinary S codes.

Notes The S code is kept as a parameter (argument) in the new line that invokes the macro program. For example, the line of code “S10” would be replaced with “G65 P3333 S10.”

_____________________________________________________________________________________ 14-8

Page 108: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

14.5.2.4 T Code Setting

Description The name of the macro program to be called for each instance of a T code in the user’s part program.

Required Format An integer between 1 and 999999999 (with no commas).

Example 3333 (This would cause all T codes to invoke a macro program file named “O3333.dat”)

Limitations • You cannot call a macro program with a T code from within a macro program. All T codes in macro

programs are treated as ordinary T codes. For example, if T1000 is defined as a custom T code macro call to O1234.dat, if “T500” appears in O1234.dat, it will NOT be treated as a macro call.

• No nesting of calls using T codes is allowed. In other words, if T codes are defined to call a macro program, any T codes in that macro program (subroutine) will be treated as ordinary T codes, and will not call that macro program again.

• All T codes in subprograms called with M98 are treated as ordinary T codes.

Notes The T code is kept as a parameter (argument) in the new line that invokes the macro program. For example, the line of code “T10” in the original NC part program would be replaced with “G65 P3333 T10.” In the O3333.dat macro program, the code should be written using the variable “T#20,” because “#20” is the variable number that corresponds to address letter T (see Table 14-2). When the parameter “T10” is passed into the O3333.dat macro program as an argument, T#20 will be replaced with T10. In this way, the O3333.dat macro program can support all T codes, with the T codes defined by the tool number called in the original motion program.

_____________________________________________________________________________________ 14-9

Page 109: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

14.5.2.5 M Code Settings

Description The M code settings actually have two parts:

1) The name of the M code that invokes a macro program file (that defines this custom M code). 2) The name of the macro program to be called for each instance of that specific M code in the user’s part

program.

Required Format The format for an M code can be an integer, or an integer with one digit after the decimal point. This is helpful, since you can name special M codes as non-integer numbers to set them apart from normal, predefined M codes which are always an integer value. The name of the macro program should be an integer between 1 and 999999999 (with no commas).

Example The name of the M code could be “3” (which defines “M03” as a customized M code), or could be “3.1” (which defines “M03.1” or “M3.1” as a customized M code). The name of the macro program could be “3333” (which would cause the special M code to invoke a macro program file named “O3333.dat”)

Limitations • No nesting of calls using any specially defined M codes is allowed. In other words, if a special M code is

defined to call a macro program, any instances of that same M code in that macro program (subroutine) will be treated as an ordinary M code, and will not call that macro program again. However, if a DIFFERENT special M code is used in a macro program (different than the special M code that called that macro program), then it WILL call its associated macro program from within the macro program. For example, if M3.1 is defined as a custom M code macro call to O3131.dat, if “M3.1” appears in O3131.dat, it will NOT be treated as a macro call. But if M4.1 is defined as a custom M code macro call to O4141.dat, and M4.1 appears in O3131.dat, it WILL call O4141.dat from O3131.dat.

• All M codes in subprograms called with M98 are treated as ordinary M codes.

_____________________________________________________________________________________ 14-10

Page 110: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 14: Calling Macro Programs

14.5.2.6 G Code Settings

Description The G code settings actually have two parts:

1) The name of the G code that invokes a macro program file (that defines this custom G code). 2) The name of the macro program to be called for each instance of that specific G code in the user’s part

program.

Required Format The format for a G code can be an integer, or an integer with one digit after the decimal point. This is helpful, since you can name special M codes as non-integer numbers to set them apart from normal, predefined M codes which are always an integer value. The name of the macro program should be an integer between 1 and 999999999 (with no commas).

Example The name of the G code could be “23” (which defines “G23” as a customized G code), or could be “23.1” (which defines “G23.1” as a customized G code). The name of the macro program could be “3333” (which would cause the special G code to invoke a macro program file named “O3333.dat”)

Limitations • No nesting of calls using any specially defined G codes is allowed. In other words, if a special G code is

defined to call a macro program, any instances of that same G code in that macro program (subroutine) will be treated as an ordinary G code, and will not call that macro program again. However, if a DIFFERENT special G code is used in a macro program (different than the special G code that called that macro program), then it WILL call its associated macro program from within the macro program. For example, if G23.1 is defined as a custom G code macro call to O231.dat, if “G23.1” appears in O231.dat, it will NOT be treated as a macro call. But if G24.1 is defined as a custom G code macro call to O241.dat, and G24.1 appears in O231.dat, it WILL call O241.dat from O231.dat.

• All G codes in subprograms called with M98 are treated as ordinary G codes.

_____________________________________________________________________________________ 14-11

Page 111: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 15: Macro Statement Processing

Chapter 15: Macro Statement Processing

15.1 Preread Function/Block Buffering – Problems and Workaround

The SMP Motion Engine communicates with the SMP Motion Parser, and determines the timing of the SMP Motion Parser. There is a buffer of five blocks of binary data (each the result of parsing one block of code from a part program) between the SMP Motion Engine and the SMP Motion Parser. This buffer is necessary to provide the SMP Motion Engine with multiple blocks each service routine. However, this “5 block preview” also causes some problems related to the updating of certain system variables. There are occasions where macro statements using system variables are evaluated, parsed, and delivered to the block buffer BEFORE the previous lines have been executed, and the relevant system parameters have been updated. Therefore, the evaluation of a macro statement containing a system variable may not evaluate as expected. For example, let’s say the current position of the X axis is 0.0, and then the following five blocks of code are each parsed and sent to the block buffer as a group:

G01 X10 G01 X20 G01 X30 G01 X40 IF [#5021 LT 20.0] then <macro statement>

system variable for the current position of Axis 1 in the machine

coordinate system

This fifth statement is evaluated based upon the position of X as 0.0, because the previous 4 lines of code have been preread and placed in the buffer, but have not yet been executed. The system variable for the current position of the X axis will not be updated until these lines of code have been executed, which is too late for the fifth line of code to evaluate as the programmer intended.

There is a workaround to this problem that avoids this problem. Simply program five “dummy” blocks of code before any macro statements involving system variables. Typically, we recommend the following for block delays:

G04 P10 G04 P10 G04 P10 G04 P10 G04 P10

This only delays code execution by 50 milliseconds, but avoids any problems caused by a delay in system variable value updating.

IF YOU DO NOT PROGRAM IN BLOCK DELAYS BEFORE STATEMENTS INVOLVING SYSTEM VARIABLES, YOU WILL GET UNEXPECTED RESULTS IN THE EXECUTION OF YOUR MACRO PROGRAMS.

CAUTION !

_____________________________________________________________________________________ 15-1

Page 112: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 15: Macro Statement Processing

15.2 Single Block and Optional Skip

Macro functions are executed by the SMP Motion Parser. Therefore, the blocks that set macro variable values cannot be executed with the operation support function switch Optional Skip, or there will be an error. Nor can the operation support function switch Single Block be effective for blocks that set macro variable values.

_____________________________________________________________________________________ 15-2

Page 113: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 16: Macro Examples: Automatic Tool Change (ATC)

Chapter 16: Macro Examples: Automatic Tool Change (ATC)

16.1 Overview

The following are examples of macros for automatic tool change (ATC) functions. NOTE: ATC achieved with a macro program is different than the GE Fanuc way. Fanuc supports the M06 code (Tool Change). Any time a tool change is required, an “M06T__” command is given inside a part program. This “M06T__” command activates either a macro program or a PLC sequence program, or both.

16.2 ATC – the SMP Way

For SMP products, ATC can be achieved without M06 codes, by using macros and PLC. First, write a macro program or a subprogram for tool change. This macro or subprogram includes motion commands, M codes and T codes. Then, in the part program, call that macro or subprogram each time you require a tool change. (Instead of just writing “M06T__” in the part program, as you would do with Fanuc.)

16.3 ATC Example #1: Simple ATC Function

An example part program and an example macro program follow:

#520=3 M98 P9006 G04 P1500 #520=5 M98 P9006 M02

Calls the tool change macro program

Calls the tool change macro program

Figure 16-1: Part Program That Calls the Macro Program O9006.dat

_____________________________________________________________________________________ 16-1

Page 114: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 16: Macro Examples: Automatic Tool Change (ATC)

M50 M5 G04 P1000 (SUB 9006 -- Tool Change) (X Tool change Position) #500 = -0.2294 (Y Safe Position: -2.0093) #501 = -2.0093 (Y Tool change Position: -0.3206) #502 = -0.3206 (Z Tool change Position) #503 = -3.8072 (Tool Spacing) #504 = 1.950 (General Feedrate) #506 = 200.0 (Z Safe Position) #507 = -2.000 G20 IF [#520 EQ #511] GOTO 100 IF [#520 EQ 0] GOTO 20 IF [#511 EQ 0] GOTO 10 N20 (Current Tool) #510 = #511 (Next Tool) #511 = #520 #508 = #500 + [#510-1]*#504 G00 G80 G90 G70 G44 G04 G53 Z0. G00 G53 X#508 Y#501 G00 G53 Z#503 G01 G53 Y#502 F#506 N10 M10 G04 P2000 (Open Collet) G00 G53 Z0. IF [#520 EQ 0] GOTO 100 (Current Tool) #510 = #511 (Next Tool) #511 = #520 #509 = #500 + [#511-1]*#504 G00 G53 X#509 Y#502 G00 G53 Z#507 G01 G53 Z#503 F#506 M11 G04 P2000 (Close Collet) G01 G53 Y#501 F#506 G00 G53 Z0. N100 (Error exit) M51 G04 P1000 M99 %

Figure 16-2: Macro Program O9006.dat

_____________________________________________________________________________________ 16-2

Page 115: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 16: Macro Examples: Automatic Tool Change (ATC)

16.4 ATC Example #2: ATC Using Customized G, M and T Codes

Following is an example of an ATC function that uses a customized G, M and T codes to trigger tool changes in the executing motion program. First, the macro function parameters are set as follows:

1) Set the “Macro Program Folder” to “C:\Program Files\SoftServo\SMP450\ncdata\Macro”

2) Set the “Output File Name” to “C:\Program Files\SoftServo\SMP450\ncdata\Macro\tempdata.dat”

3) Set the “T Code Setting” to “2222” (to refer to macro program O2222.dat)

4) Set the “M Code Setting” to “3.” (i.e. “M3.”) and “3333” (to refer to macro program O3333.dat)

5) Set the “G Code Setting” to “21.2” (i.e. “G21.2”) and “1111” (to refer to macro program O1111.dat)

Then, for each customized T, M or G code, you must write a customized macro program (.dat file) that resides in the macro program folder (C:\Program Files\SoftServo\SMP450\ncdata\Macro\ in this case). In this example, the customized macro programs are as follows:

G90 (absolute programming) G1 X-50.0 Y100.0 F2000 (linear interpolation command) X-50.00 Y-200.0 F4000 M99 (return to main program) %

Figure 16-3: Example O1111.dat File

G90 (absolute programming) X100.0 Y-200.0 X0.0 Y0.0 M99 (return to main program) %

Figure 16-4: Example O2222.dat File

G90 (absolute programming) M03 S1000 (spindle clockwise at 1000 RPMs) M99 (return to main program) %

Figure 16-5: Example O3333.dat File

Write a motion program file that uses these specialized T, M and G codes (G21.2, M03 and T20, in this example). One such example motion program follows:

_____________________________________________________________________________________ 16-3

Page 116: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 16: Macro Examples: Automatic Tool Change (ATC)

G53 X0.0 Y0.0 G92 X0.0 Y0.0 G021.2 X50.0 Y200.0 G1 X-50.0 Y100.0 F2000 X-50.005 Y-200.0 F4000 /G0 X-50.0 Y400.0 X100.0 Y100.0 X100.0 Y100.0 M03 G91G01 X50.0 Y0.002 F500.0 X-50.0 Y-0.001 G 0 X100.0 Y-0.001 G31 X-100.0 Y100.0 F2000.0 X100.0 Y100.0 G 4 P1000 G92 X50.0 Y20.0 G04 X2.0 G90X-100.0 Y400.0 X-50.0 Y100.0 T20 M1 X100.0 Y-200.0 \X-100.0 Y400.0 X0.0 Y0.0 M02 %

Figure 16-6: Example ATCTest.dat File

_____________________________________________________________________________________ 16-4

Page 117: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 16: Macro Examples: Automatic Tool Change (ATC)

When the “Enable Custom G/M/S/T Macro Calls” parameter is set to “Enabled,” the SMP Motion Parser searches the ATCTest.dat file before starting G code execution. It generates (creates) a temporary file (with the “Output File Name”, in this case C:\Program Files\SoftServo\SMP450\ncdata\Macro\tempdata.dat), in which every special T, M or G code is replaced with a G65 simple macro call to the specified macro program, and each macro program is appended to the “tempdata.dat” file as a subroutine, as shown:

G53 X0.0 Y0.0 G53 X0.0 Y0.0 G92 X0.0 Y0.0 G92 X0.0 Y0.0 G021.2 G65 P1111 X50.0 Y200.0 X50.0 Y200.0 G1 X-50.0 Y100.0 F2000 G1 X-50.0 Y100.0 F2000 X-50.005 Y-200.0 F4000 X-50.005 Y-200.0 F4000 /G0 /G0 X-50.0 Y400.0 X-50.0 Y400.0 X100.0 Y100.0 X100.0 Y100.0 X100.0 Y100.0 X100.0 Y100.0 M03 G65 P3333 G91G01 X50.0 Y0.002 F500.0 G91G01 X50.0 Y0.002 F500.0 X-50.0 Y-0.001 X-50.0 Y-0.001 G 0 X100.0 Y-0.001 G 0 X100.0 Y-0.001 G31 X-100.0 Y100.0 F2000.0 G31 X-100.0 Y100.0 F2000.0 X100.0 Y100.0 X100.0 Y100.0 G 4 P1000 G 4 P1000 G92 X50.0 Y20.0 G92 X50.0 Y20.0 G04 X2.0 G04 X2.0 G90X-100.0 Y400.0 G90X-100.0 Y400.0 X-50.0 Y100.0 X-50.0 Y100.0 T20 G65 P2222 T20 M1 M1 X100.0 Y-200.0 X100.0 Y-200.0 \X-100.0 Y400.0 \X-100.0 Y400.0 X0.0 Y0.0 X0.0 Y0.0 M02 M02 O1111 G90 G1 X-50.0 Y100.0 F2000 X-50.00 Y-200.0 F4000 M99 % O3333 G90 M03 S1000 M99 % O2222 G90 X100.0 Y-200.0 X0.0 Y0.0 M99 %

ATCTest.dat tempdata.dat

Figure 16-7: Example of ATC: Transformation of ATCTest.dat into the tempdata.dat File

The tempdata.dat file becomes the file actually executed by the SMP Motion Parser, NOT the ATCTest.dat file

_____________________________________________________________________________________ 16-5

Page 118: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Chapter 17: Direct Digital Output

Chapter 17: Direct Digital Output

Description Direct Digital Output is a feature that allows the user to set the value of a 16-bit region of the PLC output space using G code instead of the PLC ladder. The range of PLC output addresses that can be used with this feature is Y80-Y99. From this range, the user chooses a 2-byte region to be controlled by G code.

Required Format L

Parameters L – A 16-bit value to output to the chosen output address space. The range of valid values is 0 to 65535.

Direct Dout Address Parameter The NC parameter Direct Dout Address is used to specify the starting address of the 2-byte long region within the PLC output address space to control using Direct Digital Output. The range of valid values for this parameter is 80 to 98. For example, if Direct Dout Address is set to 81, the output address space Y81.0~Y82.7 will be the address space controlled by Direct Digital Output.

Other G Codes Which Affect Direct Digital Output Direct Digital Output can also be used in the same block as most other G codes. In this case, the digital output will be applied at the beginning of the G code block containing a Direct Digital Output (L) command. For example, if the G code block “G01 X100.0 F1000.0 L500” is executed, 500 will be output to the output address space at the same time that X starts moving. Direct Digital Output does not affect G codes that already use the letter L as a parameter, such as G10 and G65. When using these G codes, any instances of L in the G code block will not trigger Direct Digital Output.

Notes

• If you have an analog output device in the servo network, you can use this feature to output an analog voltage through G code. In this case, you need to set L to the digital output that corresponds to the analog voltage you want to output.

• Once you use this feature, the PLC will no longer control the affected output address space until you restart

the application. You will not be able to observe or process the output values through the PLC.

_____________________________________________________________________________________ 17-1

Page 119: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Index

Index

B axis absolute or incremental coordinate value designation........................................................ 2-1

# 10-2 % 3-1

block buffering ................................................ ii, 15-1 ( 3-2 block delete code ................................................... 3-1 ( ) 12-3 block end point .................................................... 11-7 [ ] 10-2, 10-3, 12-3, 13-3 block number ......................................................... 2-2 < 13-2 block of code .................................................. 1-1, 3-1 <= 13-2 block rollover....................................................... 6-42 = 13-2 blocks of code........................................................ 1-2 > 13-2 brackets............................. 9-3, 10-2, 10-3, 12-3, 13-3 >= 13-2 branching statements ........................................... 13-1 3D-DLACC ......................................................... 6-18 buffering ................................................. ii, 11-7, 15-1 3D-DLACC on/off................................................. 2-2 C 2-1 64-bit double precision floating point.................. 12-4 C axis absolute or incremental coordinate value

designation........................................................ 2-1 A 2-1 A axis absolute or incremental coordinate value

designation........................................................ 2-1 calling macro programs ....................................... 14-1 calling subprograms............................................. 14-1 absolute programming ......................................... 6-47 carriage return........................................................ 3-1 absolute value ............................................. 12-2, 12-5 case insensitive .................................................... 13-1 absolute values....................................................... 1-1 case sensitive ....................................................... 12-3 addition ................................................................ 12-1 center of the arc ..................................................... 6-9 additional reference point ...................................... 2-2 circular interpolation.............................................. 6-9 additional reference points................................... 6-28 circular path ........................................................... 6-9 address ................................................................... 1-1 clockwise circular interpolation............................. 6-9 address descriptions............................................... 2-1 coding system ........................................................ 1-1 address of tool length offset value ......................... 2-1 command position................................................ 11-7 advantages of macros............................................. 9-1 comment code........................................................ 3-2 allowable values for variables ............................. 10-4 comments...................................................... 3-1, 12-3 and ....................................................................... 12-3 comparison operators........................................... 13-2 angular displacement ............................................. 2-2 conditional branching .......................................... 13-3 approximation of variable values......................... 10-4 conditional execution........................................... 13-4 arc center modifier for the X axis .......................... 2-1 conditional execution with branching.................. 13-4 arc center modifier for the Y axis .......................... 2-1 conditional expressions........................................ 12-5 arc center modifier for the Z axis........................... 2-1

containing null/undefined variables ................ 10-5 arc center modifiers ............................................. 6-10 precision and errors......................................... 12-5 arc radius ............................................................... 6-9

conditional looping .............................................. 13-5 arc radius designation ................................... 2-2, 6-10 conditional statements ......................................... 13-2 arccosine .............................................................. 12-1 constant for exponential interpolation ................... 2-2 arcsine.................................................................. 12-1 constant helix angle ............................................. 6-16 arctangent ............................................................ 12-1

argument assignments..................................6-43, 14-2 continuous cutting mode...................................... 6-41 continuous cutting mode with block rollover ...... 6-41 argument specification......................................... 14-1 contour control on / off ........................................ 6-18 assigning arguments ............................................ 14-2 control shutdown ........................................ 10-1, 10-2 assignment ........................................................... 12-1 coordinate programming...................................... 6-48 ATC..................................................................... 16-1 coordinate system rotation................................... 6-44 automatic tool change.......................................... 16-1 coordinate system selection ........................ 6-38, 6-39 automatic zero return to / from the reference points 6-

26 coordinates........................................................... 6-47 cosine................................................................... 12-1 automatic zero return to additional reference points 6-

28 counterclockwise interpolation.............................. 6-9 custom G code macro calls .................................... 6-4 axis number ........................................................... 2-2 custom M code macro calls ................................... 7-1 axis type settings.................................................. 6-21 custom T code macro calls .................................... 8-2 B 2-1

_____________________________________________________________________________________ I

Page 120: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Index

exponential interpolation ..................................... 6-16 customized G code............................................. 14-11 expression, specifying variable numbers in ......... 10-2 customized G codes ............................................... 6-4 external workpiece zero point offset value .......... 6-39 customized M code............................................ 14-10 F 2-1 customized M codes .............................................. 7-1 F codes.......................................................... 1-1, 10-1 customized S code ............................................... 14-8 FALSE................................................................. 13-2 customized S, T, M or G codes............................ 14-5 feedrate ........................................................... 2-1, 3-1 customized T code ............................................... 14-9 file location of a macro program ................................ 14-1 customized T codes ............................................... 8-2 file location of a subprogram............................... 14-1 cutting mode ........................................................ 6-41 file scope..................................................... 10-1, 10-2 D 2-1, 6-31 floating point calculation ..................................... 10-4 D axis absolute or incremental coordinate value

designation........................................................ 2-1 floating point values ..................................... 1-1, 10-4 flow of control ..................................................... 13-1 data category................................................. 2-1, 6-20 format data index...................................................... 2-2, 6-20

IF ELSE ENDIF.............................................. 13-4 data input ............................................................. 6-25 IF GOTO......................................................... 13-3 data input categories ............................................ 6-20 IF THEN statement......................................... 13-4 data value............................................................... 2-2 WHILE DO END............................................ 13-5 data value for X axis.............................................. 2-2

format for distance and feedrate ............................ 3-1 data value for Y axis.............................................. 2-2 format for motion programs................................... 3-1 data value for Z axis .............................................. 2-2 format for variables ............................................. 10-2 decimal point ................................................ 3-1, 10-4 format of a macro program.................................... 9-1 default mode .......................................................... 6-1 format requirements............................................... 9-3 definition of macro programming.......................... 9-1 formulas containing undefined variables ............. 10-4 degrees................................................................. 12-2 G 2-1 delay blocks ..................................................... ii, 15-1 G code settings .................................................. 14-11 delay in program execution ................................. 6-17 G codes ......................................................... 1-1, 10-1 desired position.................................................... 11-7

summary ........................................................... 6-2 difference............................................................. 12-1 G codes, customized ..................................... 6-4, 14-5 direct digital output....................................... 2-1, 17-1 G00 ........................................................................ 6-5 direct dout address ............................................... 17-1 G00 perform linear interpolation .................... 6-6, 6-7 directly referencing variables .............................. 10-3 G00.1 ..................................................................... 6-7 distance......................................................... 3-1, 10-1 G01 ........................................................................ 6-8 division ................................................................ 12-1 G02 ......................................................6-9, 6-14, 6-25 division by zero ................................................... 12-5 G02.3 .......................................................... 6-16, 6-25 double precison floating point ............................. 12-4 G03 ......................................................6-9, 6-14, 6-25 double-precision-floating-point-values................ 10-4 G03.3 .......................................................... 6-16, 6-25 duplicate parameters .............................................. 1-2 G04 ...................................................................... 6-17 dwell .................................................................... 6-17 G04 blocks, extra............................................. ii, 15-1 dwell time .............................................................. 2-2 G05 ...................................................................... 6-18 dwell time in seconds ............................................ 2-2 G08 ...................................................................... 6-18 dynamic look-ahead contour control on / off....... 6-18 G10 ...................................................................... 6-20 E 2-1 G17 ...................................................................... 6-10 E axis absolute or incremental coordinate value

designation........................................................ 2-1 G17, G18 and G19............................................... 6-25 G18 ...................................................................... 6-10 end code for macro programs ................................ 9-2 G19 ...................................................................... 6-10 end point feedrate for exponential interpolation.... 2-2 G20, G21 ............................................................. 6-25 EQ........................................................................ 13-2 G20/21 ................................................................... 1-1 equal to ................................................................ 13-2 G28, G29 ............................................................. 6-26 equals................................................................... 12-1 G30 ...................................................................... 6-28 error allowance of the circular motion.......... 2-2, 6-10 G31 ...................................................................... 6-29 errors.................................................................... 12-4

evaluation of conditional statements.................... 13-2 G310, G311 ......................................................... 6-48 G40, G41 and G42............................................... 6-31 exact stop check mode......................................... 6-41

example of a macro.............................................. 16-1 G40, G41 or G42 ................................................... 8-1 exponent .............................................................. 12-1 G43, G44 ............................................................... 8-1

G43, G44, G49 .................................................... 6-32 exponential function ............................................ 12-3

_____________________________________________________________________________________ 17-II

Page 121: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Index

K 2-1 G50, G51 ............................................................. 6-34 L 2-1 G50.1, G51.1 ....................................................... 6-36 L10 – tool length compensation .......................... 6-20 G52 ...................................................................... 6-38 L106 – smoothing (acc/dec) mode settings for rapid

motion (G00) .................................................. 6-22 G53 ...................................................................... 6-39 G54-G59.............................................................. 6-40

L107 – smoothing (acc/dec) mode settings for cutting motion (G01) .................................................. 6-22

G6.6 PLC skip signal........................................... 6-29 G61 ...................................................................... 6-41

L108 – smoothing (acc/dec) time settings ........... 6-23 G64 ...................................................................... 6-41 L10909 – position loop gain settings................... 6-23 G64.1 ................................................................... 6-41 L11 – tool radius compensation........................... 6-20 G65 ...................................................................... 6-43 L20 – axis type settings ....................................... 6-21 example........................................................... 14-3 L30 – in position width........................................ 6-21 format.............................................................. 14-3 LadderWorks PLC sequence program................... 7-1 limitations ....................................................... 14-4 language for macro programming ......................... 9-1 G68, G69 ............................................................. 6-44 LE ........................................................................ 13-2 G90 ............................ 6-6, 6-8, 6-10, 6-27, 6-30, 6-37 length geometry offset ........................................... 8-1 G90, G91 ............................................................. 6-47 length of a block of code ....................................... 1-3 G91 ............................ 6-6, 6-8, 6-10, 6-27, 6-30, 6-37 length of variable name ....................................... 10-2 G92 ...................................................................... 6-48 length wear offset .................................................. 8-1 G-code motion programming ................................ 1-1 less than ............................................................... 13-2 GE........................................................................ 13-2 less than or equal to ............................................. 13-2 general format requirements .................................. 9-3 linear interpolation........................................ 6-8, 6-47 geometry offset ...................................................... 8-1 linear interpolation feedrate include / exclude rotary

axes ................................................................. 6-48 global variables

numbered ........................................................ 10-1 local coordinate system selection ........................ 6-38 symbolic.......................................................... 10-1 local scope ........................................................... 10-1 GOTO statement.................................................. 13-1 local variables...................................................... 10-1 greater than .......................................................... 13-2 logarithm.............................................................. 12-3 greater than or equal to ........................................ 13-2 logical operations........................................ 12-1, 12-3 GT........................................................................ 13-2

precision and errors......................................... 12-4 H 2-1 look-ahead function ............................................. 6-18 handling a null variable ....................................... 10-4 looping................................................................. 13-5 helical interpolation ............................................. 6-14 looping, infinite .......................................... 13-7, 13-8 helix angle ........................................................... 6-16 lower case ..........................................10-1, 10-2, 13-1 helix angle in exponential interpolation................. 2-1 lower case letters ................................................... 3-1 high-speed, precision machining ......................... 6-18 LT ........................................................................ 13-2 I 2-1 m 13-5 IF ELSE ENDIF M 2-1 nesting............................................................. 13-6 M code processing ................................................. 7-1 IF ELSE ENDIF statement .................................. 13-4 M code settings.................................................. 14-10 IF GOTO statement ............................................. 13-3 M codes .................................................1-1, 7-1, 10-1 IF statement ......................................................... 13-3 M codes, customized ........................................... 14-5 IF THEN statement.............................................. 13-4 M00 ....................................................................... 7-1 ignoring referenced variables .............................. 10-5 M01 ....................................................................... 7-1 in position width .................................................. 6-21 M02 ................................................................ 3-1, 7-1 inch / metric data input ........................................ 6-25 M30 ................................................................ 3-1, 7-1 incremental programming.................................... 6-47

index number for variables .................................. 10-2 M98 .......................................................5-1, 7-1, 14-1 individual axis magnification factor .................... 6-35 M99 ...................................... 5-1, 7-1, 9-2, 13-8, 14-4 infinite loops............................................... 13-7, 13-8 machine coordinate system.................................. 11-7 initial feedrate for exponential interpolation.......... 2-1 machine coordinate system selection................... 6-39 in-position check.................................................. 6-41 machine origin ..................................................... 6-48 instruction .............................................................. 1-1 machine position.................................................. 11-7 Integer Programming with Machine Unit Enable.. 1-1 machine unit .......................................................... 1-1 integer values......................................................... 1-1 macro call ............................................................ 6-43 integers .................................................................. 1-1 macro call nesting................................................ 14-4 J 2-1 macro number........................................................ 2-2

_____________________________________________________________________________________ 17-III

Page 122: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Index

no interpolation...................................................... 6-5 Macro Program Folder (Full Path) ...................... 14-6 NO_SMOOTHING ............................................. 6-22 macro programs nonmodal ............................................................... 6-1 calling ............................................................. 14-1 nonmodal codes ..................................................... 6-1 end code ............................................................ 9-2 non-zero value ..................................................... 13-2 format................................................................ 9-1

location of file ..................................................... 14-1 not........................................................................ 12-3 types of variables ............................................ 10-1 not equal to .......................................................... 13-2

macro statement processing................................. 15-1 null variable ................................................ 10-1, 10-4 in a conditional expression.............................. 10-5 macros

advantages......................................................... 9-1 in a mathematical formula .............................. 10-4 definition........................................................... 9-1 in a movement command ................................ 10-5

number of repetitions............................................. 5-1 difference from motion programming statements9-2 number of times for execution............................. 14-1

number of times to repeat macro ........................... 2-1 difference from simple NC subprograms.......... 9-1 number of workpiece coordinate system to select . 2-2 magnification.............................................. 6-34, 6-35

mathematical formulas with null values .............. 10-4 numbered global variables................................... 10-1 numbered permanent variables ............................ 10-2 mathematical operations ...................................... 12-1 numeral .................................................................. 1-1 precision and errors......................................... 12-4

maximum acceleration/deceleration rate parameter 6-7

numerals ................................................................ 1-1 numeric interpretation............................................ 1-2 numeric value ...................................................... 13-2 maximum length of a block of code ...................... 1-3

maximum length of variable name ...................... 10-2 O 5-1 offset number......................................................... 8-1 meaningful variable naming ................................ 10-1 offset value ............................................................ 8-1 mirror image ............................................... 6-31, 6-35

mirror image off / on ........................................... 6-36 one-shot codes ....................................................... 6-1 Optional Skip....................................................... 15-2 miscellaneous codes .............................................. 7-1 optional skip code.................................................. 3-2 miscellaneous function .......................................... 2-1

miscellaneous functions......................................... 1-1 or 12-3 order of operations........................................ 4-1, 12-4 modal commands................................................... 6-1

modal group........................................................... 6-1 Output File Name (Full Path) .............................. 14-7 modal groups ......................................................... 6-1 overall magnification factor................................. 6-35

overlapping WHILE DO END ranges ................. 13-7 modal information, system variables ................... 11-5 mode ...................................................................... 6-1 P 2-2

parameter assignments......................................... 14-2 Motion Parser ...................................................... 15-2 parentheses ..................................................... 3-2, 9-3 motion program format.......................................... 3-1

motion programming language..............1-1, 9-1, 10-1 permanent scope .................................................. 10-2 permanent variables............................................. 10-2 motion programming statements ........................... 9-2 plane selection ..................................................... 6-25 movement commands containing undefined variables

........................................................................ 10-5 PLC interface with system variables .......... 11-2, 11-3 PLC sequence program.......................................... 7-1 movement commands with null values................ 10-5 PLC skip signal.................................................... 6-29 multiplication....................................................... 12-1

n 13-1 position ................................................................ 10-1 position information with system variables ......... 11-7 N 2-2 position loop gain settings ................................... 6-23 N codes ......................................................... 1-1, 10-1

naming of variables ............................................. 10-1 position loop gain value......................................... 2-2 natural logarithm ................................................. 12-3 positive exponential interpolation........................ 6-16 NE........................................................................ 13-2 positive/negative tool length compensation/

compensation cancel ....................................... 6-32 negative exponential interpolation....................... 6-16 negative numbers................................................... 3-1 power ................................................................... 12-1 negative variable values....................................... 10-3 powering off ............................................... 10-1, 10-2 nesting ........................................................ 12-4, 13-6 precision ..................................................... 10-4, 12-4

macro calls ...................................................... 14-4 precision machining............................................. 6-18 nesting depth........................................................ 14-4 preparatory codes................................................... 1-1 nesting depth of subprogram calls ......................... 5-2 preparatory function .............................................. 2-1 nesting of calls .................................14-8, 14-9, 14-10 preparatory functions............................................. 6-1 nesting, unacceptable........................................... 13-7 preread function...................................... ii, 11-7, 15-1

_____________________________________________________________________________________ 17-IV

Page 123: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Index

sharp edges .......................................................... 6-42 priority of operations ........................................... 12-4 shrinking.............................................................. 6-34 processing a null variable .................................... 10-4 sign ...................................................................... 12-1 processing an uninitialized variable..................... 10-4 simple macro call...............................6-43, 14-1, 14-3 processing of macro statements ........................... 15-1 Single Block mode........................................ 9-2, 15-2 product................................................................. 12-1 skip cutting .......................................................... 6-29 program end........................................................... 7-1 skip signal............................................................ 6-29 program end and rewind ........................................ 7-1 small segment contour control............................. 6-41 program end code .................................................. 3-1 SMOOTH_BELLSHAPE.................................... 6-22 program execution errors................................. ii, 15-1 SMOOTH_EXPONENTIAL............................... 6-22 program format ...................................................... 3-1 SMOOTH_LINEAR............................................ 6-22 program number .................................................... 3-1 smoothing (acc/dec) mode settings for cutting motion

(G01)............................................................... 6-22 program optional stop............................................ 7-1 program position.................................................. 11-7

smoothing (acc/dec) mode settings for rapid motion (G00)............................................................... 6-22

program rewind ..................................................... 7-1 program temporary stop......................................... 7-1

smoothing (acc/dec) time settings ....................... 6-23 program title .......................................................... 3-1 smoothing mode .................................................... 2-2 programmable data input ..................................... 6-20 smoothing time ...................................................... 2-2 programming ......................................................... 1-1 SMP Motion Parser ............................................. 15-2 programming delay blocks ....................................... ii SMP motion programming language.....1-1, 9-1, 10-1 Q 2-2 space required between keywords and values ....... 9-3 quotient ................................................................ 12-1 specifying variables ............................................. 10-2 R 2-2, 14-1 specifying variables in an expression .................. 10-2 radians ................................................................. 12-2 spiral .................................................................... 6-14 radius compensations........................................... 6-31 square root ........................................................... 12-2 radius geometry offset ........................................... 8-1 storage of variable values .................................... 10-4 radius wear offset................................................... 8-1 subprogram call from a main program .................. 7-1 range of execution ............................................... 13-5 subprogram functions ............................................ 5-1 rapid feedrate .................................................. 6-6, 6-7 subprogram name .................................................. 5-1 rapid positioning.................................................... 6-5 subprogram name call............................................ 2-2 rapid positioning of a tool...................................... 6-7 subprogram name calls ........................................ 10-3 rapid traverse rate .................................................. 6-5 subprogram repetition............................................ 2-2 rapid traverse with specified acceleration/deceleration

rate .................................................................... 6-7 subprograms .......................................................... 9-1 calling ............................................................. 14-1 reference points .......................................... 6-26, 6-28 location of file................................................. 14-1 referencing variables............................................ 10-3

subtraction ........................................................... 12-1 referencing variables in an expression................. 10-3 sum ...................................................................... 12-1 registry................................................................. 10-2 summary of G codes .............................................. 6-2 repeated callings .................................................... 5-2 symbolic global variables .................................... 10-1 repetition statements ............................................ 13-1 symmetrical part .................................................. 6-36 requirements, formatting ....................................... 9-3 system variable evaluation............................... ii, 15-1 return to main program.......................................... 7-1 system variables.......................................... 10-2, 11-1 reversing the sign of a variable value .................. 10-3

for interfacing with the PLC .................. 11-2, 11-3 rewind.................................................................... 7-1 for position information .................................. 11-7 rounding...................................................... 12-2, 12-5 for timers......................................................... 11-4 rounding of referenced variables ......................... 10-4 for tool compensation ..................................... 11-4 S code setting....................................................... 14-8 for workpiece coordinates............................... 11-8 S codes................................................................. 10-1

systems variables scaling......................................................... 6-31, 6-37 for modal information..................................... 11-5 scaling factor for all axes....................................... 2-2

T 2-2 scaling factor for X axis......................................... 2-1 T code setting ...................................................... 14-9 scaling factor for Y axis......................................... 2-1 T codes ..................................................1-1, 8-1, 10-1 scaling factor for Z axis ......................................... 2-1

scaling off / on ..................................................... 6-34 T codes, customized ............................................ 14-5 separate line ........................................................... 1-2 tangent ................................................................. 12-1 sequence number ...................................1-1, 2-2, 13-1 taper angle in exponential interpolation................. 2-1 sequence program.................................................. 7-1 tapered groove machining.................................... 6-16

_____________________________________________________________________________________ 17-V

Page 124: SMP Motion Programming Manual - Soft Servosoftservo.com/wp-content/Documentation/122_SMP_Motion... · 2016. 9. 15. · SMP MOTION PROGRAMMING MANUAL Warning / Important Notice Warning

SMP MOTION PROGRAMMING MANUAL Index

index number .................................................. 10-2 three-dimensional dynamic look-ahead contour control on / off ................................................ 6-18 local ................................................................ 10-1

null .................................................................. 10-1 timers, system variables....................................... 11-4 numbered global ............................................. 10-1 to the power of..................................................... 12-1 numbers........................................................... 10-2 tool compensation................................................ 11-7 permanent ....................................................... 10-2 tool compensation system variables .................... 11-4 referencing ...................................................... 10-3 tool function........................................................... 2-2 referencing in an expression ........................... 10-3 tool functions ......................................................... 8-1 specifying........................................................ 10-2 tool length compensation..................................... 6-20 symbolic.......................................................... 10-1 tool length compensation/ compensation cancel.. 6-32 system .................................................... 10-2, 11-1 tool length offset.................................................. 6-32 write-protected................................................ 11-7 tool length offset type .......................................... 6-32

wear offset ............................................................. 8-1 tool offsets ............................................................. 8-1 WHILE DO END tool radius compensation ...................6-20, 6-35, 6-37

nesting............................................................. 13-6 Tool Radius Compensation.................................... 8-1 WHILE DO END statement ................................ 13-5 tool radius compensations.................................... 6-31 Windows registry................................................. 10-2 tool radius offset .................................................. 6-31 word....................................................................... 1-1 Tool Radius Offset................................................. 8-1 word address........................................................ 10-3 tool selection command ......................................... 1-1 words ..................................................................... 1-1 TRC .............................................................. 6-31, 8-1 workpiece ............................................................ 6-48 trigonometric functions........................................ 12-1 workpiece coordinate programming .................... 6-48 TRUE................................................................... 13-2 workpiece coordinate selection............................ 6-40 types of macro variables ...................................... 10-1 workpiece coordinate system...................... 6-38, 11-7 unacceptable nesting............................................ 13-7 workpiece coordinates with system variables...... 11-8 unacceptable parameters for circular interpolation.. 6-

13 workpiece zero point offset value........................ 6-39 write-protected variables ..................................... 11-7 unconditional branching ...................................... 13-1 X 2-2 undefined variables.............................................. 10-4 X axis absolute or incremental coordinate value

designation........................................................ 2-2 unexplained macro execution .......................... ii, 15-1 uninitialized variables.......................................... 10-4

X axis tool length compensation............................ 2-2 unlimited nesting ................................................. 13-6 xor........................................................................ 12-3 unused data ............................................................ 3-2 XY/ZX/YZ plane selection.................................. 6-25 upper case ............................................................ 13-1 Y 2-2 variable naming ................................................... 10-1 Y axis absolute or incremental coordinate value

designation........................................................ 2-2 maximum length ............................................. 10-2

variable values ..................................................... 10-1 Y axis tool length compensation............................ 2-2 allowable......................................................... 10-4 Z 2-2 negative........................................................... 10-3 Z axis absolute or incremental coordinate value

designation........................................................ 2-2 precision.......................................................... 10-4 rounding.......................................................... 10-4

Z axis tool length compensation ............................ 2-2 saved in Windows registry.............................. 10-2 zero point ............................................................. 6-48 variables............................................................... 10-2 zero value............................................................. 13-2 description of types......................................... 10-1 zero, division by .................................................. 12-5 directly referencing ......................................... 10-3

format.............................................................. 10-2

_____________________________________________________________________________________ 17-VI