ACSPL Programmer Guide
ACSPL Programmer Guide
Programmer's Guide
September 2020
Document Revision: 3.02
ACSPL+ Programmer's Guide
ACSPL+
COPYRIGHT
Changes are periodically made to the information in this document. Changes are published as release notes and later
incorporated into revisions of this document.
No part of this document may be reproduced in any form without prior written permission from ACS Motion Control.
TRADEMARKS
ACS Motion Control, SPiiPlus, PEG, MARK, ServoBoost, NetworkBoost and NanoPWN are trademarks of ACS Motion Control Ltd.
EtherCAT is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
Any other companies and product names mentioned herein may be the trademarks of their respective owners.
www.acsmotioncontrol.com
support@acsmotioncontrol.com
sales@acsmotioncontrol.com
NOTICE
The information in this document is deemed to be correct at the time of publishing. ACS Motion Control reserves the right to
change specifications without notice. ACS Motion Control is not responsible for incidental, consequential, or special damages of
any kind in connection with using this document.
Version 3.02 2
ACSPL+ Programmer's Guide
Revision History
Date Revision Description
September
3.02 Remove reference to obsolete SPiiPlus PCI device
2020
November
2.29.10 XSEG updated for new features.
2015
Version 3.02 3
ACSPL+ Programmer's Guide
Format Description
Monospace + grey
Code example
background
Blue Hyperlink
Flagged Text
Warning - describes a condition that may result in serious bodily injury or death.
Version 3.02 4
ACSPL+ Programmer's Guide
Related Documents
Documents listed in the following table provide additional information related to this document.
The most updated version of the documents can be downloaded by authorized users from
www.acsmotioncontrol.com/downloads.
Online versions for all ACS software manuals are available to authorized users at ACS Motion Control
Knowledge Center.
Document Description
SPiiPlus MMI Application Explains how to use the SPiiPlus MMI Application Studio and
Studio User Guide associated monitoring tools.
SPiiPlus C Library
C++ and Visual Basic® libraries for host PC applications. This guide
Reference Programmer
is applicable for all the SPiiPlus motion control products.
Guide
SPiiPlus COM Library COM Methods, Properties, and Events for Communication with
Programmer's Guides the Controller.
SPiiPlus .NET Library .NET Methods, Properties, and Events for Communication with
Programmer's Guide the Controller.
SPiiPlus Utilities User A guide for using the SPiiPlus User Mode Driver (UMD) for setting
Guide up communication with the SPiiPlus motion controller
SPiiPlusNT-DC
Technical description of the SPiiPlusNT-DC product line.
Hardware Guide
PDMNT Product Guide Technical description of the PDMNT Universal Drive Module
SDMNT Product Guide Technical description of the SDMNT Universal Drive Module
UDMNT Installation
Technical description of the UDMNT Universal Drive Module
Guide
HSSI Expansion High-Speed Synchronous Serial Interface (HSSI) for expanded I/O,
Modules Guide distributed axes, and nonstandard devices.
Version 3.02 5
ACSPL+ Programmer's Guide
Table of Contents
1. Introduction 25
1.1 ACSPL+ Programming Language 25
2. SPiiPlus Architecture 26
2.1 Hardware Structure 26
2.1.1 Firmware 27
2.1.2 Controller Cycle and Servo Tick 27
2.1.3 Realtime and Background Tasks 27
2.2 User Application 29
2.2.1 Firmware, User Application and Tools 29
2.2.2 User Application Components 29
2.2.3 User Applications Categories 30
2.2.4 SPiiPlus MMI Application Studio 30
2.2.5 File Extensions Used in SPiiPlus MMI Application Studio 32
2.3 Programming Resources 32
2.3.1 Commands 32
2.3.2 Program Buffers 33
2.3.2.1 ACSPL+ Buffers Compilation Behavior 34
2.3.3 Declaration Buffer (D-Buffer) 34
2.3.3.1 Defining Global Objects in D-Buffer 34
2.3.3.2 D-Buffer Default Contents 34
2.3.4 Command Execution 35
2.3.4.1 Terminal Commands 35
2.3.4.2 ACSPL+ Commands 35
2.3.5 ACSPL+ Standard Variables 36
2.3.6 User-Defined Variables 36
2.3.7 Nonvolatile Memory and Power Up Process 36
2.4 Executing ACSPL+ Programs 37
2.4.1 Program Buffers 37
2.4.2 Execution of a Single Program 37
2.4.3 Concurrent Execution 38
2.4.4 Immediate Execution 38
2.4.5 Immediate Execution vs. Stored Program 39
Version 3.02 6
ACSPL+ Programmer's Guide
Version 3.02 7
ACSPL+ Programmer's Guide
Version 3.02 8
ACSPL+ Programmer's Guide
Version 3.02 9
ACSPL+ Programmer's Guide
Version 3.02 10
ACSPL+ Programmer's Guide
Version 3.02 11
ACSPL+ Programmer's Guide
Version 3.02 12
ACSPL+ Programmer's Guide
Version 3.02 13
ACSPL+ Programmer's Guide
Version 3.02 14
ACSPL+ Programmer's Guide
Version 3.02 15
ACSPL+ Programmer's Guide
Version 3.02 16
ACSPL+ Programmer's Guide
Version 3.02 17
ACSPL+ Programmer's Guide
Version 3.02 18
ACSPL+ Programmer's Guide
Version 3.02 19
ACSPL+ Programmer's Guide
List Of Figures
Figure 2-1. SPiiPlus Controller Hardware Structure 26
Figure 2-2. Multiple SPs Connected via EtherCAT 27
Figure 2-3. The Internal Structure of the Controller Cycle 28
Figure 2-4. User Application Block Diagram 29
Figure 2-5. SPiiPlus MMI Application Studio Main Screen 31
Figure 2-6. Communication Terminal Window 33
Figure 4-1. GRTIME Behavior in PTP or TRACK Motion 107
Figure 4-2. Corner Processing - Exact Path Option 127
Figure 4-3. Corner Processing - Permitted Deviation, Permitted Radius and Corner Rounding
Options 127
Figure 4-4. Third-Order Velocity Profile 129
Figure 4-5. Primary Axes Motion 149
Figure 4-6. Secondary Axes Motion 150
Figure 4-7. Example of motion with segment commands 162
Figure 6-1. The Use of Limit Switches 215
Figure 6-2. Use of Variables in a Typical Motion Profile 219
Figure 6-3. 32-bit Error Data Number 234
Figure 6-4. Fault Examination Flow Chart 235
Figure 7-1. SPiiPlus-Plant Connections and Related Parameters 239
Figure 8-1. PEG Engines Output Mapping 262
Figure 8-2. Simultaneous Connection for Remote Support 308
Figure 8-3. UMD Log Settings - Dump on Request 311
Figure 8-4. UMD Log Settings - Continuous 312
Figure 8-5. Data Entry Dialog 338
Figure 8-6. Screen at the Conclusion of Calculation 339
Figure 8-7. Window Accessed by Download 340
Figure 8-8. Insensitivity Curve Illustration 342
Figure 8-9. Insensitivity Curve without Robust 344
Figure 8-10. Example 1 of Using DRA 346
Figure 8-11. Example 2 of using DRA (zoomed) 346
Figure 8-12. Example of Velocity Error 348
Figure 8-13. Bi-Quad Configured as a Notch Filter 349
Version 3.02 20
ACSPL+ Programmer's Guide
Version 3.02 21
ACSPL+ Programmer's Guide
List of Tables
Table 2-1. SPiiPlus MMI Application Studio Extensions 32
Table 3-1. Example of the possible index formats. 53
Table 3-2. Mathematical Operators 69
Table 4-1. Motor Modes 173
Table 6-1. Types of Malfuntions 187
Table 6-2. Faults and the Controller's Default Response 190
Table 6-3. Safety Inputs 197
Table 6-4. Safety Related Variables 197
Table 8-1. Minimum HW Revision that supports Position Events Generation (PEG)
Improvements 254
Table 8-2. Commands Associated with Incremental PEG 255
Table 8-3. Commands Associated with Random PEG 257
Table 8-4. Typical Times to Load PEG Engines for the products that support fast loading of
Random PEG arrays 259
Table 8-5. Typical Times to Load PEG Engines for the products that do not support fast
loading of Random PEG arrays 260
Table 8-6. SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping PEG Engines to Encoders
(Servo Processor 0) 264
Table 8-7. SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping PEG Engines to Encoders
(Servo Processor 1) 265
Table 8-8. SPiiPlus CMnt-x/UDMpm-x/UDMpc-x/CMba-x/CMhp-x/UDMba-x/UDMhp-x/CMhv-
x/UDMhv-x/UDMnt-x/UDMpa-x/UDMcb-x Mapping PEG Engines to Encoders (Servo
Processor 0) 266
Table 8-9. UDMlc-x/UDIlt-x/UDIhp-x/UDMmc-x/PDIcl-x/ Mapping PEG Engines to Encoders
(Servo Processor 0) 267
Table 8-10. NPMpm-x/NPMpc-x Mapping PEG Engines to Encoders (Servo Processor 0) 267
Table 8-11. SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x General Purpose Outputs Assignment
for Use as PEG Pulse Outputs (Servo Processor 0) 268
Table 8-12. SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x General Purpose Outputs Assignment
for Use as PEG Pulse Outputs (Servo Processor 1) 269
Table 8-13. SPiiPlus CMnt-x/UDMpm-x/CMhv-x/UDMhv-x General Purpose Outputs
Assignment for Use as PEG Pulse Outputs (Servo Processor 0) 270
Table 8-14. UDMnt-x/UDMpa-x/UDMcb-x General Purpose Outputs Assignment for Use as
PEG Pulse Outputs (Servo Processor 0) 270
Version 3.02 22
ACSPL+ Programmer's Guide
Table 8-15. Engine to Encoder Assignment for IDMsm, ECMsm, and UDMsm 271
Table 8-16. SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical
Outputs (Servo Processor 0 274
Table 8-17. SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical
Outputs (Servo Processor 1) 275
Table 8-18. CMnt-x/UDMpm-x/UDMpc-x/CMhv-x/UDMhv-x Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0) 276
Table 8-19. CMnt-x/UDMpm-x/UDMpc-x/CMhv-x/UDMhv-x Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0) 276
Table 8-20. CMba-x/CMhp-x/UDMba-x/UDMhp-x Mapping of Engine Outputs to Physical
Outputs (Servo Processor 0) 277
Table 8-21. CMba-x/CMhp-x/UDMba-x/UDMhp-x Mapping of Engine Outputs to Physical
Outputs (Servo Processor 0) 278
Table 8-22. UDMnt-x/UDMpa-x/UDMcb-x Mapping of Engine Outputs to Physical Outputs
(Servo Processor 0) 279
Table 8-23. UDMlc-x/UDMmc-x/UDIlt-x/UDIhp-x/PDIcl-x Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0) 279
Table 8-24. NPMpm-x/NPMpc-x Mapping of Engine Outputs to Physical Outputs (Servo
Processor 0) 280
Table 8-25. IDMsm/UDMsm/ECMsm Mapping of Engine Outputs to Physical Outputs (Servo
Processor 0) 281
Table 8-26. PEG Output Signal Configuration 289
Table 8-27. Mark-1 Inputs to Encoders Mapping for SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-
x 293
Table 8-28. Mark-2 Inputs to Encoders Mapping for SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-
x 295
Table 8-29. Mark-1 and Mark-2 Inputs to Encoders Mapping for with SPiiPlus CMnt-
x/UDMpm-x/UDMpc-x/CMba-x/CMhp-x/UDMba-x/UDMhp-x/CMhv-x/UDMhv-x 296
Table 8-30. Variables and Functions for Hall Support 306
Table 8-31. Hardware Interrupt Callback Conditions 309
Table 8-32. String Format Type 317
Table 8-33. Channel Number Argument 320
Table 8-34. Trigger Bit and Interrupt for each Channel 323
Table 8-35. AST Bit Descriptions 333
Table 9-1. ECST Bits 353
Table 9-2. EtherCAT Error Codes 354
Table 9-3. Supported Error Counter Registers 358
Version 3.02 23
ACSPL+ Programmer's Guide
Version 3.02 24
ACSPL+ Programmer's Guide
1. Introduction
1. Introduction
This guide provides a general overview for programming the SPiiPlus™ motion controller products
using the ACSPL+ programming language.
The term “controller” is used in this guide whenever information applies for both
controllers and control modules. If information applies to only one of these product
groups, the group is stated explicitly.
Version 3.02 25
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
2. SPiiPlus Architecture
This chapter provides an overview the SPiiPlus architecture.
The Motion Processing Unit (MPU), which executes most of the controller tasks, is a powerful x86
processor. The MPU is an EtherCAT bus master and the Servo Processors (SP) are EtherCAT slaves.
One master can control several slaves.
The master MPU runs compiled ACSPL+ programs and generates motion profiles to the SPs. Its
principle tasks are:
> Communication with the SPs
> Motion profile generation (calculation of APOS)
> Calculation of Reference Position (RPOS)
> Safety control
> Data collection
> Position Event Generation (PEG)
> Processing of Index and Mark inputs
> Execution of ACSPL+ programs
> Communicating to Serial Link or Ethernet
> Execution of Immediate commands received from the Host
> Housekeeping
The MPU is equipped with a Flash (nonvolatile) memory that retains the stored data after the
power to the controller is turned off.
The SP executes the realtime tasks, such as implementation of the realtime control algorithms.
Each SP controls four axes. The SP includes all the necessary peripherals that are needed for a high
performance axis control.
A single MPU module can manage several units over the EtherCAT bus thus expanding the number
of controlled axes. For example,
Version 3.02 26
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
The part of the system that is connected to the rest of the system via the EtherCAT bus
is called a UNIT.
2.1.1 Firmware
The firmware consists of a set of files factory-written in the flash memory.
You cannot erase or modify the firmware; however, you are able to update the firmware version
with a special tool that is part of the SPiiPlus MMI that is supplied with the controller.
The firmware files include the following:
> MPU program.
> Default values of the controller’s configuration variables.
The following MPU tasks are the realtime tasks that are executed each controller cycle:
> Communication with the SPs
> Motion profile generation (calculation of APOS)
> Calculation of Reference Position (RPOS)
> Safety control
> Data collection
> Position Event Generation (PEG)
Version 3.02 27
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
Background tasks are not synchronous with the MPU interrupt. Execution of a background
task may overlap two or more controller cycles.
The following MPU tasks are the background tasks and are asynchronous to the controller
cycle:
> Communicating to Serial Link or Ethernet
> Execution of Immediate commands received from the Host
> Housekeeping
The MPU interrupt invokes the realtime tasks. When all realtime tasks required in the current cycle
are completed, the controller starts executing the background tasks. If the background tasks
complete before the next MPU interrupt occurs, the controller remains idle for the rest of the cycle.
The exact time of the realtime and background tasks in each controller cycle depends on many
factors and cannot be precisely specified. The following paragraphs explain different situations in
controller cycle utilization.
If the background task execution does not finish in one controller cycle, the background execution
is interrupted and continues after execution of the realtime tasks during the next cycle. Therefore,
background tasks may overlap into the next MPU interrupt without causing a problem. However,
overflow of realtime tasks into the next MPU interrupt is abnormal, and may cause problems with
program execution. When this occurs, the controller latches the TIME OVERUSE fault. This fault has
no default response in the controller, but your application can monitor the fault and define a
proper response.
You can monitor if the usage of the controller cycle is close to critical. The SPiiPlus MMI
Application Studio Communication Terminal command: #Uwhen entered, reports the
usage as a ratio of realtime tasks execution time and the controller cycle. A maximum
value of 90% is considered dangerous. If the usage limit is reached, you have to modify
your application.
Version 3.02 28
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
Version 3.02 29
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
program. There are 10 buffers for ACSPL+ programs. An ACSPL+ program is executed
inside the controller with strict timing and with no communication delay.
ACSPL+ programs are almost always present in user applications. Occasionally, the ACSPL+
programs are absent and the host commands all controller actions.
> Configuration variables:
The firmware includes a set of predefined variables that can be used by ACSPL+ programs
and by Immediate commands. The configuration variables are included in this set. The
values of the configuration variables are defined by the user to tailor the controller
operation to a specific task and plant control. For example, ACC defines the acceleration
that is used for motion generation. The SAFINI variable defines the polarity of the input
safety signals.
The configuration variables must always be present in user applications.
> SP programs:
The firmware includes SP (Servo Processor) real time control programs as a standard part
of the controller.
Version 3.02 30
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
The main features of the SPiiPlus MMI Application Studio are, amongst others:
> Program Manager
Used for entering user-written programs into the motion controller’s buffers.
> Motion Manager
Used for completely defining the motion for all axes in the system.
> Communication Terminal
Used for entering commands directly into the controller.
> Scope
A digital oscilloscope providing a realtime graphic display of the motion.
> Variables Manager and Watch
Enables the user to set watch windows for the values of critical variables.
For complete details see SPiiPlus MMI Application Studio Guide.
Version 3.02 31
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
2.3.1 Commands
The controller supports a rich set of commands which are divided into two types of command sets:
> Terminal Commands
Terminal commands are those that are sent directly to the controller. They are entered
through the SPiiPlus MMI Application Studio Communication Terminal. The general
structure of the Communication Terminal windows is:
Version 3.02 32
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
The Communication Terminal window is described in the SPiiPlus MMI Application Studio
Guide.
As soon as the command is received through one of the communication channels it is
executed. Each Terminal command starts with ? (query command) or # (program
management command), for example:
Version 3.02 33
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
A buffer also provides isolation between the programs. All labels and local variables defined in a
program are isolated in their buffer and are inaccessible from any other buffer. For example, two
programs can contain identical user-defined labels, but the controller considers each label as
belonging only to the buffer in which it is contained, and relates to all references to the label
appropriately.
Axes and global variables defined in D-Buffer are not required to be defined in other buffers
before use. However, such redefinition is not an error, given all attributes of the definitions are
identical.
The #SAVE and #SAVEPROG commands store the D-Buffer in the flash along with other buffers.
The values are also stored using the SPiiPlus MMI Application Studio Program Manager
Buffer Editor.
At start-up, the controller loads and compiles the D-Buffer before any other buffers.
After any change in the D-Buffer, all other buffers should be recompiled.
The default contents of D-Buffer differ from other buffers. The other buffers are initially empty by
default; however, the D-Buffer contains a set of definitions that provides compatibility with
Version 3.02 34
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
axisdef X=0,Y=1,Z=2,T=3,A=4,B=5,C=6,D=7
axisdef x=0,y=1,z=2,t=3,a=4,b=5,c=6,d=7
global int
I(100),I0,I1,I2,I3,I4,I5,I6,I7,I8,I9,I90,I91,I92,I93,I94,I95,I96,I97,I98,I99
global real
V(100),V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V90,V91,V92,V93,V94,V95,V96,V97,V98,V99
This provides you with the means to define names for the axes in your system (axisdef). The two
100 element arrays, one an integer and one a real, are, however, for internal use.
Version 3.02 35
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
A user-defined variable can be declared as local or global. Local variables are accessible only within
the buffer that the declaration resides in. Global variables are common to all buffers and can be
accessed from any buffer.
The flash memory stores the following data:Display the current position of all
> Firmware as well as SP programs
motors.
> User application
A new controller is supplied with only the firmware and SP programs stored in the nonvolatile
(flash) memory. You cannot erase or modify the firmware or the SP programs. You can, however,
store ACSPL+ programs and configuration variable values in the controller’s flash memory.
During the power-up process the controller loads the firmware, the ACSPL+ programs, the
configuration variables and the SP programs from the flash memory. If you did not store any
component of configuration variables, the controller loads the default firmware component.
Version 3.02 36
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
Version 3.02 37
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
command redirects execution and defines another line to be executed in the next
controller cycle.
> A number of commands can delay program execution. For example, the command:
WAIT 50
> will execute for 50 milliseconds instead of one controller cycle. The command:
TILL ^MST(0).#MOVE
Version 3.02 38
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
All rules of the execution model also apply to immediate execution. For example, if several
commands are combined in one line for immediate execution, all of them are executed in one
controller cycle in parallel with the lines from each running program.
Within a controller cycle, the immediate line is executed after all lines from the running programs.
Therefore, in one cycle the controller executes a line from buffer 0, then a line from buffers 1, 2, up
to 63, and then executes a Communication Terminal command line (if any has been received).
Version 3.02 39
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
The Enter and Exit lines enclose the critical section. If the program contains several critical sections,
each section must be enclosed with the same Enter and Exit lines as shown in the example above.
All programs that require mutual exclusion must include the same declaration of the Mutex
variable and the same embracing of each critical section.
This construction guarantees that only one of the concurrent programs may be inside a critical
section. If the second program tries to enter the critical section, the command TILL ^MUTEX delays
the program execution until the first program zeroes MUTEX on exit from critical section.
It should be noted that the solution is based on automatic one-line mutual exclusion. Therefore,
the two commands:
TILL ^Mutex; Mutex = 1
must be in one line. If they are placed in two sequential lines, they cannot provide mutual
exclusion.
2.4.7.2 Synchronization
Assume two programs that run mostly asynchronously must execute certain commands at the
same time. There is a point in each program that whichever program comes to the point first, it
must wait for the second program to come to its synchronization point. Then the next lines in both
programs will be executed in the next controller cycle.
The problem is solved by the following construction:
The same definition of the SEM variable and the same line of synchronization point must be in the
second program.
Whichever program comes to its synchronization point first, the command TILL SEM = 2 provides
waiting for the second program. The assignment SEM = 0 provides reuse of the construction if
necessary.
Version 3.02 40
ACSPL+ Programmer's Guide
2. SPiiPlus Architecture
Version 3.02 41
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
3. ACSPL+ Overview
SPiiPlus enables running up to 64 separate ACSPL+ programs. The programs are stored in what are
referred to as “buffers”. The programs are entered via the SPiiPlus MMI Application Studio Program
Manager (see SPiiPlus MMI Application Studio User Guide for details).
This chapter provides a general overview of ACSPL+ programming.
For complete details of the ACSPL+ command set and variables refer to the SPiiPlus Command &
Variable Reference Guide.
Version 3.02 42
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Version 3.02 43
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
3.1.7 Comments
A comment is text in a program that the controller stores along with the program but ignores while
executing the program. Comments are normally used to annotate a program.
A comment starts with an exclamation mark (!). An exclamation mark encountered in a line
designates all subsequent characters in the line as part of a comment. If the exclamation sign is the
first character in a line, the whole line is a comment.
! This entire line is a comment.
V0 = V1 !This comment starts from the exclamation mark.
3.2 Variables
Variables have the following attributes:
> Name
> Class (standard or user variable)
> Scope (global or local)
> Lifetime
> Accessibility (read-write, read-only, protected)
> Type (integer or real)
> Size
> Value
The controller has a large set of ACSPL+ variables with predefined names. You cannot
change these names. These ACSPL+ variables can be used in ACSPL+ commands
without an explicit declaration.
Version 3.02 44
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
ACSPL+ variables are mentioned throughout this guide where they relate to a particular element or
feature of ACSPL+. For details of the ACSPL+ variables see the SPiiPlus Command & Variable
Reference Guide.
User-defined variables are defined by explicit declarations. A declaration can appear as:
> A part of an ACSPL+ program. The declared variable becomes available when the program
is inserted into one of the program buffers and is compiled. Any attempt to query a
variable in a buffer window that has not been compiled will result in an error.
> An immediate ACSPL+ command. Only global variables can be used as a Terminal
command. The declared variable becomes available immediately after the controller
executes the command.
This declaration may appear in several program buffers. However, in distinction to local variables, all
these declarations are considered to be the same variable.
Using a ACSPL+ variable in a program does not require explicit declaration of the variable. However,
a global user variable must be declared before it can be used in a program. Terminal commands can
use any global variable without explicit declaration.
real LocVar
is the same as
Version 3.02 45
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
The name of a local variable may also be the same as the name of a global variable. The controller
considers them as different. The program where the local variable is declared has access to the
local variable only.
The controller immediately accepts the declaration and creates the persistent global variable:
PERSISTENTVAR. The variable is now valid and can be queried as illustrated by the query command,
?PERSISTENTVAR, that follows.
The lifetime of a persistent global variable is not connected with any program. A persistent variable
survives any change in the program buffers and may be erased only by the explicit #VGV (Clear
Global Variables) Terminal command.
Version 3.02 46
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Version 3.02 47
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Many ACSPL+ variables are sized according to the number of axes, with one element per each axis.
For example, each element of the FAULT array displays faults for one axis.
The size of user variables is defined in the variable declaration. For example:
Version 3.02 48
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Version 3.02 49
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
A typical use of an array requires access to a specific element of the array. To specify an element of
an array the array name must be followed by index specification. For example:
Indexing of arrays starts from zero. In the example above the first element of AR1 has index 0, the
last element has index 99.
For information on saving user arrays in the nonvolatile memory, see Nonvolatile Memory and
Power Up Process.
Version 3.02 50
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Version 3.02 51
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
requires non-constant indexing of axis-related variables, neither axis-like or post-fix indexing can
be used.
Each controller axis has an index. The index is an integer number from 0 to Number_Of_Axes-1.
The index of an axis is fixed, for example, INDEX 2 always refers to a specific physical axis. For
example:
VEL(1) – stores the velocity of the axis designated as 1.
ACC(5) – stores the acceleration of the axis designated as 5.
defines the name X for axis 23, W12 for axis 9, and T9 for axis 0.
AXISDEF can be repeated many times as you like to define all required names; however, the
following restrictions apply:
> Only one name can be defined for the same axis
> The names must be unique, i.e., you cannot define two axes with the same name
> The name must not conflict with any other name of variable, label, keyword, etc.
A compilation error occurs if one of the above restrictions is not satisfied.
Axis names must be defined either in D-Buffer - see Declaration Buffer (D-Buffer), or in a program,
where it is used. In any case, the axis definition has global scope; therefore the definition of the
same axis in a different program must be identical (similar rules apply to global variables). Axis
defined in D-Buffer can be used in any other buffer without re-definition.
Version 3.02 52
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
AXISDEF Q=3
VEL(Q)=1000;
int AxisGroup(3)
AxisGroup(0)=0; AxisGroup(1)=1; AxisGroup(2)=2;
ENABLE AxisGroup(0)
ENABLE AxisGroup(1)
ENABLE AxisGroup(2)
PTP AxisGroup,1000,1500,1200
HALT AxisGroup(0)
HALT AxisGroup(1)
HALT AxisGroup(2)
DISABLE AxisGroup(0)
DISABLE AxisGroup(1)
DISABLE AxisGroup(2)
stop
Version 3.02 53
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Other formats of axis specification are also supported (actually, they are considered as special
forms of array specification):
1. Axis expression, like (0, 1, 2), (Ax1, Ax2, Ax3, Ax4).
2. The keyword: ALL that specifies all available axes.
STRUCT MyStruct{
!Fields and functions
}
3.5.3 Fields
In between the brackets will appear the fields of the STRUCT.
Fields can be of several types:
> INT
> REAL
> INT ARRAY
Version 3.02 54
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
D-Buffer:
STRUCT MyStruct{
int field1;
real field2
real arr(10)
}
Buffer 0:
MyStruct var;
var.field1 = 6
var.arr(4) = 9.3
Buffer 0:
MyStruct var;
var.field1 = 6
var.arr(4) = 9.3
Version 3.02 55
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
D-Buffer:
STRUCT InternalStruct{
int field1;
real field2
real arr(10)
}
STRUCT ExternalStruct{
InternalStruct internal;
}
Buffer 0:
ExternalStruct var;
var.internal.field1 = 6
var.internal.arr(4) = 9.3
Version 3.02 56
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Version 3.02 57
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
dc Data,1000,V0,FPOS(0)
Where:
1. The first argument of the DC command is required to be an array, in this case it is the user
array, DATA, that is specified without indexes, as a whole.
2. The second argument is an expression that defines the number of samples to be
collected, in this case it is a simple expression: the constant 1000.
3. The third argument is an expression that defines the sampling period. The V0 variable is a
simple expression. Using a variable instead of an integer provides changing the sampling
period, based on V0, from one execution of this data collection to another.
4. The fourth argument must be a variable or an array element. The values of the variable (in
this case V0) will be collected in the array. The syntax of DC requires that the fourth
element be a variable or an array element. Neither a general expression nor an array
without indexes can be specified. An array without indexes neither can be specified. FPOS
(0) addresses element 0 of the array FPOS that corresponds to the 0 axis feedback
position.
Version 3.02 58
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Use of variables in immediate ACSPL+ commands is limited to ACSPL+ and global variables. Local
variables cannot be referenced in immediate ACSPL+ commands.
Only global variables can be declared with a tag. The following conditions also apply:
> The tag is not mandatory in the variable declaration. However, if the tag is not declared,
the variable cannot be accessed by tag.
> The value of TAG_NUMBER must be greater than 1000. Values below 1000 are reserved for
the standard ACSPL+ variables.
> The TAG_NUMBER value must be unique in the application.
> If more than one VARIABLE_NAME is included, when the program is compiled, the
controller builds a sequence of tag numbers: the specified TAG_NUMBER is attached to the
first variable in the list, TAG_NUMBER+1 value is attached to the second variable, TAG_
NUMBER+2 to the third, and so on.
Version 3.02 59
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Arguments:
tag_
A positive integer associated with the variable.
number
index1, Integer indexes. The indexes must be omitted if the variable is scalar. The second
index2 index must be omitted if the variable is one-dimensional array.
Comments:
The GETVAR function reads the current value of the variable and returns it as a real value. The
SETVAR function assigns the specified VALUE to the variable designated by TAG_NUMBER.
Though the VALUE argument and the return value are defined as real, the functions can be used
for integer variables as well. The controller implements all necessary transforms automatically.
The functions provide read/write access to all standard ACSPL+ variables and to those user-defined
variables declared with TAG.
Version 3.02 60
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
> Function name – the unique name of the function, the function cannot share the same
name of a variable / other function that is defined in the same scope of visibility.
> Function parameters list – a list of type-name separated by comma (‘,’).
Functions may be declared in the scope of a struct
Example:
Other commands, such as GETSP, can also cause the function to hold the processor past
the controller cycle time (CTIME) limit; it is the user’s responsibility to use these
functions correctly.
Version 3.02 61
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
If a function is defined in a regular buffer, the function will only be visible inside that buffer.
Since a function cannot be used before its signature is available, it is necessary to declare the
function before use.
A function defined in the D-Buffer is available from any buffer (including the communication
terminal).
Functions that are defined in D-Buffer do not require declaration to be used in other buffers.
A function defined in a local buffer can be declared anywhere before it is used, but the best
practice is to declare all functions in the top of the buffer.
A function declaration is just the function signature. Names specified in the function declaration
could later be changed in the function definition. Return-type, name of the function and function
parameter types in the definition must conform exactly to the function declaration.
EXAMPLES
1. Local function – the function is defined, and used only in buffer 0:
BUFFER 0:
!This is the function declaration
void myFunc(int param);
!The use of the function is only possible
!after the function has been declared
myFunc(25)
STOP
!This is the function definition
void myFunc(int param){
DISP "param = ", param
param = 3
RET
}
2. Global function
D-BUFFER:
!This is the function definition
void myFunc(int param){
DISP "param = ", param
param = 3
RET
}
BUFFER 0:
!The use of the function does not
Version 3.02 62
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Version 3.02 63
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
The user will only specify the data type (INT/ REAL) and leave the brackets empty (no size should
be specified). Such a parameter can also accept two dimensional arrays and use them as a single
dimension, although such usage must be implemented with great care.
Single dimension array parameters are not size validated at compilation (unlike regular arrays in
ACSPL+) and can accept any array of the same data-type (single / two dimensional).
If the user attempt to use an illegal index a runtime exception will be thrown.
Example – accept an array and change it
Version 3.02 64
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
STOP
!The function accepts an array and array size and puts the highest
!value in the first cell, if no positive value - put 0
void printAndChangeArray(int arr(),int Size){
if(Size = 0) RET end
INT i = 0
INT maxNum = 0
loop Size
DISP "arr(%d) = %d " ,i, arr(i)
if (arr(i) > maxNum) maxNum = arr(i) end
i = i+1
end
arr(0) = maxNum
RET
}
Example – single dimension array parameter accepts a two dimensional array, and uses it as a
single dimension array
The user will specify only the data type (INT/ REAL) and the size of the second dimension (no size
should be specified for first dimension). Such a parameter can only accept two dimensional arrays
with the same second dimension size.
Validation of the second dimension is done in compile time if the value is known.
If the user attempts to use an illegal index, a runtime exception will be thrown.
Version 3.02 65
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Version 3.02 66
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
int var1 = 3
printAxisPos(var1)
STOP
void printAxisPos(int Axis){
real arr(5)
DISP arr(3) ! Unknown value - arrays must be explicitly initialized
int var1 ! Hides the original var1
var1 = Axis - 1
DISP RPOS(var1)
ret
}
Version 3.02 67
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
3.9 Expressions
3.9.1 General
An expression is a sequence of operators and operands that specify a calculation.
Expressions serve as building blocks for many ACSPL+ commands. For example, assignment
commands include expressions to the right of the equal sign:
V0 = V1 + 2*(V2 - V3)
When the controller executes a command that includes an expression, the expression is calculated
and the result is used as required by the command.
Complexity of expression ranges from the simplest expressions that include only one constant or
variable name, to extended formulae containing multiple operators and functions with several
levels of brackets. For example:
Version 3.02 68
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Operator Operation
*/ Multiplication, Division
+- Addition, Subtraction
If several operators appear on the same line or in a group, they have equal precedence.
Version 3.02 69
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
According to the type of result, an expression is defined as integer, real or logical. The controller
provides automatic type conversion of the result so that expression type required does not restrict
expression use. For example:
V0 = 0.01 * V1
In this assignment command, the integer variable V0 is to the left of the equals sign, while a real
expression is to the right of the equal sign. The controller automatically uses rounding type
conversion of the result obtained on the right side, so that the real value can be converted to an
integer variable and stored.
The types of operands and operators used in the expression define the expression type. Each
operator has an associated rule that defines the type of result according to the types of operands.
The rules are summarized in the following tables.
Integer (0,1) is specified for the operators that produce only two values: 0 or 1 (logical
result).
3.9.4 Operands
An operator requires one or two operands.
> An operator that requires one operand is called a unary operator. A unary operator is
placed before its operand.
> An operator that requires two operands is called a binary operator. A binary operator is
placed between its operands.
Unary operators:
integer real
Binary operators:
Version 3.02 70
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Each operand can be either integer or real. If the operator requires, the controller automatically
converts the operand to the required type.
Operands can be one of the following:
> Constant
A constant can consist of any integer or real number. Integer constants can be presented
in decimal, hexadecimal and binary notation. Real constants can include a decimal point
and/or exponent.
> Symbolic constant
Symbolic constants are predefined in the controller. Each symbolic constant presents an
integer number.
> Scalar variable name or Array name with indexing
A variable name is a name of any standard or user-defined variable. If a user-defined name
is used, it must be declared before being used in the program. If the variable presents an
array, the name must be fully indexed to specify one element of the array.
> Function call or Expression
Any ACSPL+ function can be used in an expression. Using expression as an operand of
other expression provides unlimited variety of expressions. In many cases expression used
as operand must be enclosed in brackets. For example:
The following sections provide further elaborations on the operands and operators.
Version 3.02 71
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
> + (addition)
> - (subtraction)
> * (multiplication)
> / (division)
Addition, subtraction and multiplication calculate an integer result if both operands are integers,
and a real result if at least one operand is real.
Division always calculates real results, for example:
Version 3.02 72
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
The result of a bitwise operator is always an integer. If an operand of a bitwise operator is real, the
controller automatically converts it to an integer before the operation.
Bitwise means that the operation is executed separately on each bit of the operand. Each integer
operand is considered as a set of 32-bits. Bit 0 of the left operand is combined with bit 0 of the
right operand to produce bit 0 of the result.
The following example illustrates the AND operator. Both operands and the result are considered
as sets of 32-bits.
First operand 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0
Second operand 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0
Result 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
If both operands are logical, i.e., have only values of 0 or 1, the result is also logical. In this case the
operators can be treated as logical AND, OR and XOR. For example, the following condition:
(V0 = 5) & (I30 = 0)
is satisfied only if V0 is 5 and I30 is 0 simultaneously.
> ~ (inversion) – Provides bitwise inversion of its operand. If the operand is real, the
controller provides automatic conversion to integer before the operation. The result is
always an integer.
> ^ (logical not) – Accepts either an integer or real operand and calculates an integer result.
The result is 1 if the operand equals to 0, and is 0 if the operand is non-zero.
The following two examples illustrate the difference between the ~ and ^ operations:
X 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0
~X 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1
^X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
~X 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
^X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Inversion is a bitwise operator, while the logical not applies to the entire value.
Version 3.02 73
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Version 3.02 74
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
expression can be of integer or real type. By using different operators and parenthesis, an
unlimited number of expressions can be constructed.
After assignment, the previous value of the variable is replaced by the new value.
The controller executes assignment commands in the following order:
1. Calculate expression
2. Convert the type of calculated value to the type of left-term (if the types differ)
3. Assign the result to left-term
The following sections explain assignment for specific types of left-term.
Version 3.02 75
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Examples:
Version 3.02 76
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
If the types differ, the type of calculated right-side expression is automatically converted to the
type of left-side term. There are two possible conversions:
> Integer to real; conversion is exact.
> Real to integer; conversion is not always exact. A real number is rounded to the closest
integer.
V0 = 0 Assign 0 to V0
loop 100
V1 = TIME
WAIT V0
DISP TIME - V1
V0 = V0 + 1
END End loop
Stop End of program
If the controller cycle is 1 millisecond and PRATE is 1, the program displays a list of numbers from 2 to
101. The first number, 2, corresponds to the standard execution time of two lines, because the first
Version 3.02 77
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
time the additional delay provided by the WAIT command is zero. Each loop executed adds one to
the requested delay, therefore the displayed time grows correspondingly.
The bit: AST(0).#MOVE is raised as long as the 0 axis is involved in a motion. Inversion of the bit
(^AST(0).#MOVE), causing the bit to become non-zero, occurs when the motion ends for any
reason. Therefore the above TILL command provides a delay of execution of the next command
until the motion is over.
In the following example, the program starts a data collection and then a motion. The feedback
position is sampled with a period of 1 millisecond and stored in the data array. After the data
collection finishes, the data array contains a transient process of ptp motion. Synchronous data
collection used in the example displays its state in the AST(1).#DCit which is raised as long as the
data collection is in progress. The collected data can be safely used only after the data collection
process has terminated. Her , the TILL command validates that both the motion and the data
collection are over:
Version 3.02 78
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
TILL ^AST(1).#MOVE & ^AST(1).#DC Wait until both the 1 axis motion
and the data collection finish
The following example provides the 3 axis motion in negative direction until a general purpose
input becomes active and then terminates the motion:
In the following example a general purpose output must be activated 25 millisecond before the
motion end. The ACSPL+ GRTIME variable (for details on the GRTIME variable, see The GRTIME
Variable) contains the estimated time that remains to the motion end.
The output activation, OUT0.4 = 1, is placed in the same line as the TILL command in order to avoid
one controller cycle delay between program lines.
3.10.3 Autoroutines
The technique of autoroutines is similar to hardware interrupts. In distinction to routines that must
be explicitly executed (by way of the CALL command), the autoroutine is automatically executed
when a specific condition is satisfied. The routine interrupts the currently executing program,
executes the commands specified in the autoroutine body, and then returns control to the
interrupted program.
3.10.3.1 ON Command
Description:
The ON command flags the routine as an autoroutine and specifies the condition upon which the
execution of the routine is based.
Syntax:
ON expression
Comments:
The value of EXPRESSION defines the condition. The condition is considered true if the expression
calculates to a non-zero result. A zero result corresponds to a false condition, and the routine is not
executed.
The controller never executes the ON command directly.
Version 3.02 79
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
If the program execution flow hits an ON command, the controller asserts a run time
error and aborts the program. Therefore you must either end the program before the
ON command, or use an unconditional GOTO command to skip over the routine.
Instead of direct execution, the controller registers an autoroutine when the program containing
the routine is compiled. Then the controller calculates the expression each controller cycle in
parallel with executing ACSPL+ programs. If the expression calculates to a non-zero value, the
controller interrupts the ACSPL+ program being executed in the same buffer where the
autoroutine is located, and transfers the execution point to the autoroutine. If no ACSPL+ program
is executed in the buffer, the controller does not interrupt any program and simply starts the
autoroutine execution.
The controller implements edge-detection in autoroutine condition verification. If a condition
becomes true, the controller activates the autoroutine only once. If the condition remains true
afterwards, the controller does not activate the autoroutine again. The condition must become
false and then become true again in order to activate the autoroutine again.
Version 3.02 80
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
> When the condition is satisfied, the autoroutine interrupts only the program executed in
the host buffer. Programs that are concurrently executing in other buffers continue
executing in parallel with the autoroutine. When activated, the autoroutine prevents
activation of other autoroutines in the same buffer. A program that is executed in any
other buffer can be interrupted by an autoroutine specified in its own host buffer.
The following approaches are available to you for defining a set of autoroutines and assigning
them to one or more buffers:
> A specific autoroutine occupies a separate buffer with no other program or autoroutine in
the buffer. Activating and executing the autoroutine has no direct affect on other
programs or autoroutines. This approach is the most suitable for an autoroutine that takes
a long time to execute, because a large autoroutine that shares a buffer with another
program or autoroutines would prevent the activity of other programs or autoroutines
during its execution.
> Several autoroutines are specified in one buffer with no regular program in the same
buffer. In this case the activation of an autoroutine does not interrupt any program, all
programs executed in the other buffers continue executing concurrently. An activated
autoroutine prevents the activation of another autoroutine in the same buffer until its
termination.
> One or more autoroutines are specified in a buffer along with a regular program. In this
case the activation of the autoroutine interrupts the program execution. This approach is
the most suitable if the program and the autoroutine are closely related and must use the
same local variables. For example, the autoroutine processes the failure conditions for the
program, and must interrupt the program if a failure occurs.
3.10.3.4 Examples
The following fragment demonstrates a typical use of autoroutine for processing the controller
faults. The autoroutine provides an error message when the Drive Alarm of 0 axis occurs:
The following autoroutine responds when either the Left Limit or Right Limit are activated:
The following example assumes that an extra ventilator must be activated when the motor
overheat input signal is activated for the axis 2. The ventilator is controlled by the output bit:
OUT0.4. The ventilator must be disabled when the signal returns to inactive state.
Version 3.02 81
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
All bits, not only faults, can be used in autoroutine conditions. Assuming that output OUT0.6 (of the
0 axis) is connected to a LED indicator, the following autoroutines signals the motion state bit to
activate the indicator, and deactivate it when the 0 axis is no longer in motion:
The condition of an autoroutine can be any type of expression, not only bit verification. The
following autoroutine provides an alarm message if a fault occurs in the controller:
The above autoroutine displays the alarm message only on the first fault. If one fault bit is already
raised, and another fault occurs, the second fault does not cause the alarm message.
The ACSPL+ MERR (motor error) array can be used for motor failure processing. While a motor is
enabled, the corresponding element of MERR is zero. If a motor is disabled, the element stores the
reason why the motor was disabled. Codes greater than or equal to 5010 correspond to fault
conditions. The following autoroutine displays a message when the controller disables the 0 axis
due to any fault.
The ACSPL+ AERR array can be used to detect abnormal motion termination.
The ACSPL+ MERR and AERR variables expose only those faults that cause motor disable or
abnormal motion termination.
Version 3.02 82
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
The following Terminal command displays change in buffer state after the START command was
executed:
Version 3.02 83
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Syntax:
STOP [buffer_number]
STOPALL
Comments:
BUFFER_NUMBER is the buffer designator (an integer between 0 and one less than the total
number of Program Buffers in the system)
The STOP command without BUFFER_NUMBER affects the currently executing program in the
buffer and is the normal method of program termination.
The STOP command with BUFFER_NUMBER terminates a program in the specified buffer. A master
program that manages the whole application can use this command in order to terminate a certain
activity.
The STOPALL command executed by a program terminates all other concurrently executed
programs, but the program itself continue executing.
After termination by the STOP or STOPALL command, a program remains in the compiled state.
Therefore, if the program contains autoroutines, the autoroutines can be activated after the
program termination whenever its condition is satisfied.
Examples:
The following command terminates the current program:
STOP
The following command terminates the program only if the 0 axis is disabled:
STOP 3
The following command executed in buffer 0 terminates the programs currently executed in all
buffers except buffer 0:
STOPALL
The following Terminal command displays change in buffer state after executing the STOP
command:
Version 3.02 84
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Syntax:
PAUSE buffer_number
RESUME buffer_number
Comments:
The PAUSE command suspends the program executed in the specified buffer (BUFFER_NUMBER). If
no program is executed in the buffer, the command has no effect.
The RESUME command resumes execution of the program suspended in the specified buffer. If the
program was not suspended, the command has no effect.
Examples:
The following command suspends the program currently executed buffer 0:
pause 0
The following Terminal command displays change in buffer state after executing the pause
command:
resume 0
The following Terminal command displays change in buffer state after executing the resume
command:
Version 3.02 85
ACSPL+ Programmer's Guide
3. ACSPL+ Overview
Examples:
The following dialog shows the effect of the commands on the buffer state:
Version 3.02 86
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
Version 3.02 87
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
If the MFLAGS.#ENMOD bit is 1, the ENTIME value defines the time of enable execution. In executing
the ENABLE command, an ACSPL+ program always waits for ENTIME milliseconds. If then the drive
alarm fault is zero, the ENABLE command is considered successful; otherwise the ENABLE
command fails.
If the MFLAGS.#ENMOD bit is 0, the ENTIME value defines the maximum time allotted for ENABLE
execution. Executing ENABLE, an ACSPL+ program monitors the drive alarm input signal. As soon as
the drive alarm becomes inactive, the ENABLE command finishes execution with success. If the
drive alarm signal does not change to inactive state within ENTIME milliseconds, the ENABLE
command fails.
Examples:
Versions 2.60 and later support COMMUT command in GANTRY mode. Commutation of
the primary axis will automatically trigger commutation of the secondary axis.
Version 3.02 88
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
Motor movement during commutation very much depends on the motor drive settings. The
COMMUT command will not operate properly if the SLPKP variable is set to zero, or the integrator is
very low.
Syntax:
COMMUT axis, [excitation_current,] [settle_time,] [slope_time][gantry_commut_delay]
Arguments
Specifies the time that the excitation current rises from zero to the desired
value. The argument can be omitted in which case the default value is 0
slope_
providing an immediate build-up of the excitation current. Slope time is
time
required only in special cases and it is usually recommended to omit this
argument in which case the excitation current is built instantly.
Optional – can be used only in Gantry mode. It defines the delay time in
gantry_
milliseconds after the commutation of the primary axis is completed and
commut_
before the commutation of the complimentary axis begins. The default value
delay
is 500 msec.
The COMMUT command executes the autocommutation algorithm three times for verification and
elimination of unstable equilibrium. The approximate execution time of the command is therefore
3*(SETTLE_TIME + SLOPE_TIME).
It should be noted that:
> In air bearing systems a lower EXCITATION_CURRENT may be required.
> In high friction systems a higher EXCITATION_CURRENT value is required.
The EXCITATION_CURRENT should be the same as that which you determined in the initial
commutation adjustment process.
The SETTLE_TIME parameter determines the settling time for the autocommutation process
initiated by the COMMUT command. The entire autocommutation process lasts approximately three
times longer, since the command executes the algorithm three times for verification.
Version 3.02 89
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
The SETTLING_TIME should be the same as that you have determined in the initial commutation
adjustment process.
Version 3.02 90
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
Version 3.02 91
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
position error PE(0) remains less than TARGRAD(0) for more than SETTLE(0) milliseconds. So
do bits MST(1).#MOVE and MST(4).#MOVE (for the 1 and 4 axes respectively).
> KILL command with non-default connection
If a motor is in non-default connection but depends only on the corresponding axis the
effect of the KILL command is similar to the case of default connection. For example, if the
connection was specified as
(in this case the DEPENDS command is not necessary), the KILL 0 command starts the same
kill process on the 0 axis motor and the halt process on the motion that involves the 0 axis.
All above considerations about the idle motor, single-axis motion and multi-axis motion
remain the same.
The result is a little different if a motor depends on another axis or on several axes, for
example:
(in this case the DEPENDS command is required). The difference is that the KILL 2 command
applies the halt operation to all executed motions involving any of the axes 0, 2, or 4.
Correspondingly, bits AST(2).#MOVE and MST(2).#MOVE remain 1 as long as any of these
motions continues its termination process.
A KILLALL command always terminates all executed motions and therefore makes no
difference between the default and non-default connection.
Version 3.02 92
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
Although the SET command resembles the ASSIGNMENT command, execution of the SET command
is different from ASSIGNMENT. The SET command induces a complex operation in the controller
instead of a simple assignment.
Regardless of the left-side variable, execution of the SET command starts with calculation of
EXPRESSION. The result of the calculation provides the right-side value. Then the execution
depends on the variable specified on the left side.
The following are examples of the use of SET.
> SET RPOS and SET FPOS
The SET command that contains RPOS or FPOS, shifts the origin of an axis. For example,
command
SET FPOS(0) = 0
places the origin of the 0 axis to the point where the motor is located this moment.
FPOS and RPOS provide a reference and a feedback value for a motor. If a control loop
works properly, FPOS follows RPOS with small or zero error.
If the error is zero, both SET FPOS and SET RPOS provide the same result: both FPOS and
RPOS become equal to the right-side value. This is not a simple assignment, and the
command adjusts the controller offsets so that the periodic calculation of FPOS and RPOS
will provide the required results.
If the error is non-zero, the result of SET FPOS and SET RPOS may differ slightly. Consider
the following example:
Version 3.02 93
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
In both SET commands no physical motion occurs. The 0 axis remains in the same position,
only the internal offsets in the controller are adjusted to shift the origin as required.
Even if a motor is idle, several identical SET FPOS commands may place the origin at slightly
different points due to the jitter in feedback.
If a motor is flagged by the Default Connection bit (MFLAGS.#DEFCON), the RPOS and APOS
variables are conjugate. Therefore, any command that changes RPOS, also changes the
corresponding APOS to the same value.
> SET F2POS
The command SET F2POS shifts the origin of the secondary axis feedback. For example,
command
SET F2POS(0) = 0
places the origin of the 0 axis secondary feedback to the point where the motor is
currently located.
As a result of the command execution, F2POS becomes equal to the right-side value. This is
not a simple assignment, as the command adjusts the controller offsets so that the
periodic calculation of F2POS will provide the required result (the specified value in the
current point).
Even if a motor is idle, several identical SET F2POS commands may place the origin in
slightly different points due to the jitter in feedback.
In the case of non-default connection the controller adjusts offsets only for the motors
that depend on the specified axis. Therefore, the depends command is significant in a
connection specification. If dependence is specified incorrectly, one or more motors
can jump once SET APOS=… is executed.
Version 3.02 94
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
> The GROUP command creates a coordinate system for multi-axis motion.
For most applications there is no need for the GROUP commands in that the controller
automatically creates and splits groups. Mainly you would include the command in order to
keep a check that you have included all of the relevant axes in the subsequent motion
commands. If you include a motion command that does not relate to all of the axes in the
group (without a previous SPLIT command), the controller issues an error.
> The SPLIT command breaks down an axis group previously created with a GROUP
command.
> The SPLITALL command breaks down all axis groups previously created with a GROUP
command.
Syntax:
GROUP axes_specification
SPLIT axes_specification
SPLITALL
The format of the AXES_SPECIFICATION is a list of the axes separated by commas and enclosed in
parentheses, for example (0,1,2,4). After power-up, each controller axis is a single axis, no axis
group exists. One-axis motion does not require any axis group. One-axis motion can be activated
immediately after power-up, assuming that the motor is enabled. Several one-axis motions can be
activated in parallel, and do not require any axis group definition.
An axis can belong to only one group at a time. If the application requires restructuring the axes, it
must split the existing group and only then create the new one.
For example, the command:
GROUP (0,2,3)
Version 3.02 95
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
If the SPLIT command specifying an axis that is currently in motion is executed within
the buffer, the buffer execution is suspended until the motion is completed. However,
if the SPLIT command is sent from the host or as a Terminal command, it returns error
3087: "Command cannot be executed while the axis is in motion”.
The SPLITALL command breaks up all existing groups. An ACSPL+ program that starts in an
unknown environment (not just after power-up) can execute the SPLITALL command in order to
ensure that no axes are grouped.
4.1.7 GO Command
The GO command starts a motion that was created using the /W switch (see SLAVE Command). A
motion that has been created without this switch starts automatically after creation and does not
require the GO command.
Syntax:
GO axes_specification
In simple cases AXES_SPECIFICATION is a single axis like 0 or 13, or a string consisting of axis enclosed
in parentheses and separated by commas, for example: (0, 2, 13), or the keyword: ALL (specifying all
of the axes).
There following possibilities are available:
> Starting single-axis motion
A GO command specifies one axis that is not included in any group. The command starts
the last created motion for the same axis. If the motion was not created, or has been
started before, the command has no effect. For example:
Version 3.02 96
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
Version 3.02 97
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
In simple cases AXES_SPECIFICATION is a single axis like 0 or 13, a string consisting of axis enclosed in
parentheses and separated by commas, for example: (0, 2, 13), or the keyword: ALL (specifies all
available non-dummy axes).
In multi-axis motion, smooth vector velocity profiles do not always assure smooth
motion of the coordinates. The user application must provide nearly tangent motion
trajectories in the junction point to avoid jumps in coordinate velocity, which may cause
damage to equipment.
VEL Velocity
ACC Acceleration
DEC Deceleration
JERK Jerk
Version 3.02 98
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
Although the IMM command resembles the ASSIGNMENT command, execution of the IMM
command differs from normal assignment to the same variables.
As in conventional assignment, execution of the IMM command starts from calculation of the right-
side expression. The calculated right-side value is assigned to the left-side variable. Execution of
flat assignment finishes at this point.
The difference between the conventional ASSIGNMENT and the IMM commands becomes apparent
when the command executes while a motion is in progress. The ASSIGNMENT command does not
affect the motion in progress or any motion that was already created and is waiting in a motion
queue. Only the motions created after the ASSIGNMENT command is executed will use the motion
parameters changed by the command. The IMM command, on the other hand, not only changes
the specified variable, but also affects the motion in progress and all motions waiting in the
corresponding motion queue. To change a motion on-the-fly, the IMM command must change a
variable of the axis that is a single axis of the motion or a leading axis if the motion is in axis group.
Use the maximum motion profile values in the axis group as a whole rather than those
m
of the leading axis.
w Create the motion, but do not start until the GO command is issued.
PTP 0, 1000
If the axis is moving when the command is issued, the controller creates the motion and inserts it
into the axis motion queue. The motion waits in the queue until all motions before it finish, and
only then starts.
Version 3.02 99
ACSPL+ Programmer's Guide
4. ACSPL+ Motion Programming
This command creates a motion of the 0 axis to the absolute target point of 1000. If the axis is idle
when the command is issued, the motion starts immediately.
If the E switch is specified, the controller will wait until the motion terminates before executing the
next command. The E switch is a convenient substitute for following the PTP command with
another command that waits for motion termination, for example, the command:
PTP/e 2,1000
is equivalent to:
PTP 2,1000
TILL ^AST(1).#MOVE
Appending the W switch to the PTP command prevents the motion from starting immediately
even if the axis is idle. The command:
PTP/w 0, 1000
creates a motion to the absolute target point 1000, but the motion will not start until the GO 0
command is issued.
In the two examples above the value 1000 is an absolute target point. To specify a relative value
you use the R switch:
PTP/r 0, 1000
This command creates a motion to a relative target point, which will be defined exactly only when
the motion starts. When the motion starts, the target point is calculated as the instant axis position
plus the specified value. For example, the following two commands
PTP 0, 1000
PTP/r 0, 1000
are equivalent to
PTP 0, 1000
PTP 0, 2000
In the previous examples the motion executed using the default velocity VEL(0) for the specified
axis. To override the default velocity you use the V switch, as shown in the following example:
The motion created will ignore the default velocity VEL(0) and execute at a velocity of 15000. The
default value VEL(0) remains unchanged.
You can combine several switches in one command. For example, the command
creates a temporary axis group that includes axes 0, 2 and 4 and executes motion in one group.
Temporary axis groups are automatically created and split-up by the controller. A group is
automatically split-up if the following motion does not address all the axes in the group.
The controller normally takes the motion parameter values from the leading axis. However this can
be overridden by using the /M switch, which causes the controller to calculate the maximum
allowed common motion velocity, acceleration, deceleration and jerk, for example:
The calculation examines the VEL, ACC, DEC, JERK parameters of the axes involved and the
projections of the motion vector to the axes.
If the M switch is combined with the V switch, the M switch is ignored for the velocity
and the velocity specified in the command is used. However, common acceleration,
deceleration, and jerk are still calculated.
w Create the motion, but do not start until the GO command has been issued.
v Use the velocity specified in the command instead of the default velocity.
Use the point sequence as a cyclic array: after positioning to the last point do
c
positioning to the first point and continue.
MPTP 0, 1000
This command creates a multi-point motion of the 0 axis and specifies a dwell time of 1000 msec at
each point. If dwell is not required, DWELL_TIME may be omitted. The MPTP command itself does
not specify any point, so the created motion starts only after the first point is specified. The points
of motion are specified by the POINT or MPOINT commands that follow the MPTP command.
Consider the following program fragment:
The MPTP command creates the multipoint motion. However, the motion does not start until a
point is defined. After the first POINT command the motion starts if all involved axes are idle (not
involved in some previous motion), or waits until a motion that is in progress ends, and then starts.
The four POINT commands specify the following sequence:
The controller performs sequential positioning to each point. The ENDS command informs the
controller that no more points will be specified for the current motion. The motion cannot finish
until the ENDS command executes. If the ENDS command is omitted, the motion will stop at the last
point of the sequence and wait for the next point. No transition to the next motion in the queue
will occur until the ENDS command executes.
Normally, multi-point motion starts with the first POINT command, and the next POINT command
executes while the motion is already in progress. However, sometimes you may need to delay
starting the motion until all points are defined. You use the W switch to prevent the motion from
starting until a GO command executes. The motion created by the command:
MPTP/w 0, 1000
Adding the R switch to the MPTP command causes all points to be treated as relative. The first point
is relative to the position when the motion starts, the second point is relative to the first, and so on.
The previous example, using the MPTP/R command, will look like this:
PTP (0,1), 0, 100 Create PTP motion to the first point (this
serves as the reference point).
MPTP/r (0,1) Create multipoint motion in group (0,1)
with no dwell time.
POINT (0,1), 100, 100 Add point.
POINT (0,1), 100, -100 Add point.
POINT (0,1), -100, -100 Add point.
ENDS (0,1) End the point sequence.
The MPTP command uses the default velocity VEL for positioning to each point. The V switch allows
using a specific velocity for each positioning. The desired velocity must be specified in the POINT
command after the point coordinates. The previous example is modified for using different
velocities:
Several switches can be appended to one command. For example, the command:
MPTP/rv 0, 1000
creates a multi-point motion with dwell time of 1000msec. The points will be specified by relative
coordinates, and velocity will be specified for each point.
If the corresponding motion command is MPOINT without the V switch or PATH without the T
switch (see PATH Command), a column of the matrix must contain the coordinates of the point.
Therefore, if the AXIS_DESIGNATORS includes M axes, the matrix must contain exactly M rows.
If the corresponding motion command is MPTP/V, the matrix must contain M+1 rows. An additional
value in each column specifies the desired velocity for transition from the previous to the current
point. The velocity is specified in position units per second.
If the corresponding motion command is PATH/T, the matrix must contain M+1 rows. An additional
value in each column specifies the time interval between the previous and the current point. The
time is specified in milliseconds.
The following example illustrates how the MPOINT command can be used for adding points on-the-
fly. The example also shows a simple approach to synchronization between the host computer that
calculates the points and the controller that executes the motion.
The host computer calculates the desired points and transmits the coordinates via the Ethernet
link. The motion involves 6 axes. Therefore, each point specification contains 6 real numbers.
Because transmitting each point separately would be very ineffective in the Ethernet, the host
calculates the desired points in advance and transmits them in batches of 50 points. The controller
executes the motion. As soon as the controller is ready to accept the next batch of points and the
host is ready to send the batch, the next transmission occurs, and so on. The pace of the host and
the controller may be very different. However, the host is assumed fast enough to calculate the
next 50 points before the controller has moved through the previous 50 points.
The controller executes the following program:
double HPoints(50)(6);
int N, HSync, NBuf;
HANDLE Com;
open communication, start program in buffer NBuf of the controller;
while (Continue)
calculate N (<= 50) points in array HPoints;
Synchronization between the host and the controller is provided by the SYNC variable. When the
host has finished transmitting the next batch of points to the controller, it writes to SYNC the
number of points in the batch. The controller waits for non-zero SYNC and then adds the points to
the motion. When the controller has added the points, it writes zero to SYNC, which signals to the
host to transmit the next batch of points.
When the host comes to the end, it writes -1 to SYNC to indicate the end of the motion.
SLPMIN and SLPMAX variables can be changed only when the motor is disabled.
GMTYPE
A new GMTYPE is created for 20 KHz motions. GMTYPE for BPTP/2 is 43. 43 = 11 (BPTP) + 32.
GMTYPE over 32 will represent 20KHz motion.
Compatibility
The feature supports dynamic error compensation. The value used for compensation will be the
one calculated once per controller cycle.
The feature uses the Reverse data collection mechanism to communicate with the DSP, which
prevents it from working with other features that use the mechanism: SPINJECT, SPRT, Fast PEG
loading.
The new feature will not support the following commands: CONNECT, BREAK and HALT.
DSP interface
The feature is supported in the standard version of the DSP.
To determine if the desired DSP supports the feature, a new variable is queried in the DSP-
"desired_position_20i" of type int.
Status command
To start operating in the 20KHz mode, the FW will send to the DSP a signal by changing the
Controller-DSP status variable bit 29 that will represent the 20KHz motion status.
Data format
The data (reference positions) will be sent in the format of fixed point 32.32 (total 8 Byte)
The data written to the memory as two int variables.
The position data is sent to the DSP in the reverse data collection packet in the following position:
Data collection
The following variables may be collected for this motion type:
GPATH, GVEL, GACC, GJERK, APOS, PPOS, PPOSCOMP.
PPOS, PPOSCOMP – two new variables, specifying the reference position generated in the current
cycle as opposed to the delay used to calculate FPOS).
The new values will be collected automatically, when a specified variable is collected in a frequency
that is higher than the controller’s.
Problem: this could cause undesirable behavior for a user that is unaware of the feature and would
like to collect DSP variables. See discussion below.
To resolve this issue, a new, “smart” data collection item is created.
The new item has two references, one to the standard variable (e.g. APOS[6] ) and one to the
custom 20 KHz array (e.g. APOS_20KHZ[6] ).
When a 20 KHz motion generation is active for the axis, the custom data is collected. When a
standard motion generator is active or there is no motion at all, the standard variable is collected
instead.
4.2.5.2 BPTP
Description
BPTP defines a motion profile using the MotionBoost Feature.
Syntax
BPTP[/suffixes] axis_list, destination_point, [value of Tf, value of Vf]
Suffixes
Arguments Comments
Travel time will be calculated by the MPU to achieve a the minimum possible
None
time
Minimum travel time in seconds, The calculated travel time will be at least
/t
the specified value. Incompatible with the /d suffix.
Travel Time – specifies the exact travel time for the motion in seconds.
All other considerations are ignored, which could cause a safety fault during
/d
motion execution.
Incompatible with the /t suffix.
Arguments Comments
/r Relative motion
/w Create the motion, but to not start until the GO command is issued.
Use the motion profile values of the axis group as a whole, rather than those
/m of the leading axis, without exceeding any of the defined axes motion VEL,
ACC, DEC, JERK values.
Use the motion profile values of the axis group as a whole, rather than those
/q of the leading axis, without exceeding any of the defined axes motion VEL,
ACC, DEC, JERK values. Not compatible with /2 suffix. Range is 0-25 ms.
Use of the /d suffix to specify minimum travel time overrides all other parameters
which might limit velocity and requires careful attention to safety considerations.
The BPTP/2 command is limited to at most 2 axes per Servo Processor and at most 4
axes per system.
Arguments
axis_list
destination-point
Value of Tf
Value of Vf
GPHASE
Two options are available.
> • Four phases (For motion in positive direction; for motion in negative direction reverse the
inequality signs)
1. Acceleration buildup
> • RJERK>0, RACC>0
2. Acceleration finishing
> RJERK<0, RACC>0
3. Deceleration buildup
> RJERK<0, RACC<0
4. Deceleration finishing
> RJERK>0, RACC<0
Examples
BPTP 0, 100
BPTP/2 (0,1),1,1
GMTYPE
The motion GMTYPE is 11, or 43 if using the /2 suffix for 20 kHz control.
4.2.5.3 BPTPCalc
Description
The BPTPCALC function calculates and allows the user to set the motion variables according to a
desired motion time. When the travel time and distance are known in advance, the BPTPCALC
should be used to generate new VEL, ACC and JERK values.
Syntax
Arguments
Motion_ The desired motion time in seconds. The time will be rounded up to a
duration whole number of controller cycles.
1 - Velocity
Index 2 - Acceleration
3 - Jerk
Example
enable(0)
STOP
w Create the motion, but do not start until the GO command has been issued.
v Use the velocity specified in the command instead of the default velocity.
JOG 0
This command creates a jog motion of the 0 axis in positive direction using the default velocity VEL
(0).
Motion direction may be specified in the command:
JOG 0, -
This command creates a jog motion of the 0 axis in negative direction using the default velocity VEL
(0).
The command:
JOG 0, +
JOG 0
The V switch allows a specific velocity to be used instead of the default velocity VEL. The command:
JOG/V 0, 30000
ignores the default velocity and creates a jog motion with a velocity of 30000.
As with other types of motion, jog motion may be terminated by the HALT, KILL, or BREAK
commands. Unlike any other motion, jog motion also terminates when the next motion command
for the same axis executes. For example, the following program fragment:
JOG 0, +
WAIT 500
JOG 0, -
provides jogging in the positive direction for 500msec and then switches to the negative direction.
The controller automatically ensures a smooth transition from motion to motion.
Jogging can also occur in an axis group. For example, the following program fragment
creates jogging in three axes: 0 in the negative direction, and 1 and 4 in the positive direction. The
motion uses the default velocity VEL(0) as a vector velocity for the three-axis motion.
If the axis is idle, the track motion is activated immediately. If the axis is moving, the controller
creates the motion and inserts it into the axis motion queue. The motion waits in the queue until all
previous motions in the queue are executed, and then starts.
When the track motion starts, the controller copies the current value of the reference position
(RPOS) element to target position (TPOS) element. For example, when the command is executed,
RPOS(0) is copied to TPOS(0). No change of RPOS and no physical motion occur at this time.
Afterwards, the axis waits until the TPOS element is assigned a different new value. As soon as the
program executes:
the controller generates a PTP motion to the point designated by the value of the NEWTARGET
user variable. After the 0 axis reaches NEWTARGET, the axis waits for the next change of TPOS. The
next assignment to TPOS(0) automatically activates the next PTP motion and so on. Therefore, track
motion is executed as a sequence of PTP motions.
The motion state bits AST.#MOVE, AST.#ACC, MST.#MOVE, and MST.#ACC reflect the state of each
PTP motion in the track sequence exactly as they do for ptp motion. Between PTP motions, while
the axis waits for the next TPOS assignment, the motion bits are zero (with the exception of the
MST.#MOVE bit, which can be 1 if the position error exceeds the TARGRAD limit).
The following ACSPL+ program fragment defines sequential positioning to points 1000, 2000,
10000, 11000:
While the code with the PTP commands looks shorter and simpler, there are applications where
track motion is preferable to point-to-point motion.
Track motion is not terminated automatically. If TPOS is not changed, the axis track motion remains
at the last target point until TPOS is assigned a new value, and then motion continues.
TRACK terminates due to:
> Any subsequent motion command (except TRACK) for the motion axis involved in a track
motion, except the case when the next motion is a group motion.
> Any fault activation that disables the drive or kills the motion.
> User termination by HALT, KILL, or DISABLE command.
The motion profile while in Track mode, like in a standard PTP motion, is defined by the ACSPL+
variables VEL, ACC, DEC and JERK. The track command accepts the values of these variables at the
beginning of each component PTP motion within the track motion. Therefore, if an application
assigns a new value to VEL, ACC, DEC or JERK, while track mode is in effect, then the new value will
be used the next time that the application initiates a motion (by assigning a new value to TPOS).
The following ACSPL+ program fragment sets a specific velocity for each PTP motion:
In the example above the application updates TPOS only after the previous PTP motion ends.
In the following example the application updates TPOS while the motion is still in progress:
In this case, the controller does not execute two separate motions. As soon as TPOS is changed to
2500 (before the controller reaches 2000), the controller changes the move on-the-fly to the new
target position of 2500. The on-the-fly change is done smoothly, similar to end-point correction on-
the-fly.
The same result is provided by the following fragment:
The TRACK command may also be used for programming multi-axes motion, for example, the
command
creates track motion of 0, 2 and 3 axes. The multi-axis track motion is executed as a sequence of
PTP motions. A new PTP motion starts each time when one or more elements of TPOS that
correspond to the involved axes are changed. Consider the following example:
In the following example TPOS is updated while the previous motion is still in progress:
In the above case, the controller does not execute two separate motions. As soon as TPOS is
updated, the controller changes on-the-fly from PTP motion towards 0=2000, 3=1000 to PTP
motion towards 0=2000, 3=1000. The transition from the first motion to the second is done
smoothly. While each PTP motion follows a straight trajectory, the transition between the motion is
not straight, as shown in the following diagram:
S = MPOS
S = MPOS + C
In both cases the second stage of the motion generation remains unchanged and depends only on
the specified segment sequence.
Segment commands specify a path on the plane, and the MPOS value of the leading axis defines
motion progress along the path.
Formulas that calculate the MPOS value must be defined before using the master command.
v Use the velocity specified for each segment instead of the default velocity
Use the segment sequence as a cyclic array: after the last segment return to the first
c
segment and so on.
Slaved motion - the motion advances in accordance to the master value of the leading
s
axis (velocity lock).
Extrapolated - if a master value travels beyond the specified path, the last or the first
e
segment is extrapolated.
Stalled - if a master value travels beyond the specified path, the motion stalls at the last
t
or first point.
The E and T switches are relevant only for slaved motion and must be used with S or P switch. For
discussion of slaved motion see SLAVE Command.
Segmented motion can be executed in an axis group with any number of controller axes.
The MSEG command specifies axis group and the initial starting point:
This command creates a segmented motion of the X axis group and specifies the coordinates of
initial point on the plane. The MSEG command itself does not specify any segment, so the created
motion does not start immediately. A LINE or ARC command must follow the MSEG command to
specify the segment sequence.
Consider the following program fragment:
The MSEG command creates the segmented motion. The motion does not start, because no
segment is defined yet. After the first ARC1 command the motion starts if the axis group is idle (not
involved in some previous motion). If the group is not idle, motion will start when the previous
motion stops. The four segment commands specify the following path (where X is the direction of
the 0 axis and Y is the direction of the 1 axis):
Y
Start
(-1000,1000)
(1000,1000)
X
(-1000,1000)
(1000, -1000)
ARC1 and ARC2 differ only by the required arguments. ARC1 requires the coordinates of the center
point, final point, and the direction of rotation. ARC2 requires the coordinates of the center point
and the rotation angle (in radians). Each command produces the same result, so selection of either
ARC1 or ARC2 depends on the available data. If you know the coordinates of the center point,
coordinates of the final point and the direction of rotation, ARC1 is preferable. If you know the
coordinates of the center point and rotation angle, ARC2 is preferable.
The ROTATION_DIRECTION argument can be:
> + (plus) – for counter clockwise
> - (minus) – for clockwise rotation
The entire sequence of segmented motion must be terminated with an ENDS command. The ENDS
command informs the controller that no more segments will be specified for the specified motion.
The motion cannot finish until the ENDS command executes. If the ENDS command is omitted, the
motion will stop in the last point of the sequence and wait for the next point. No transition to the
next motion in the queue will occur until the ENDS command is executed.
Segmented motion usually starts with the first segment command (LINE, ARC1, or ARC2). The next
segment command therefore executes while the motion is already in progress. This is generally
not a problem, because the program execution rate is higher than typical motions time. However,
sometimes you may need to delay starting the motion until all points are defined. In this case you
append the W switch to the command to prevent the motion from starting until the GO command
is issued. The motion, created by the command:
MSEG/w (0,1),1000,1000
Several switches can be attached to one command. For example, the command
creates a segmented motion with individual velocity for each segment. The motion does not start
until the GO (0,1) command is issued.
As mentioned above, all coordinates, specified in the segment commands, are absolute in the
working plane. Projection is a matrix that connects the plane coordinates and the axis values as
specified in the mseg command. If the axis group contains two axes, and no PROJECTION command
is specified, the controller provides a default projection that corresponds to a 2x2 matrix:
1 0
0 1
The matrix directly connects the first coordinate of the working plane to the first axis of the axis
group and the second coordinate to the second axis.
The matrix can also define rotation and scaling. The full transform also includes an implicit offset.
The controller calculates the offset automatically in such a way that the initial coordinates specified
in the mseg command match the desired axis values at the moment when the motion starts. The
offset provides the full path to be relative to the starting point.
If an axis group contains N axes, the controller extends the default matrix to N lines. The additional
lines are filled by zeros:
1 0
0 1
0 0
… …
0 0
The matrix connects only the first two axes to the plane coordinates. Therefore the segmented
motion will involve only the first two axes in the group.
If N = 1, the MSEG command applies to a single axis, and the matrix contains the first line only:
1 0
In this case the axis will follow the first coordinate of the working plane.
You can replace the default matrix with the PROJECTION command.
Example:
If the group contains N axis, the matrix in the projection command must be of size Nx2.
The program executes the line command 2000 times. The line segments build up a curve close to
the Archimedean spiral:
Y
Cyclic segmented motion does not automatically finish. You must use one of the
commands HALT, KILL, or BREAK to stop cyclic motion
ENABLE (0,1)
MSEG/c (0,1),1000,1000 !Create segmented motion in group X, coordinates of
!the initial point are (1000,1000)ARC1
(0,1), 1000,0,1000,–1000,– !Add arc segment with center (1000,0), and
!final point (1000,-1000), clockwise rotation
LINE (0,1),–1000,–1000 !Add line segment with final point (-1000,- 1000)
length of the path, the motion continues along the extrapolated last segment. If the
distance S slaved to the MPOS master value becomes less than zero, the motion continues
along the extrapolated first segment. If the extrapolated segment is a circular arc, the
motion will follow along the extrapolated circle.
> t – Stalled motion
When the motion approaches the extreme point, the slave comes out from synchronism
and stalls in the point until the MPOS master value allows to regain synchronism. For
velocity lock synchronism is achieved when the MPOS changes its direction; after regaining
the offset C may have a different value than before approaching the extreme point. For
position lock synchronism regains when the MPOS falls into the interval (0, L) again. The
controller ensures smooth approaching the extreme points and smooth return to
synchronism.
> No switch – Bounded motion
The motion finishes when the slave approaches any extreme point. The controller
activates the next motion in the queue (if any). If the MPOS master value changes only in
positive direction, the behavior is very close to non-slaved motion. The difference is that
non-slaved motion is based upon the time value and slaved motion is based upon the
MPOS master value.
corner angle and the threshold angle. If the corner angle is smaller, the controller ignores
the corner and tries to move as if the junction is smooth (the threshold angle cannot be
large, otherwise passing the junction at working velocity can produce mechanical jerk). If
the corner angle is greater, the controller executes deceleration to achieve the junction
point with the specified corner velocity.
The following picture illustrates the option:
> Corner rounding according to permitted deviation: the user specifies the motion trajectory
maximum permitted deviation from the corner point. The controller inserts an additional
segment in the corner so that the resulting path is smooth and complies with the
maximum deviation.
> Corner rounding according to permitted radius: the user specifies the additional segment
maximum permitted rounding radius. The controller inserts an additional segment in the
corner so that the resulting path is smooth and complies with the maximum permitted
radius.
> Automatic corner rounding: the user specifies the maximum segment length for
automatic corner rounding. The controller applies automatic corner rounding if the length
of both segments in the pair is less than the maximum segment length.
The following picture illustrates the option:
Figure 4-3. Corner Processing - Permitted Deviation, Permitted Radius and Corner Rounding
Options
The allowed acceleration deceleration is defined by ACC only. The DEC parameter is not used by the
algorithm.
Changing of the controller cycle time parameter (CTIME) may affect the automatic
corner processing calculations. The user needs to check the system performance after
the CTIME change.
Changing of the controller cycle time parameter (CTIME) may affect the automatic
corner processing calculations. The user needs to check the system performance after
the CTIME change.
The motion starts from zero velocity, accelerates to the required velocity, goes through the
specified segments at the required velocity, and then decelerates approaching the final point of
the last segment with zero velocity and acceleration. The diagram also explains that the required
velocity actually defines maximal velocity through the path; on specific intervals the velocity is
lower than required.
A number of factors can affect the velocity diagram. The following conditions apply additional
restrictions to velocity in specific points or on intervals:
> The user specifies a new required velocity in a segment definition. The new velocity
remains active for the specified segment and for all subsequent segments.
> The user specifies lower (or zero) velocity in the segment final point. The specification
defines velocity in one point, but doesn’t change required velocity for subsequent
segments.
> The user specifies required velocity greater than axis velocity (VEL value) of one or more
involved axes. On some segments the required vector velocity can be achieved, on others
the axis velocity would be surpassed. The controller reveals such segments, and limits the
vector velocity accordingly.
> The controller detects a corner. Depending on the specified options, the controller either
uses specified corner velocity or calculates reduced velocity in the corner point to comply
with acceleration/jerk limitations (ACC and JERK) for all axes.
> The controller reveals an arc segment that requires either centripetal acceleration or jerk
greater than axis acceleration (ACC parameter) or axis jerk (JERK) of one or more involved
axes. The controller reduces velocity on this segment to comply with acceleration/jerk
limitations (ACC and JERK) for all axes.
> The controller detects a curvature discontinuity point (linear-to-arc or arc-to-arc junction).
Depending on the specified options, the controller either uses specified curvature
discontinuity velocity or calculates reduced velocity in the point to comply with jerk
limitations (JERK) for all axes.
After all velocity restrictions are exposed, the controller builds a third-order velocity profile that
never exceeds the required velocity.
A curvature discontinuity point is a smooth connection of two adjacent segments, if the two
segments have different or differently-directed curvatures. Most smooth connections are actually
discontinuity points. In a discontinuity point, all related coordinates show discontinuity in
acceleration.
The controller provides dynamic calculation and, if necessary, recalculation of the motion profile
each time once a new segment is added.
To make look-ahead calculation possible, the program or host has to add segments in advance,
before they are actually reached in the motion. This is not a problem, if segments are added from
ACSPL+ program. However, if segments arrive from the host through a communication channel,
the host may fail to supply a segment in time; a condition referred to as “segment starvation”. If
segment starvation occurs, the controller raises the AST.#STARV flag and executes a special
algorithm that prevents motion discontinuity. The algorithm avoids mechanical jerks, but moves at
a slower rate as long as starvation continues; once the host begins supplying segments at sufficient
rate, the controller returns to normal execution.
When using one of the above products, configure the controller time (CTIME) to 1
millisecond and ensure that a maximum of one XSEG motion is executed
simultaneously.
From within the ACSPL+ buffers the segments are added using the corresponding segment
commands (LINE, ARC1, ARC2). The ACSPL+ program need not take care of whether there is free
space in the internal segments buffer or not.
If the buffer has free space, the segment is accepted and immediately inserted into the buffer; if
the buffer is full, the ACSPL+ program waits on the corresponding line until a segment buffer has
free space.
If segments are added from the host program, the host program should first query GSFREE in order
to know how many cells are free in the segment buffer. The segments are added using the
corresponding SPiiPlus Library functions.
This approach is simpler in implementation and ensures more optimal trajectory passing time, as
starvation is avoided. However, the trajectory cannot be quickly changed on the fly as all already
added segments should be executed first.
The ARC1, ARC2 and LINE axis lists should be identical to the XSEG axis list.
For each axis, ARC1 and LINE specify the primary axes destination coordinate. ARC2 specifies the
secondary axes destination coordinates (destination coordinates of the primary axes are calculated
from the arc parameters). For details, see ARC1, ARC2, LINE.
XSEG builds the algorithm upon the following axis motion parameters as axis constraints: VEL, ACC,
JERK
4.6.12 XSEG...ENDS
Segmented Motion. XSEG...ENDS enables the user to incorporate the following into the motion
application:
> Corner detection
> Detection of segments, where required velocity violates axis velocity/acceleration limits
> Velocity limitation at corners and problematic segments
> Building a velocity profile using multi-segment look-ahead algorithm
The following commands are used within the block to define the segmented motion:
> ARC1 - adds an arc segment to a segmented motion and specifies the coordinates of
center point, coordinates of the final point, and the direction of rotation
> ARC2 - Adds an arc segment to a segmented motion and specifies the coordinates of
center point, rotation angle and direction.
> LINE - Adds a linear segment to a segmented motion.
> ENDS- terminates the motion sequence
Syntax
XSEG
[/switches] (axis_list), initial_position_axis1,initial_position_axis2[,initial_position_axis3…,initial_
position_axis6], [,velocity][,end_velocity][,junction_velocity][,angle][,curvature_velocity][,deviation]
[,radius][,maximal_length] [,starvation_margin [,segments_buffer]]
Segment commands (ARC1, ARC2, LINE)
ENDS
Arguments
Argument Description
Argument Description
initial_
position_ Initial position of the first axis.
axis1
initial_
position_ Initial position of the second axis.
axis2
initial_
position_
axis3
Mandatory only if AXIS_LIST contains more than 2 axes. Number of initial
…
positions must correspond to the number of axes in AXIS_LIST.
initial_
position_
axis6
Argument Description
real buf(18750)
For details on how to declare a buffer with more than 100,000 elements, refer
to XARRSIZE in the SPiiPlus ACSPL+ Command and Variable Reference Guide.
Switches
There are three types of optional switches:
> General
> Velocity look-ahead
> Corner rounding
The controller processes the specified switches in the following order:
1. The controller checks and applies corner rounding options.
2. The controller checks and applies velocity look-ahead options.
Switches from different groups can be applied together. For example, it's possible to specify a
velocity at curvature discontinuity points (switch /d) together with permitted deviation (switch /g).
In this case, the controller first applies corner rounding for the trajectory and then
calculatesvelocity profile for already processed trajectory.
Optional /switches are for use only with the XSEG command:
General
Velocity look-ahead
Decelerate to corner.
The switch requires an additional parameter that specifies corner velocity. The
controller detects corner on the path and decelerates to the specified velocity before
the corner. The specified value should be less than the required velocity; otherwise
/j the parameter is ignored.
If switch J is not specified while switch A is specified, zero value of corner velocity is
assumed.
If switches J and A are not specified, the controller provides automatic calculation of
the corner processing.
Do not treat junction as a corner, if junction angle is less than or equal to the specified
value in radians.
The switch requires an additional parameter that specifies negligible angle in radians.
/a If switch A is not specified while switch J is specified, the controller accepts default
value of 0.01 radians that is about 0.57 degrees.
If switches J,A,D, and Yare not specified, the controller provides automatic calculation
of the corner processing.
Corner rounding
Use a corner rounding option with the specified permitted deviation. The switch
requires additional parameter that specifies maximal allowed deviation of motion
/g
trajectory fromthe corner point. The switch cannot be specifiedtogether with
switches u and h
Use a corner rounding option with the specified permitted curvature. The switch
/u requires additional parameter that specifies maximal allowed rounding radius of the
addtional segment. The switch cannot be specified together with switches g and h
Use automatic corner rounding option. The switch requires additional parameter that
specifies the maximum length of the segment for automatic corner rounding. If a
length of one of the segments that built a corner exceeds the specified maximal
/h length, the corner will not be rounded. The automatic corner rounding is only applied
to pair of linear segments. If one of the segments in a pair is an arc, the rounding is
not applied for this corner. The switch cannot be specified together with switches g
and u.
XSEG without switches does not require any additional parameters except the initial
point coordinates, for example, XSEG (0,1),0,0 creates segmented motion for axes 0
and 1 with initial point (0,0) with required velocity derived from the axis 0.
Segmented motion for axes 1 and 0. Required velocity is derived from the
axis 1, i.e., the VEL(1) value. No deviation from the path is permitted. If the
XSEG (1,0),0,0
path contains a corner, and the junction angle is more than default value
0.01 radians, the velocity decelerates to zero in the corner point.
Segmented motion for axes 0 and 1 with initial point (0,0) with required
XSEG/vf
velocity 100 units/sec; at the end of each segment, the motion should
(0,1),0,0,100,50
decelerate to 50 units/sec.
Segmented motion for axes 1 and 2 with initial point (1000,1000) and
XSEG/vja
required velocity is 100 units/sec. If the path contains a junction, and the
(1,2),1000,1000,
junction angle is more than 0.05 radians, the velocity decelerates to 20
100,20,0.05
unit/sec in the junction point.
4.6.13 ARC1
Description
Use ARC1 to specify the center point and final point coordinates of an arc and the direction of
rotation. Direction is designated by a plus sign (+) or (–) for clockwise or counterclockwise rotation
depending on the encoders’ connections. When ARC1 is used for Extended Motion, it must be
initialized with XSEG...ENDS.
Syntax
ARC1 [/switches] (axis_list), center_point_axis1, center_point_axis2, destination_point_axis1,
destination_point_axis2, [destination_point_axis3, … destination_point_axis6,] direction, [,velocity]
[,end_velocity][,time][,values, variables[,index [,masks]]]
Arguments
Argument Description
center_
Center point position for the first axis
point_axis1
center_
Center point position for the second axis
point_axis2
destination_
Destination position of the first axis
point_axis1
destination_
Destination position of the second axis
point_axis2
Argument Description
destination_
point_axis3 Mandatory only if AXIS_LIST contains more than 2 axes.
… Destination position of the rest of axes. Number of destination positions
destination_ must correspond to the number of axes in the AXIS_LIST.
point_axis6
values Defines the values to be written to variables array at the beginning of the
current segment execution. values is a one-dimensional user defined array
of integer or real type with maximum size of 10 elements .
variables Defines the user-defined array, which will be written with values data at the
beginning of the current segment execution. variables is a one-dimensional
user defined array of the same type and size as the values array.
index Defines the first element (starting from zero) of the variables array, to which
values data will be written. If argument is omitted, values data is written to
the variables array starting from the first element (index 0).
Argument Description
For information on optional switches for this command, see Using ARC1, ARC2 and LINE
Switches.
4.6.14 ARC2
Description
Use ARC2 to specify the center point and rotation angle in radians of an arc segment. Designate
direction by positive or negative rotation angle, depending on the encoders’ connections. When
ARC2 is used for Extended Motion, it must be initialized with XSEG...ENDS.
Syntax
ARC2 [/switches] (axis_list), center_point_axis1, center_point_axis2, rotation_angle [,destination_
point_axis3, … destination_point_axis6][,velocity][,end_velocity][,time][,values, variables[,index
[,masks]]]
Arguments
Argument Description
center_
Center point position for the first axis
point_axis1
center_
Center point position for the second axis
point_axis2
rotation_ Defines central angle of the arc, signed according to rotation direction: plus
angle for a counter-clock-wise arc, minus for a clock-wise arc.
destination_
point_axis3 Mandatory only if AXIS_LIST contains more than 2 axes.
… Destination position of the rest of axes. Number of destination positions must
destination_ correspond to the number of axes in the AXIS_LIST.
point_axis6
Argument Description
Defines required velocity for the current and for all subsequent segments.
See Using ARC1, ARC2 and LINE Switches
values Defines the values to be written to variables array at the beginning of the
current segment execution. values is a one-dimensional user defined array of
integer or real type with maximum size of 10 elements .
variables Defines the user-defined array, which will be written with values data at the
beginning of the current segment execution. variables is a one-dimensional
user defined array of the same type and size as the values array.
index Defines the first element (starting from zero) of the variables array, to which values
data will be written. If argument is omitted, values data is written to the variables
array starting from the first element (index 0).
For information on optional switches for this command, see Using ARC1, ARC2 and LINE
Switches.
4.6.15 LINE
Description
Use LINE to add a linear segment that starts at the current point and ends in the destination point
to the motion. When LINE is used for Extended Motion, it must be initialized with XSEG...ENDS.
Syntax
LINE [/switches] (axis_list), destination_point_axis1,destination_point_axis2
[,destination_point_axis3 … ,destination_point_axis6][,velocity][,end_velocity][,time]
[,values,variables[,index[,masks]]]
Arguments
Argument Description
destination_
Destination position of the first axis
point_axis1
destination_
Destination position of the second axis
point_axis2
destination_
point_axis3
Mandatory if AXIS_LIST contains more than 2 axes.
… Destination position of the rest of axes. Number of destination positions
must correspond to the number of axes in AXIS_LIST.
destination_
point_axis6
Argument Description
variables Defines the user-defined array, which will be written with values data at the
beginning of the current segment execution. variables is a one-dimensional
user defined array of the same type and size as the values array.
index Defines the first element (starting from zero) of the variables array, to which
values data will be written. If argument is omitted, values data is written to
the variables array starting from the first element (index 0).
For information on optional switches for this command, seeUsing ARC1, ARC2 and LINE
Switches
Synchronize user variables with segment execution. The switch requires additional
/o
two or three parameters that specify values, user variable and mask.
Specify segment processing time The switch requires an additional parameter that
specifies the segment processing time in milliseconds. Unlike the required velocity
/t specification, the segment processing time defines velocity at the current segment
only, and has no effect on the subsequent segments. The switch cannot be specified
together with /V.
For ARC1, ARC2, and LINE some switches require an additional parameter to be specified. If more
than one parameter is required, the parameters should be separated by a comma, and the order of
parameters is fixed in the following order:
1. Required velocity (used with /V)
2. Final velocity (used with /F)
3. Segment processing time (used with /T)
4. /O switch parameters
Examples:
LINE/v (1,0), 1000, - Add line segment with end point (1000, -1000) and segment velocity
1000, 500 500.
arc1/vf (0,1), 0, 0,
Add arc segment with center (0,0), end point (100,100), clockwise
100, 100, +, 500,
direction, segment velocity 500 and end velocity 100
100
int Value(1)
int Mask(1)
Value(0) = 1; Mask Add arc segment with center (0,0) and 180 degree (π) angle. At the
(0) = 5 beginning of the segment execution, sets bit 0 and reset bit 2 of
digital outputs OUT(2).
ARC2/o (0,1), 0, 0,
3.141529, Value,
OUT, 2, Mask
4.6.17 Examples
4.6.17.1 Simple Two Axes Example
The following is a simple program example employing Extended Segmented Motion:
The XSEG command creates the segment motion. The motion does not start at this moment. Actual
motion starts once the previous motion ends and one or more segments are added. The four
segment commands specify the following path:
The LINE command may specify one axis that actually moves in this segment. Other
axes specified in XSEG hold their positions while the linear segment is in progress.
XSEG creates the segment motion for four axes: primary axes (0,1) and secondary axes (2,3). Actual
motion starts once the previous motion ends and one or more segments are added. The four
segment commands specify the following path:
In comparison with 2-axes example, xseg, line, arc1 and arc2 commands specify four axes, first two
of them are treated as primary axes.
> XSEG specifies the initial point coordinates for all four axes in the order the
axes appear in the axis list.
> ARC1 specifies the arc segment with a center, final point and rotation for
primary axes, and a linear segment with the final point for secondary axes.
> LINE specifies the final points of the linear segment for primary and secondary
axes.
> ARC2 specifies the arc segment with a center and angle for the primary
segment, and a linear segment with the final point for secondary axes.
> ENDS informs the controller that no more segment for this motion will be
added.
If the IMM command occurs either before the start XSEG, or after XSEG termination, its
action follows standard rules of IMM action in idle mode (or other motion whichever is
executed in the moment of IMM command).
If the IMM command is issued, and XSEG motion is at a specific point of execution, all XSEG
segments can be subdivided as follows:
> Segments before the current segment; these segments has been passed and are of no
interest.
> Current segment the current point belongs to.
> Segments after the current segments already included in segment queue and processed
by look-ahead algorithm.
> Future segments not included yet in segment queue.
If the IMM command specifies a new velocity, the velocity is expected to affect all XSEG segments
after the current point, including the section of current segment after the current point. However,
there are some limitations:
> Individual velocity can be specified for any segment. Individual velocity should not be
exceeded; actual velocity is required to be equal or (in some cases) less than the specified
one.
> The look-ahead algorithm may apply additional limitations to velocity on a segment or in a
junction point. The limitations are not eliminated by imm command.
Taking the above considerations into account, the velocity specified by the IMM command is not a
strict velocity setting from this point on; rather it operates as additional limitation that affects actual
velocity along with other limitations.
If the IMM command specifies a new velocity while XSEG motion is in progress, the controller
response includes the following actions:
> The specified velocity replaces the required velocity for the rest of the XSEG motion.
Therefore, the new value will act as the required velocity for a segment, if no individual
velocity is specified.
> The specified velocity defines velocity restriction for the rest of the XSEG motion. The
velocity restriction will take part in any velocity calculation; so that actual velocity can
appear equal or lower, but not higher than the specified velocity.
> The velocity profile for the queued segments, including the section of the current
segment after the current point, is recalculated taking into account the new required
velocity and velocity restriction. This way, operation of imm command is identical for
queued and future segments.
If the IMM command specifies new acceleration or jerk, the new value replaces the required value
for the rest of the XSEG motion. However, unlike the velocity case, the queued segments are not
recalculated. Therefore the new acceleration or jerk takes effect with some unspecified delay.
In some cases it is required to temporaryily pause a segmented motion while remaining on the
trajectory. The imm command allows specifying zero velocity for the leading axis in order to pause
the currently executed segmented motion. The controller will immediately start decelerating to
zero velocity and the motion will be paused on the current or one of the subsequent segments.
In order to resume the motion, the imm command for the leading axis should be sent with a non-
zero velocity value. The controller will immediately start accelerating to the specified velocity value.
There is an additional restriction that if the newly specified velocity is greater than the current
required velocity, the new velocity is not effective for already queued segments; it is effective for
the future segments only. In other words, lower velocity takes effect immediately; greater velocity
takes effect with some unspecified delay.
Motion velocity V, acceleration A, and jerk J are derived from the time parameters as follows:
If blending is active, sequential motions are executed without deceleration to zero. Actually, the
next motion starts acceleration stage once the previous motion achieves the start point of
deceleration stage. Then until the end of acceleration stage, the actual motion appears a mix of the
previous and the next motions. In one-axis motion, this approach provides smooth transition from
velocity of previous segment to velocity of the next segment. In multi-axis motion, blending
additionally provides geometrical smoothing of corners, although exact control of the smoothing
trajectory is not possible.
For sequential motions without blending, total motion time (including jerk sections) is
If the user specify time parameters that don’t comply with the specified limitations, the controller
provides the following handling of these specific cases:
> Currently executed segment final point coordinates, defined by the user: TPOS. With a
blending, the final point is never reached.
Arguments Comments
Initial jerk time (Tj ) in milliseconds. The specified jerk time will be
jerk_time used for all segments until jerk_time argument is specified in LINE,
ARC1 or ARC2 command.
Suffixes
Suffix Comments
Do not start until the GO command is executed. If the suffix is not specified, the
w
motion starts immediately after the first motion segment is defined.
4.7.3.4 LINE
This format of LINE is used for blended segment motion and in this form must be initialized with
BSEG...ENDS. The command adds to the motion path a linear segment that starts in the current
point and ends in the destination point.
Syntax
LINE[/suffixes] (axis_list),destination_point_axis1,destination_point_axis2
[,segment_time [,acceleration_time [,jerk_time [,dwell_time]]]]
Arguments
Arguments Comments
4.7.3.5 ARC1
This format of ARC1 is used for blended segment motion and in this form must be initialized with
BSEG...ENDS. The command adds to the motion path an arc segment that starts in the current point
and ends in the destination point with the specified center point.
Syntax
ARC1[/suffixes] (axis_list),
center_point_axis1,center_point_axis2,
destination_point_axis1,destination_point_axis2, direction
[,segment_time [,acceleration_time [,jerk_time [,dwell_time]]]]
Arguments
Argument Commments
4.7.3.6 ARC2
This format of ARC2 is used for blended segment motion and in this form must be initialized with
BSEG...ENDS. The command adds to the motion path an arc segment that starts in the current point
and specified as the center point and rotation angle.
Syntax
ARC2[/suffixes] (axis_list),
center_point_axis1,center_point_axis2,
rotation_angle
[,segment_time [,acceleration_time [,jerk_time [,dwell_time]]]]
Arguments
Arguments Comments
Suffix Comments
Specifies jerk time (Tj) in milliseconds. The suffix requires additional parameter that
specifies jerk time in milliseconds. The suffix defines required jerk time for the
s
current segment and for all subsequent segments. If the suffix is not specified, the
previously defined jerk time is used.
Some suffixes require additional parameter to be specified. If more than one parameter is
required, the parameters should be separated by comma, and the order of parameters is fixed in
the following order:
1. Segment time (used with /m suffix)
2. Acceleration time (used with /a suffix)
3. Jerk time (used with /s suffix)
4. Dwell time (used with /d suffix)
The BSEG command creates the Blended segmented motion for axes 0 and 1 and initial point (1000,
1000). Initial blended motion parameters are specified as following: initial segment time 100msec,
initial acceleration time 20msec and initial jerk time 5msec.
The motion does not start at this moment. Actual motion starts once the previous motion ends and
one or more segments are added.
The ARC1 command adds a first arc segment with center (1000,0), final point (1000,-1000), clockwise
rotation. The initial segment, acceleration and jerk time parameters are used for the first arc
segment.
The LINE command adds a second segment with final point (-1000,-1000). The initial segment,
acceleration and jerk time parameters are used for the first arc segment.
The ARC2 command adds a third arc segment with center (-1000,0) and rotation angle -180°. The
new segment time 50msec is specified.
The last LINE command adds a fourth segment with final point (1000,1000). For this segment new
segment time 25msec and new acceleration time 10msec are specified.
The ENDS command informs the controller, that no more segments will be specified for the motion.
MASTER MPOS(axis_index)=value
Only one component of the MPOS (master position) variable is allowed as MPOS(AXIS_INDEX).
In the simplest case the master value follows the feedback of another axis:
When the command executes, the controller stores the formula specified to the right of the equals
sign, and then calculates the master value MPOS(0) according to this formula (in the example
above, it simply assigns the current FPOS(1) value to MPOS(0)). The controller does this calculation
every controller period, independent of program execution. Even if the program that executed the
MASTER command terminates, the controller continues calculating the last specified master
expression, until the another master command for the same axis executes.
The master value can be redefined at any time by the application. If the program that executed the
above command then executes the command.
A more sophisticated use of the MASTER command connects the axis to another axis feedback with
a scale factor:
The following example defines axis 2 to follow the RPOS (reference position) of axis 0 translated
through a conversion table (cam motion):
In this example TABLE is a user-defined array that contains a table for conversion.
Similarly, the MASTER value may be connected to other sources such as the sum of two or more
axes, or to an analog input.
w Create the motion, but do not start until the GO command has been issued.
p Use position lock instead of velocity lock (see Velocity Lock vs. Position Lock).
Slave motion is governed by the variables of the slaved axis. These include:
Default jerk. The slave uses this variable only in asynchronous motion to overtake
JERK
the master.
Default acceleration. The slave uses this variable only in asynchronous motion to
ACC
overtake the master.
Default velocity. The slave uses this variable only in asynchronous motion to
VEL
overtake the master.
Once started, slaved motion terminates only if a failure occurs, or one of the commands HALT, KILL,
or BREAK is executed. The HALT and KILL commands provide deceleration to zero and then the
next motion starts. If no next motion was created, the axis becomes idle. The BREAK command
provides smooth transition to the next motion without stopping, if a next motion is waiting in the
queue.
4.8.2.1 Synchronization
In slaved motion the slave is usually synchronized to the master, meaning that the APOS axis
reference follows the MPOS master value strictly or with a constant offset. However, there are two
cases when synchronism is not attainable:
> The slaved motion starts, and positions (position lock) or velocities (velocity lock) of the
master and slave differ. The motion starts as asynchronous.
> The motion was synchronized, but the acceleration of the master exceeds the allowed
limit (the XSACC variable of the axis) for the slave. The slave comes out of synchronization.
In both cases, the motion continues asynchronously, and the correspondence between APOS and
MPOS appears broken. The controller tries to regain synchronization by having the slave pursue the
master within the maximal allowed motion parameters. When the slave overtakes the master,
synchronization is re-established and the motion continues as synchronous.
Only individual axes are allowed to be used in a SLAVE command. Groups are not allowed. The
created motion starts immediately if the axis is idle; otherwise the motion waits in the motion
queue until all motions created before for the axis finish. The following command creates a slaved
motion of the 0 axis:
SLAVE 0
The slave axis in a master-slave motion may show its state (through the AST variable)
as accelerating and in motion even when the master axis is motionless. This reflects
the fact that the axis is set to follow the motion of the other axis and is not following a
motion profile of its own.
The SLAVE command without the P switch activates a velocity-lock mode of slaved motion. When
synchronized, the APOS axis reference follows the MPOS with a constant offset:
APOS(0) = MPOS(1) + C
Where C is constant in velocity lock mode and is zero in position lock mode.
When the MSEG command includes the p switch (see MSEG, LINE, ARC1, ARC2, STOPPER Commands),
this activates the position lock mode of slaved motion. When synchronized, the APOS axis
reference follows the MPOS strictly:
APOS(0) = MPOS(1)
When the motion is asynchronous for any reason (see above), the controller tries to regain
synchronism by having the slave pursue the master with the maximal allowed motion parameters.
The difference between position lock and velocity lock manifests itself at the moment of regaining
synchronization:
> Velocity lock motion switches to synchronized when the slave velocity reaches the master
velocity (with allowed error defined by the SYNV variable of the slaved axis). At this
moment the difference between the master position and the slave position is latched as
the constant offset C, which then remains unchanged as long as the motion is
synchronous.
> Position lock motion switches to synchronized when the slave position overtakes the
master position, i.e., when APOS = MPOS.
Each time the motion loses and regains synchronization, the velocity lock offset C may latch a
different value. Under the same conditions, the position lock motion each time re-establishes the
strict equality APOS = MPOS.
Use the point sequence as a cyclic array, that is, after positioning to the last point return
c
to the first point and repeat.
Non-uniform time interval; the time interval is specified for each point along with the
t
point coordinates.
Points for arbitrary path motion are defined by POINT and MPOINT commands (see MPTP, POINT,
MPOINT, and ENDS Commands).
The ENDS command terminates the point sequence. After the ENDS command, no POINT or MPOINT
commands for this motion are allowed.
The trajectory of the motion follows through the defined points. Each point presents the instant
desired position at a specific moment. Time intervals between the points are uniform, or non-
uniform as defined by the T switch.
Motion generated by the PATH command does not use the standard motion profile. Typically, the
time intervals between the points are short, so that the array of the points implicitly specifies the
desired velocity in each point. For this reason, variables VEL, ACC, DEC, JERK have no affect on this
motion.
If the time interval does not coincide with the controller cycle, the controller provides linear
interpolation of the points.
Commands HALT, KILL, KILLALL (see HALT Command and KILL and KILLALL Commands) are executed
in a specific way with this type of motion; as with other motion types, the controller provides a
smooth deceleration profile using DEC (HALT command) or KDEC (KILL, KILLALL commands) for the
leading axis. However, unlike other motions types, the controller does not provide following the
motion trajectory during deceleration.
Arbitrary path motion created without the T switch implies uniform intervals between the points. If
PATH is not specified with the T switch, the TIME_INTERVAL argument has to be included. The
argument defines time interval between the motion points in milliseconds.
If PATH is specified with the T switch, it must not have TIME_INTERVAL specification. Instead, the
TIME_INTERVAL must be specified for each point as an additional argument for the POINT command
or as additional array column in the MPOINT command.
The BREAK command (see BREAK Command) is not supported when using the PATH
command.
Commanded position (x) 100 200 300 400 500 600 700 …
Actual position (p) 103 199 294 402 500 598 705 …
The table defines a functional dependence p=f(x) that cannot be expressed analytically.
The argument values for x in the definition table are knots, and the function values for p are
control points.
A 3rd order polynomial spline provides an approximation of the table-driven function that can
provide the function value not only in the knots, but at any point. Between each two knots the
spline is expressed as:
where coefficients a0, a1, a2, a3 have different values at different intervals.
The SPiiPlus controller also supports two-dimensional splines. In this case, the definition table is a
two-dimensional matrix. Knot points are defined for two arguments x and y, and the matrix
contains corresponding p values. Knot values divide the XY plane into rectangular cells. The matrix
defines the function values in the cell vertices. Within each cell, the interpolating spline is
expressed as:
Use the point sequence as a cyclic array, that is, after positioning to the last point return
c
to the first point and repeat.
Non-uniform time interval; the time interval is specified for each point along with the
t
point coordinates.
Points for PV and PVT motion are defined by the POINT and MPOINT commands (see POINT
Commandand MPOINT Command).
The POINT and MPOINT commands serve the same function for defining points along
the path as the POINT and MPOINT commands for multiple point-to-point motion (see
MPTP, POINT, MPOINT, and ENDS Commands); however, the controller employs a
different algorithm when calculating the spline motion.
The ENDS command terminates the point sequence. After the ENDS command, no POINT or MPOINT
commands for this motion are allowed.
The trajectory of the motion follows through the defined points. Time intervals between the points
are uniform, or non-uniform as defined by the t switch.
Motion generated by the PVSPLINE command does not follow the standard motion profile.
Variables VEL, ACC, DEC, JERK have no effect on this motion. The motion profile is defined
exclusively by the positions and velocities specified by the POINT and MPOINT commands.
The HALT command (see HALT Command) is executed in a specific way with this type of motion. As
with other motion types, the controller provides a smooth deceleration profile with the DEC value
of the leading axis. However, unlike other motions types, the controller does not follow the motion
trajectory during deceleration.
Spline motion created without the t switch implies uniform intervals between the points. If
PVSPLINE does not include the t switch, the time_interval argument has to be included. The
argument defines time interval between the motion points in milliseconds.
If PVSPLINE includes the t switch, the time_interval argument must not be included. Instead, the
time interval must be specified for each point as an additional argument for the POINT command or
as additional array row in the MPOINT command.
The PVSPLINE command itself does not specify any point, so the created motion starts only after
the first point is specified. The points of motion are specified by the POINT or MPOINT commands
that follow the PVSPLINE command.
For each segment the controller constructs a third-order polynomial and calculates the reference
coordinates using the polynomial.
The spline provides exact track through the specified points and exact specified velocity at the
points. The spline also provides continuous velocity at all intermediate points.
In general the spline does not guarantee acceleration continuity at the connection points.
However, the acceleration can be continuous if the proper velocity values are specified, and many
host-based programs that prepare data for PV-interpolation actually calculate velocity values that
will provide continuous acceleration.
The time interval between the points may be either uniform or non-uniform. In both cases the
time interval is not required to be an integer or to be equal to an integer number of controller
cycles. The controller uses the exact specified time interval to calculate the interpolated reference
positions.
The following drawing illustrates the PV spline interpolation:
T 2T 3T 4T 5T 6T 7T 8T
In the POINT command the axis_designators must specify the same axes in the same order as in
the axis_designators of the corresponding PVSPLINE command.
The other arguments contain different values depending on corresponding PVSPLINE command.
If the related motion command is PVSPLINE without the t switch for M axes, there has to be 2*M
arguments: 2 arguments per axis involved. The arguments specify the end point coordinates and
the coordinate velocities at the end point in the following order:
> The end point coordinate for each axis involved (M values)
> The velocity at the end point for each axis involved (M values)
Each coordinate is specified in user units of the corresponding axis, each velocity is specified in user
units per second.
If the related motion command is PVSPLINE/t for M axes, there have to be 2*M+1 arguments: 2*M
arguments specify the end point coordinates and velocities, and the last argument specifies the
time interval between the previous and the current point. The time is specified in milliseconds.
Before the MPOINT command can be executed, an array must be declared and filled with
the point coordinates. Each row of the array contains coordinates of one point.
If the related motion command is PVSPLINE without the t switch, for M axes the matrix must
contain 2*M rows, 2 rows per axis involved. The values in each column specify:
> in row 1: the end point coordinate for each axis involved (M values)
> in row 2: the velocity at the end point for each axis involved (M values)
Each coordinate is specified in user units of the corresponding axis, each velocity is specified in user
units per second.
If the related motion command is PVSPLINE/t, for M axes the matrix must contain 2*M+1 rows:
> M rows for end point coordinates
> M rows for end point velocities
> plus additional row for the time interval between the points. The time is specified in
milliseconds.
The pace of the host and the controller do not have to be identical. However, the host is assumed
to be fast enough to calculate the next 50 points before the controller has moved through the
previous 50 points.
The controller executes the following program:
The program running on the host looks like the following pseudo code:
double HPoints(12)(50);
int N, HSync;
HANDLE Com;
open communication, start program in buffer NBuf of the controller;
while (Continue)
calculate N (<= 50) points in array Hpoints;
acsc_WriteReal(Com, NBuf, "Points" , 0, 11, 0, N-1, HPoints, 0) ;
acsc_WriteInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &N, 0);
do
acsc_ReadInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &HSync, 0);
while HSync;
reset Continue to zero if all points have been calculated;
end;
N = -1
acsc_WriteInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &N, 0);
Synchronization between the host and the controller is provided by the Sync user variable. When
the host has finished transmitting the next batch of points to the controller, it writes to Sync the
number of points in the batch. The controller waits for non-zero Sync and then adds the points to
the motion. When the controller has added the points, it writes zero to Sync, which signals to the
host to transmit the next batch of points.
When the host comes to the end, it writes -1 to Sync, to indicate the end of the motion.
RPOS is calculated
according to the
Correspondence of Reference RPOS RPOS commanded motion.
Position (RPOS) and Feedback follows follows
Position (FPOS) FPOS FPOS FPOS follows the RPOS
as provided by control
loop algorithm.
Bit 1 in the MFLAGS variable enables or disables open-loop mode. The following diagram explains
transition between the three modes:
Disabled
Mode
Command Command
DISABLE DISABLE
Command Command
ENABLE if ENABLE if
MFLAGS.1=1 MFLAGS.1=0
Command
MFLAGS.1 = 0
Open -loop Enabled
Mode Mode
Command
MFLAGS.1 = 1
The circles in this diagram represent the motor modes and the arrows with rectangles show the
controller commands that switch the controller from one mode to another.
As shown in the diagram, a motor can be switched from the enabled mode to the open-loop mode
and back without changing to the disabled mode. The controller provides a smooth transition
between the modes. Even if the motor experiences uncontrolled movement while in the open-
loop mode, switching back to the enabled mode does not cause any motor jump. However, be
careful if you execute a motion while the controller is in open-loop mode. Once the command
switches back to enabled mode, the controller continues the motion from the point where it finds
the motor. No motor jump occurs, but the motion trajectory and the final point may be shifted by
the value of uncontrolled offset in the open-loop mode.
While in open-loop mode, the controller calculates the drive voltage output based on the DCOM
variable. The DCOM variable sets the drive output as a percentage of the maximum available drive
output voltage. For example, the UDI provides differential drive output in the range from -10V to
+10V. Therefore, assigning 100 to DCOM provides +10V on the drive output, assigning -100 provides
-10V, and assigning 0 provides 0V.
The following program fragment shows an example of torque control implementation through the
open-loop mode.
NVEL is an array of 8 real values, one per axis. A non-zero value in any NVEL element determines
that the motion of the corresponding axis will be executed with non-zero start and finish velocities.
If an NVEL element is zero, the normal motion profile starts from zero velocity and finishes at zero
velocity. If an element is non-zero, in the beginning of motion the velocity immediately jumps to
the value specified in the NVEL element and then continues normal motion profile. In the end, the
motion approaches the final point at velocity specified in the NVEL element, then the velocity
immediately drops to zero.
In a typical application, the step motor does not require acceleration build-up phases; the motion
profile is trapezoidal:
GPHASE = 0 2 4 6
VEL
NVEL
Time
KILL and HALT commands are also affected, i.e., they slow down the velocity to the value specified
in the NVEL element and then the velocity drops to zero.
If the absolute value of the VEL value is less than the NVEL value, the VEL value is ignored. In this
case the motion profile is rectangular:
GPHASE = 0 4
NVEL
Time
Also ignored are the velocity specified in a motion command or in an IMM command if its absolute
value is less than NVEL. In all cases, the actual motion velocity is not less than NVEL.
Multi-axis motion is not typical for an axis with non-zero minimal velocity. If, however, the axis is
involved in multi-axis motion, the controller uses NVEL as follows:
> If the axis is a leading axis in the motion, its NVEL is used as a minimal vector velocity in the
motion profile
> If the axis is not leading, its NVEL is ignored.
In both cases, the axis velocity can be lower than the NVEL value. Therefore, be careful in defining
multi-axis motion that involves both stepper motors and servo motors.
If a non-default connection is specified (see Non-Default Connections), the axis and the motor are
different entities. In this case, NVEL refers to the axis, but not to the motor. For example, if NVEL0 is
set to 500, the velocity of any motion of the X axis will be limited from below to 500 units per
second irrespective of which motor is affected by the motion.
When you are operating a system whose configuration is currently unknown, you can
use the Terminal command: #SI (see SPiiPlus ACSPL+ Command & Variable Reference
Guide for details on Terminal commands) to find out the correlation between the
IN/OUT array indexes and I/O.
The port number to which the bits belong. The controller’s digital input/output
port_
ports are numbered from 0 to N-1, where N is the number of controller ports (see
#
the controller’s Hardware Guide for the number of input/output for your controller).
The specific bit within the port. Each port is divided into 32 bits that are numbered
from 0 to 31. For example:
IN0.1 – input 1 of port 0
.bit_
# IN3.19 – input 19 of port 3
OUT0.5 – output 5 of port zero
OUT3.19 – output 19 of port 3
Rather than explicitly designating the port number, you can use an integer user-defined variable
that equates to the number. In this case you have to include the parentheses, for example:
IN(U_VAR).1 - where U_VAR is an integer variable the value of which equates to the port number.
If the controller provides only 32 inputs or less, all inputs/outputs are located in port
zero. In this case the port number can be omitted, and input is referred as: IN.0 (for
input 0), IN.22 (for input 22), OUT.0 (for output 0), OUT.2 (for output 2), etc.
10111001,00011010,00000100,00000000
10111001,00011010,00000100,00000000 10111001,00011010,00000100,00000000
10111001,00011010,00000100,00000000 10111001,00011010,00000100,00000000
OUT6.1 = IN0.0 & IN0.1 Set OUT6.1 to logical AND of inputs IN0.0 and IN0.1
Set signals OUT0.0 and OUT0.8 to one. Set all other bits of
OUT0 = 0x0101
OUT0 to zero
OUT0 = (OUT0 & ~0x0101)|(V1 & Copy bits 0 and 8 from V1 to OUT0. Do not alter other bits
0x0101) of OUT0
if ^IN0.1 goto L
Go to label L only if IN0.1 is zero
while IN0.1 & Execute the subsequent commands up to command end while both IN0.1
IN0.2 and IN0.2 are one
> Implement the PLC program in a separate buffer. This is the most suitable approach if the
PLC program must not interfere with motion, and has few connections to motion
programs. The PLC program runs in parallel with motion programs in other buffers, and any
desired connections are provided via global variables.
> Mix motion programs and PLC program in the same buffers. This approach provides a very
close interaction between PLC and motion programs, resulting in faster reaction time, but
in general has a more complex structure.
> Split the PLC program into two different parts running in two different buffers. This
approach is most suitable when a time-critical part of the program has to operate faster
than the rest of the program. PLC programs run at either a fast or slow scanning rate, and
you must assign a greater priority one buffer using the PRATE variable.
> Implement a part of the PLC program as a set of autoroutines. This approach provides a
very fast and interrupt-like response to critical conditions, because the autoroutine
condition is checked each controller cycle.
The following is an example of a PLC program implemented in a separate buffer using autoroutines
for fast response:
1. real T1
2. int Bits
3. Start:
4. OUT0.0 = MST0.#INPOS
5. if T1 <= TIME
6. if Bits.0 T1 = T1 + 30000 else T1 = T1 + 15*60000 end
7. Bits.0 = ^Bits.0
8. end
9. OUT0.4 = IN0.4 & Bits.0
10. goto Start
11. on IN0.15; killall; ret
Line1 – Definition of local variable T1 that is used to store the next switch time. T1 may be defined as
integer, but as a real, it can provide continuous running for an extended period without overflow.
The program relies on the automatic initialization of all local variables to zero when they are
declared.
Line2 – Definition of a local variable: Bits. In this program only one bit of Bits is used. One
temporary integer variable can be used for storing 32 temporary bits.
Line3 – A label: Start. A typical case in PLC programming is a long program cycle that executes to the
end and returns to the beginning. In the example shown above, the execution period is quite short
even with default rate of ‘one Line per each controller cycle’. In a long program, the execution cycle
can reach hundreds of milliseconds.
This is a good reason to divide a typical PLC program into slow and fast sections.
Line 4 – OUT0.0 reflects the ‘in position’ state of the motor. If the motor is not in position, the
output is 0. If it is in position, the output is 1.
Lines 5-9 – OUT0.4 controls a periodic activity that must be executed every 15 minutes for a 30-
second period. It is executed only if IN0.4 is active. In a typical application, the output might be
connected to lubrication pump.
5.1.8.1.1 SPICFG
Description
SPICFG configures and initializes the SPI interface.
Syntax
SPICFG (SlaveIndex, Mode, NumberOfWords, Polarity,Size,Frequency)
Arguments
The mode of the SPI interface. The following modes are supported:
> 0 - Slave
Mode
> 1 - Master
> 2 - SlaveListenOnly
> 3 - Disable
> 4 - Master Single Transaction (Used by ACSPL+ SPIWRITE)
Number of SPI Data Words used by the application (FW to SPI). Range:
NumberOfWords {0,8}
Not relevant in case of Master Single Transaction Mode
Clock Polarity.
Four types are available:
> Rising Edge – 0
Polarity
> Rising Edge with Delay – 1
> Falling Edge – 2
> Falling Edge with Delay - 3
2 800
3 1000
4 1500
5 2000
6 2500
7 3000
8 3500
9 4000
10 5000
Return Value
None
Comments
When the SPI interface is not required anymore, SPICFG should be called with Mode=3 (disable)
parameter.
Example
5.1.8.1.2 SPIRXN
Description
SPIRXN is a variable that shows the number of actual words that contain data transmitted from the
SPI external interface. The range is from 0 to 8.
Accessibility
Read-only
Comments
SPIRXN value is 0 if the SPI is disabled. This variable is supported by the UDMsm, IDMsm and ECMsm
products only.
5.1.8.1.3 EXTIN
Description
EXTIN is an integer array, the size of which is determined by the total number of SPI input signals in
the system, and reads the current state of the inputs. The number of inputs depends on the
number of SPI modules in the system.
Comments
The SPIRXN variable is updated every cycle with the number of active elements.
Tag
42
Accessibility
Read-Only
Related ACSPL+ Variables
EXTOUT, IN
COM Library Methods and .NET Library Methods
ReadVariable, GetExtInput, GetExtInputPort
C Library Functions
acsc_ReadInteger, acsc_GetExtInput, acsc_GetExtInputPort
5.1.8.1.4 EXTOUT
Description
EXTOUT is an integer array, the size of which is determined by the total number of SPI output
signals in the system, which can be used for reading or setting the current state of the outputs. The
number of outputs depends on the number of SPI inputs in the system.
Syntax
EXTOUT(index) = value
Arguments
Comments
When used with an SPI interface in master mode, the EXOUT function should be used.
The SPICFG function sets the number of elements which contain data.
Tag
43
Accessibility
Read-Write
Related ACSPL+ Variables
EXTIN, OUT
COM Library Methods and .NET Library Methods
ReadVariable, WriteVariable, GetExtOutput, SetExtOutput, GetExtOutputPort, SetExtOutputPort
C Library Functions
acsc_ReadInteger, acsc_WriteInteger, acsc_GetExtOutput, acsc_SetExtOutput, acsc_
GetExtOutputPort, acsc_SetExtOutputPort
When you are operating a system whose configuration is currently unknown, you can
use the Terminal command: #SI (see SPiiPlus ACSPL+ Command & Variable Reference
Guide for details on Terminal commands) to find out the correlation between the
AIN/AOUT array indexes and I/O.
The port number to which the bits belong. The controller’s input/output ports are
port_
numbered from 0 to N-1, where N is the number of controller ports (see the
#
controller’s Hardware Guide for the number of input/output for your controller).
The specific bit within the port. Each port is divided into 32 bits that are numbered
from 0 to 31. For example:
AIN0.1 – input 1 of port 0
.bit_#
AIN3.19 – input 19 of port 3
AOUT0.5 – output 5 of port zero
AOUT3.19 – output 19 of port 3
The range of the AIN and AOUT arrays depends on the type of the input or output and the bit
resolution of the Analog-to-Digital or Digital-to-Analog conversions.
> Example: For ±10V analog outputs with 16-bit Digital-to-Analog conversion resolution, the
AOUT range is from -32768 (for –10V) to +32767 (for +10V).
> Example: For ±1.25V analog inputs with 14-bit Digital-to-Analog conversion resolution, the
AIN range is from -8192 (for –1.25V) to +8192 (for +1.25V).
For model-dependent analog I/O information (for example, the number and range of inputs and
outputs) see the controller’s Hardware Guide.
Example:
The following ACSPL+ program assigns X-axis feedback position to output #3 and acceleration to
output #1. In the example the user variables: SF1 and SF2 are scale factors.
6. Fault Handling
Fault handling is not only a concern for isolating motion faults, it is also a vital concern to personal
and equipment safety.
Safety features are necessary to protect both the equipment and you from potential injury.
SPiiPlus controllers include numerous safety-related features, but the final responsibility for the
safe use of the controller in a particular application lies with you. Before you create your application
make sure that you thoroughly read and understand this chapter.
This chapter addresses:
> Safety Controls
> Working with Fault Procedures
Some alarms, limits, and errors involve protection against potentially serious bodily
harm and equipment damage. Be aware of the implications before changing or
disabling any alarm, limit, or error.
Safety control is one of the highest-priority tasks of the controller. The controller continually
monitors safety conditions each controller cycle, in parallel to its other activities.
The controller sets one of the fault bits of the ACSPL+ FAULT variable when it detects a
malfunction. The response to a fault may vary from sending a fault message to complete
termination of all activities. For each fault type you can enable/disable the default controller
response or define your own autoroutine response.
User error Defining a required velocity that is invalid or beyond the limits.
Improper or
broken A loose connection in the feedback encoder wiring.
wiring
Power
amplifier The power amplifier malfunctions and sends a fault signal to the controller.
malfunction
Motor
A motor overheats.
malfunction
Controlled
plant The Emergency Stop input is activated.
malfunction
Controller The Main Processor Unit (MPU) and the Servo Processors (SPs) work
hardware together to detect malfunctions in the controller. Examples include the
malfunctions servo processor alarm and the servo interrupt.
6.1.3 Faults
When the controller detects a malfunction, it raises a specific fault bit. Fault bits are grouped into
ACSPL+ FAULT and S_FAULT variables.
In certain cases, you may want to define which fault conditions are examined in a specific
application. The ACSPL+ FMASK and S_FMASK variables specify which fault conditions must be
examined in a particular application.
See SPiiPlus Command & Variable Reference Guide for complete details of these variables.
> System faults such as Emergency Stop and Time Overuse that are not related to any
specific motor.
Right Limit restricts the motion in the positive direction and the Left Limit in the
negative direction.
The faults reported by the ACSPL+ fault variables, as well as those latched in MERR are:
The controller
NETWORK ERROR. The
disables all axes
controller raises the fault
2 #NT Network until a valid
bit when a loss of
network Sync
network is detected.
signal is received.
The controller
disables the
violating motor.
ENCODER NOT The error code is
CONNECTED. The latched in the
controller raises the fault MERR variable and
7 #ENCNC Motor
bit when the primary remains active
encoder is not until you resolve
connected. the problems and
enable the motor
again or issue the
FCLEAR command.
No default
response.
The controller
disables the
violating motor.
The error code is
ENCODER ERROR. The latched in the
controller raises the fault MERR variable and
10 #ENC Motor
bit when the primary remains active
encoder malfunctions. until you resolve
the problems and
enable the motor
again or issue the
FCLEAR command.
The controller
disables the
violating motor.
The error code is
ENCODER 2 ERROR. The latched in the
controller raises the fault MERR variable and
11 #ENC2 Motor
bit when the secondary remains active
encoder malfunctions. until you resolve
the problems and
enable the motor
again or issue the
FCLEAR command.
NON-CRITICAL POSITION
ERROR. The controller
raises the fault bit when
the position error (PE)
limit is exceeded. The
limit depends on the
motor state and is
defined by the following
variables:
12 #PE Motor None.
ERRI if the motor is idle
(not moving)
ERRV if the motor is
moving with constant
velocity
ERRA if the motor is
accelerating or
decelerating
The controller
disables the
SERVO PROCESSOR
violating motor.
ALARM. The controller
The error code is
raises the fault bit when
latched in the
the axis Servo Processor
MERR variable and
17 #SP Motor loses its synchronization
remains active
with the main processor.
until you resolve
The fault indicates a fatal
the problems and
problem in the
enable the motor
controller.
again or issue the
FCLEAR command.
There is no
External The controller
23 #EXTNT EtherCAT device
Network Error disables all axes.
connected.
S_
SETUP.#USGTEMP
Activated at CPU = 0: No response
temperature > 90°C or S_
24 #TEMP MPU Overheat
System temperature > SETUP.#USGTEMP
70°C = 1: Default
response is to
disable all axes
The controller
disables all motors.
It does
EMERGENCY STOP. The not
controller raises the fault stop
28 #ES System
bit when the ES signal is the
activated. progra
m
buffer
s.
INTEGRITY VIOLATION.
The controller raises the
No default
30 #INTGR System fault bit when an
response
integrity problem is
detected.
Fault
Bit Fault Fault Description
Category
8
MOTOR FAULTS. Each motor fault occupies one bit.
(one
FAULT Read-only Not all bits are occupied by faults. Only those bits
per
that correspond to motor faults are meaningful.
axis)
Read-only
SYSTEM SAFETY INPUTS. Bit #ES reads the current
(read/write
S_SAFIN Scalar state of the Emergency Stop input. Other bits are
for
meaningless.
Simulator)
8
Used to configure the delay time between the STO
(one
STODELAY Read-write fault indication and the default response (disable)
per
to the fault.
axis)
> Saved configuration values: files PAR.$$$ and PARn.$$$ , where n = 0,1…
> Saved ACSPL+ programs: files ACSPLnn.$$$, where nn = 00, 01, 02…
Firmware and the default files are present in the controller from the beginning and can be
replaced only by the Upgrade and Recovery Wizard of the SPiiPlus MMI Application Studio.
The saved files compose the user application. Saved files are created or replaced by the memory
management commands (See SPiiPlus Command & Variable Reference Guide).
Integrity Control is active for the all files specified above. The controller stores the size and
checksum of each file, existing or created. The controller then compares the stored size/checksum
with size/checksum of the actual file to expose damaged files. Validation is performed
automatically on power-up. After power-up you can use the IR command to validate files (see
Integrity Report Command).
#IR
Size Checksum
Registered Actual Registered Actual
C:\
sb1218pc.frm 001DA050 001DA050 DF4F97F0 DF4F97F0
model.inf 000014C3 000014C3 C5CC6B93 C5CC6B93
array.txt 00000010 00000010 00D4FF89 00D4FF89
1.prg 000002CB 000002CB D19BF636 D19BF636
ECAT.XML 00052B0A 00052B0A 4D35D447 4D35D447
C:\SB4\SP\
sp.### 0004FF0C 0004FF0C BCBB37F5 BCBB37F5
ADJ0.$$$ 0000017D 0000017D 8E1A3690 8E1A3690
sp.##1 0003DC8E 0003DC8E 0B678F5D 0B678F5D
c:\sb4\startup\
Acspl_e.$$$ 0000010B 0000010B 6C441150 6C441150
Par.$$$ 000001E9 000001E9 704245FA 704245FA
You can also use the ACSPL+ USAGE variable (see SPiiPlus Command & Variable
Reference Guide) to monitor the usage. This variable is particularly useful in
autoroutines for halting a program if the MPU usage is excessive.
XRMST XRMSTD SRMSTM XSACC XSEGRMAX XSEGRMIN XVEL SLABITS SLAFF SLBIASA SLBIASB SLCBITS
SLCFIELD SLCHALL SLCNP SLCOFFS SLCORG SLCPRD SLCRAT SLCROUT SLCSLIP SLDBITS SLDRA SLDRAIF
SLDROUT SLDRX SLDZMIN SLDZMAX SLEBIASA SLEBIASB SLFRC SLFRCD SLHRS SLIFAC SLIFILT SLIKI SLILI
SLIKP SLIOFFS SLPBITS SLPKI SLPKP SLPKPIF SLPKPSF SLPLI SLPMAX SLPMIN SLPROUT SLSTHALL
SLVB0DD SLVB0DF SLVBITS SLVB0ND SLVB0NF SLVKI SLVKIIF SLVKISF SLVKP SLVKPIF SLVKPSF SLVLI
SLVNFRQ SLVNWID SLVNATT SLVSOF SLVSOFD SLVRAT SLVROUT SLXROUT SLZFF SLVB1DD SLVB1DF
SLVB1ND SLVB1NF E_MODE E_PAR_A E_PAR_B SLFRCN SLDZTIME SLVKPDCF SLPKPDCF SLVKIDCF
SLGCAXN
The user is able to change the protection attribute for each variable individually.
The following command specifies the variable to be protected:
setprotection variable = 1
The following command specifies the variable to be not protected:
setprotection variable = 0
The variable is any standard variable name except the read only variables.
Only standard variables can be protected. Assignment to a user variable is allowed in any controller
mode.
If a variable represents an array, all elements of the array share the same protection attribute.
Therefore the array as a whole can be protected or not protected. Protection cannot be specified
for individual elements of the array.
The setprotection command can be executed only in configuration mode.
The program in the privileged buffer can change any protected variable, write to SP variables, start
and stop any other ACSPL+ program and execute any other action that in a regular buffer would
cause protection violation.
#SC
Bit Code Fault 0 1 2 3 4 5 6 7
0 #RL Right Limit K K K K K K K K
1 #LL Left Limit K K K K K K K K
2 #NT Network error D D D D D D - -
3 #FAN Cooling Fan Fault - - - - - - - -
4 #HOT Overheat - - - - - - - -
5 #SRL Software Right Limit K K K K K K K K
6 #SLL Software Left Limit K K K K K K K K
7 #ENCNC Encoder Not Connected D D D D D D D D
8 #ENC2NC Encoder2 Not Connected - - - - - - - -
9 #DRIVE Drive Alarm KD KD KD KD KD KD KD KD
10 #ENC Encoder Error D D D D D D D D
11 #ENC2 Encoder 2 Error - - - - - - - -
Addresses the left limit fault bit of axis 2. The bit is raised if the 2 left limit
FAULT(2).#LL
switch is activated.
FAULT Addresses the drive fault bit of axis 3. The bit is raised if the 3 drive safety
(3).#DRIVE input is active.
The aggregated motor fault bits occupy the same bit positions as the corresponding motor fault
bits in the FAULT variable. Use the designators of the motor faults to address the aggregated
motor fault bits.
Examples:
Addresses the aggregated Left Limit fault bit. The bit is raised if the Left
S_FAULT.#LL
Limit switch of any motor is activated.
S_
Addresses aggregated Drive fault bit. The bit is raised if the Drive safety
FAULT.#DRIVE
input of any motor is active.
Use the bit designators of the system faults to address the system fault bits.
Examples:
Addresses the Emergency Stop fault bit. The bit is raised when the
S_FAULT.#ES
Emergency Stop safety signal is active.
S_
Addresses the Program fault bit. The bit is raised when any program has
FAULT.#PROG
failed due to a run-time error.
The number in the left column is the bit number, followed by an ON/OFF indicator and the fault
description and the bit name in parentheses. In the above example all the faults are OFF except for
the Left Limit fault of one or more axes.
The S_FAULT variable indicates that there is a motor fault, but does not specify which motor has
failed. To determine which motor has failed, query the FAULT variable, or use ?$ to query the state
of all motors.
Fault bits can be queried individually:
?S_FAULT.#LL
1
?FAULT(0).#LL, FAULT1.#LL
0
1
The controller answers a query of an individual bit by showing the numerical value of the bit: either
0 or 1.
if FAULT(0).#LL | FAULT(0).#RL disp "X limit Display a warning if any limit switch of X
switch"end motor is active
The condition IF S_FAULT is satisfied if S_FAULT is non-zero, i.e., if any bit of S_FAULT is raised. Any
fault, either system or motor, raises a bit in S_FAULT. Therefore a non-zero S_FAULT indicates that
one or more faults are active.
The variables FAULT and S_FAULT display the current state of the faults. A conditional command
based on these variables uses the fault state at the instant when the command is executed. For
example, if the X left limit was activated but then released, FAULT0.#LL is zero, and the command if
FAULT0.#LL considers the condition unsatisfied.
on FAULT(0).#LL Start the autoroutine when an 0 axis Left Limit fault occurs
A fault-processing autoroutine can reside in any program buffer. When the buffer is compiled, the
controller checks the autoroutine condition each controller cycle. When the condition is satisfied,
the controller interrupts the program that is currently executing in the buffer that the autoroutine
resides in, and starts the autoroutine execution.
A fault-processing autoroutine can supplement or replace the default response to a fault. If the
corresponding FDEF or S_FDEF bit enables the default response, the autoroutine starts and
executes in parallel with the default response. If the corresponding FDEF or S_FDEF bit is zero, the
default response is disabled, and the autoroutine is the only controller response.
The controller examines all autoroutine conditions each controller cycle. However, if an
autoroutine is executing in a buffer, and a condition of the second autoroutine in the
same buffer is satisfied, the second autoroutine will start only after termination of the
subroutine currently executing. Therefore, if an application includes a time-consuming
autoroutine, avoid placing safety autoroutines that require short response times in the
same buffer with the time-consuming autoroutine.
Examples:
The following autoroutine displays a message when the Drive Alarm signal becomes active for the
0 axis motor:
on FAULT(0).#DRIVE
disp "Axis 0 Drive Alarm"
ret
In the following autoroutines, the 0 and 2 axes motors must be disabled simultaneously. Therefore,
if one of the drives fails, the second must be disabled as well. The default response disables the 0
axis motor if the 0 Drive Alarm occurs and disables the 2 axis motor if the 2 Drive Alarm occurs. The
following pair of autoroutines supplements the default response by disabling a motor if the other
motor fails:
When a 0 axis drive fault occurs, the following autoroutine terminates the controller activity for all
motors:
The S_FAULT variable contains the bits of the aggregated motor faults. These bits provide a
convenient alternative to the motor faults if an application requires common processing of a motor
fault irrespective of which motor caused the fault.
For example, the following autoroutine displays a message when the Left Limit switch of any motor
is activated:
on S_FAULT.#LL
disp "One of the Left Limit Switches is Activated"
ret
Autoroutine conditions can contain more than one fault bit, as is shown here in the first line of the
example:
on S_FAULT.#LL | S_FAULT.#RL
disp "Some Limit Switch Activated"
ret
The S_FAULT variable (used without a bit extension) indicates whether a fault has been detected
by the controller. The following example shows an autoroutine that provides an alarm message if
any fault occurs in the controller:
on S_FAULT
disp "Something happened"
ret
The controller activates an autoroutine when the condition of the autoroutine changes from false
to true. If the condition remains true, the autoroutine is not activated again until the condition
becomes false, and then true again. Therefore the above autoroutine displays the alarm message
only on the first fault. If one fault bit is already raised, and another fault occurs, the second fault
does not generate an alarm message.
The following autoroutine displays a fault message each time a fault occurs:
int LastFault
on LastFault <> S_FAULT
if (LastFault ~ S_FAULT) & S_FAULT
disp "Something happened"
end
LastFault = S_FAULT
ret
In the above example the local variable LastFault stores the current value of S_FAULT. The
exclusive OR (~) of LastFault and S_FAULT detects the bits of S_FAULT that changed. The AND (&)
with S_FAULT retains only the bits that changed from zero to one, and not from one to zero.
Certain safety variables provide protection against potential serious bodily injury and
damage to equipment. Be aware of the implications before disabling any alarm, limit or
error.
The ACSPL+ variables define which faults are examined and processed. If a bit of FMASK or S_
FMASK is zero, the corresponding fault is disabled and the bit of FAULT or S_FAULT is not raised.
FMASK and S_FMASK are queried like any other variable, and the controller reports the status of
each meaningful bit.
Example:
?FMASK(0)
0 ON Right Limit (#RL)
1 ON Left Limit (#LL)
2 ON Network error (#NT)
4 ON Overheat (#HOT)
5 ON Software Right Limit (#SRL)
6 ON Software Left Limit (#SLL)
7 ON Encoder Not Connected (#ENCNC)
8 ON Encoder 2 Not Connected (#ENC2NC)
9 ON Driver Alarm (#DRIVE)
10 OFF Encoder Error (#ENC)
Normally, you enable or disable fault detection through the Adjuster wizard of the SPiiPlus MMI
Application Studio (see the SPiiPlus MMI Application Studio User Guide) when initially configuring
the controller. The configured values of FMASK and S_FMASK are then stored in the flash memory
and left unchanged during the application lifetime.
Changes to safety variables after initial controller configuration may affect your application. The
following section is relevant only if you need to enable or disable faults after initial configuration.
Example:
The bits of SAFIN and S_SAFIN reflect the physical states of the signals, while the bits of SAFINI and
S_SAFINI define the logical processing of the signals. SAFINI and S_SAFINI variables have no effect
on the physical signal, and the bits of variables SAFIN and S_SAFIN, which display the raw values of
the safety inputs are unaffected by the bits of SAFINI, S_SAFINI
The variables SAFINI and S_SAFINI are queried like any other variable. The controller reports the
status of each meaningful bit that corresponds to a safety signal.
Example:
?SAFINI(0)
0 ON Right Limit (#RL)
1 ON Left Limit (#LL)
4 OFF Overheat (#HOT)
9 OFF Driver Alarm (#DRIVE)
?S_SAFINI
28 OFF Emergency Stop (#ES)
31 OFF Component Failure (#FAILURE)
In the above example, the fact that the response to the SAFINI(0) query shows that RL and LL are
ON (bits 0 and 1) indicates that you have defined inverse polarity (low active level) for signals #RL,
#LL of the 0 axis.
Normally, you define the signal polarity through the Adjuster wizard of the SPiiPlus MMI Application
Studio (see the SPiiPlus MMI Application Studio User Guide) when initially configuring the controller.
The configured values of SAFINI and S_SAFINI are then stored in the flash memory and are not
changed during the application's lifetime.
Example:
> In the strict mode the next motion command cannot activate the motion and fails. The
motion cannot be activated as long as the reason for the previous kill is non-zero for any
involved motor.
The reason for a kill operation is stored in the MERR variable. In the strict mode as long as a MERR
element is non-zero, the corresponding motor cannot be put in motion. Commands ENABLE and
FCLEAR clear the MERR elements for the specified motors and enable the next motion.
The same rules apply to the results of a KILL command with non-zero second argument (the
reason for the kill - see KILL and KILLALL Commands). The reason is stored in the MERR element and
in the strict mode the next motion cannot be activated until the reason is cleared.
In the regular mode the behavior is simple and totally compatible with previous versions. However,
you may prefer the strict mode, especially during application development. The following example
gives a hint why the strict mode may be preferable:
Reciprocated:
PTP/r 0,10000
PTP/r 0,-10000
GOTO Reciprocated
Under normal conditions the motor continuously moves forward and backward by 10,000 units.
Assume, however, that the first motion brings the motor to the right limit switch. The first motion
terminates prematurely, because the motor is killed. However, the program continues running and
executes the second motion command. In the regular mode the second motion starts successfully
because it is directed out of the limit. Then the first motion command again brings the motor to the
limit. Therefore, in the regular mode the reciprocated motion continues and there is no clear
indication of abnormal condition.
Assume further, for the same application, that a broken connection to the right limit switch causes
the controller to mistakenly continuously detect that the right limit has been passed. The first
motion fails immediately after start, but the second one executes. The result is that the motors
move in a negative direction by steps of 10,000 units.
In the strict mode, the behavior is more predictable. After the first motion failed, the second one
cannot start and the program itself terminates with error. You can check the information in MERR
and PERR to disclose the reason for the failure.
If at any point of the application a fault is an expected condition and the program must continue,
the program in the strict mode must analyze the MERR element and execute the FCLEAR command
before activating the next motion.
To overcome this, run #HWRES (Reboot controller) in the SPiiPlus MMI Application Studio
Communication Terminal, or perform a complete power down, and then power up to reset this
node.
Other nodes may keep functioning, if their response to Network Fault is masked.
= Hazardous Area
= Prohibited Area
=Limit Switch
Based
upon
SAFIN.#LL, SAFIN.#RL (in each element of SAFIN)
safety
signals
Inversion
SAFINI.#LL, SAFINI.#RL (in each element of SAFINI)
bits
Internal
safety None
condition
Default
response FDEF.#LL, FDEF.#RL (in each element of FDEF)
bits
Autoroutine examples:
The first example supplements the default processing of X limit faults with alarm messages:
DISP "0 Left Limit switch activated" Display the message: 0 Left Limit switch activated.
RET
DISP "0 Right Limit switch activated" Display the message: 0 Right Limit switch activated.
RET
This second example implements an autoroutine that disables the motor rather than the default
response of killing the motion in case of a right limit or left limit fault. This response may be
superior to the default response if the motor is equipped with a brake that is activated by the
disable command because the brake may stop the motor faster than a kill command.
ON FAULT(2).#RL | FAULT When there is a right limit or left limit fault in the 2 axis
(2).#LL. motor.
RET
Inversion bits
Based
upon
None
safety
signals
Inversion
None
bits
Internal
safety See explanation below.
condition
Default
response FDEF.#SLL, FDEF.#SRL (in each element of FDEF)
bits
The controller kills the violating motor. As long as the fault is active, the
Default
controller kills any motion that tries to move the motor in the direction of the
response
limit. Motion in the direction out of the limit is allowed.
ON FAULT(0).#SLL
DISP "0 Software Left Limit violated"
RET
ON FAULT(0).#SRL
DISP "0 Software Right Limit violated"
RET
Use the #PE fault to detect non-critical violation of position accuracy, and the #CPE (see Critical
Position Error: #CPE) fault to detect uncontrolled, excessive error that indicates loss of control.
The following ACSPL+ variables are associated with position errors:
> ERRI – Maximum position error while the motor is idle (not moving)
> ERRV – Maximum position error while the motor is moving with constant velocity
> ERRA – Maximum position error while the motor is accelerating or decelerating
> DELI – Delay on transition from ERRA to ERRI
> DELV – Delay on transition from ERRA to ERRV
The controller raises the FAULT.#PE bit if the position error exceeds the maximum specified value,
which is equal to ERRI, ERRV or ERRA depending on the motion state.
The variables DELI and DELV are used in a similar manner with the #CPE fault.
The following diagram illustrates the use of these variables for a typical motion profile that includes
acceleration, constant velocity and deceleration:
V
PE > ERRI PE > ERRA PE > ERRV PE > ERRA PE > ERRI
DELV DELI
ON FAULT(1).#PE
DISP "Accuracy violation - the motion was killed"
RET
The next example corrects the motion conditions by reducing the velocity (VEL1) until the error
returns to within limits, instead of killing the motion.
The above autoroutine executes an undefined number of loops with delays in each
loop. Therefore, the execution time may be significant. As long as the autoroutine
executes, no other autoroutine in the same buffer can be activated. Do not place this
autoroutine in the same buffer that contains any time-critical autoroutine.
Use #PE fault (see Non-Critical Position Error: #PE) to detect non-critical violations of position
accuracy, and the #CPE fault to detect uncontrolled, excessive error that indicates loss of control.
#CPE should be greater than #PE.
The following ACSPL+ variables are associated with critical position error:
> CERRI - Critical position error if the motor is idle (not moving)
> CERRV - Critical position error if the motor is moving with constant velocity
> CERRA - Critical position error if the motor is accelerating or decelerating
> DELI - Delay on transition from CERRA to CERRI
> DELV - Delay on transition from CERRA to CERRV
The variables DELI and DELV are used also in the condition for the #PE fault.
The controller raises the fault bit if the position error exceeds the critical value. The critical value is
equal to CERRI, CERRV or CERRA depending on the motion stage. The following diagram illustrates
the use of these variables for a typical motion profile that includes acceleration, constant velocity
and deceleration:
V
CPE > CERRI CPE > CERRA CPE > CERRV CPE > CERRA CPE > CERRI
DELV DELI
ON FAULT(3).#CPE
DISP "Axis 3 shows abnormal error. The motor was disabled."
RET
Based
upon
None
safety
signals
Inversion
None
bits
The controller latches fault #ENC if the phase shift between the signals of the
Internal primary encoder is lost, indicating a faulty encoder or noisy environment.
safety
condition The controller latches fault #ENC2 if the phase shift between the signals of the
secondary encoder is lost, indicating a faulty encoder or noisy environment.
Default
response FDEF.#ENC, FDEF.#ENC2 (in each element of FDEF)
bits
The controller disables the violating motor. The faults remain active until the
Default
user resolves the problems and enables the motor again or executes the
response
FCLEAR command.
Unlike most faults, #ENC and #ENC2 faults are latched. The fault bits remain raised even after the
cause of the fault has been eliminated. Only the next enable command resets the fault bits.
Occurrence of an #ENC fault indicates a serious problem in motor control. Do not disable the default
response unless it is absolutely necessary in your application, i.e., keep FDEF.#CPE = 1.
Autoroutine examples
The following autoroutine supplements the default response with an alarm message:
ON FAULT(2).#ENC
DISP "Encoder Error in 2 axis. The motor was disabled."
RET
If the controller detects a pair of differential encoder inputs that are not in opposite states (high
and low level), it raises the fault because this may indicate a problem such as a short circuit or
unconnected wire.
An #ENCNC fault indicates a serious problem in motor control. Do not disable the default response
unless it is absolutely necessary in your application, i.e., keep FDEF.#CPE = 1.
Autoroutine examples
The following autoroutine supplements the default response with an alarm message:
ON FAULT(0).#ENCNC
DISP "Axis 0: Encoder Not Connected. The motor was disabled."
RET
Based
upon
SAFIN.#DRIVE (in each element of SAFIN)
safety
signals
Inversion
SAFINI.#DRIVE (in each element of SAFINI)
bits
Internal The controller never sets the fault bit while the motor is disabled. The controller
safety starts monitoring the fault condition when the period of time defined by
condition variable ENTIME elapses after the motor has been enabled.
Default
response FDEF.#DRIVE (in each element of FDEF)
bits
Default
The controller disables the violating motor.
response
ON FAULT(2).#DRIVE
DISP "Axis 2 Drive Alarm. The motor was disabled"
RET
Autoroutine examples:
The first autoroutine activates the OUT(0).1 output, which could be wired to switch on an additional
motor ventilation fan. The second routine switches off the fan when the fault is no longer active:
ON FAULT(1).#HOT
OUT(0).1 = 1
RET
ON ^FAULT(1).#HOT
OUT(0).1 = 0
RET
ON FAULT(2).#VL
DISP "Axis 2 velocity limit was exceeded"
RET
ON FAULT(0).#AL
DISP "Axis 0 Acceleration limit exceeded. The motor was disabled."
RET
The current limit fault is based on the Servo Processor algorithm that calculates the RMS value of
the motor current. When the calculated RMS current exceeds the allowed value the Servo
Processor reports an error that the MPU translates into a current limit fault.
Current limit processing uses the following ACSPL+ variables:
> XRMS – Maximum allowed RMS current for each drive
> XRMSD – Maximum allowed RMS current for each drive
> XRMSM – Maximum allowed RMS current for each motor
> XCURI – Maximum instantaneous current if the motor is idle (not moving)
> XCURV – Maximum instantaneous current if the motor is moving
Use the SPiiPlus MMI Application Studio SAFETY AND FAULTS CONFIGURATOR to configure the
specified variables.
Autoroutine example:
The following autoroutine kills the motion (and displays an alarm message) instead of the motor.
(The default response can be disabled by adding FDEF.#CL = 0 to the ACSPL+ program.)
ON FAULT(1).#CL
KILL 1
DISP "Axis 1 RMS current limit exceeded. Motor halted."
RET
Internal safety If the Servo Processor lost synchronization with MPU, raise
condition FAULT.#SP
#SP indicates that communication between the MPU and one of the servo processors failed. The
occurrence of the #SP fault indicates a serious hardware problem.
Do not disable the default response unless it is absolutely necessary in your application, i.e., keep
FDEF.#SP = 1.
This fault may be caused by a problem in the SP program. If the SP program hangs, the fault
remains permanent. If the SP program time exceeds the tick time (50 µsec), the fault is
intermittent.
The disable reason reported by the controller is 5027 'Servo Processor Alarm'.
Autoroutine example:
The following autoroutine supplements the default response with an alarm message.
ON FAULT(1).#SP
DISP "Axis 1 Servo Processor Alarm"
RET
Internal safety condition The controller raises fault bit #HSSINC if HSSI is not connected.
ON FAULT(0).#HSSINC
DISP "Axis 0: HSSI not connected."
RET
Autoroutine example:
The following autoroutine kills all motions but does not disable the motors (this assumes that the
default response has been disabled by S_FDEF.#ES = 0).
ON S_FAULT.#ES
KILLALL
RET
Internal safety The controller latches the fault when any ACSPL+ program
condition encounters a run-time error.
Default response
S_FDEF.#PROG
bits
Unlike most faults, the #PROG fault is latched. Once raised, the bit remains raised until the controller
resets it on execution of any command that compiles or starts a program in any buffer.
Autoroutine examples:
The following autoroutine supplements the controller's default response, terminating all
concurrent programs and displaying an alarm message.
ON S_FAULT.#PROG
STOPALL
DISP "Run-time error"
RET
A run time error in a buffer stops all activity in the buffer. Therefore, the above autoroutine cannot
intercept an error that occurred in the buffer where the autoroutine is located. However, it
intercepts an error in any other buffer.
This autoroutine can supplement the default response (S_FDEF.#PROG = 1) or can replace it (S_
FDEF.#PROG = 0).
The following autoroutine does the same (stops all programs) and also provides a diagnostic
message.
ON S_FAULT.#PROG
STOPALL
I0 = 0
LOOP IO
IF PERR(I0) >= 3020
DISP "Program ", I0, " failed. Error ", PERR(I0)
END
IO = 1O + 1
END
RET
The ACSPL+ PERR variable contains the termination codes of the ACSPL+ programs. Each element of
PERR contains a termination code for a different buffer. At power-up all elements of PERR are reset
to 0. When a program in any buffer finishes or terminates for any reason, the corresponding
element of PERR is assigned with a code that specifies the termination reason. The element resets
to zero again once the corresponding buffer is compiled or its program execution starts.
Termination codes from 3000 to 3020 indicate normal termination. Codes greater than or equal to
3020 indicate run-time errors (see SPiiPlus Command & Variable Reference Guide for a complete
breakdown of the termination codes).
Based upon
None
safety signals
Internal safety The controller latches the fault bit when the user application requires
condition more memory than is available in the controller.
Default
S_FDEF.#MEM
response bits
Default
The controller kills all executed motions.
response
Unlike most faults, the #MEM fault is latched. Once raised, the bit remains raised until the controller
resets it on execution of any command that compiles or starts a program in any buffer.
Because the controller uses dynamic memory handling, the amount of the memory available for a
specific user application cannot be exactly determined. If an application raises this fault, you need
to reduce the size of the application or add memory.
The following recommendations may be useful in eliminating the error:
> Reduce the length of ACSPL+ programs.
> Reduce the volume of user local and global variables. Pay special attention to arrays.
> Limit the length of commands that are sent to the controller. Do not use commands that
exceed 2032 characters.
> Simplify the formulae used with the CONNECT and MASTER commands.
Autoroutine example:
The following autoroutine terminates all executing programs and displays an error message when
the fault occurs.
ON S_FAULT.#MEM
STOPALL
DISP "Memory overflow"
RET
This routine can supplement the default response (S_FDEF.#PROG = 1) or can replace it (S_
FDEF.#PROG = 0).
Internal safety condition The user application demands too much processing time.
The controller raises the fault bit when the user application consumes too much processing time
and S_FMASK.#TIME bit is raised.
The structure of the controller’s realtime cycle is discussed in Realtime and Background Tasks.
As the realtime processing time varies between cycles, the fault may occasionally occur and
requires no special attention. However, frequent or permanent occurrence of the fault requires
measures to correct the situation.
The controller has no default response to the fault. To monitor this fault, you must define your own
autoroutine.
The following recommendations may be useful in reducing real time processing time, thereby
eliminating the fault:
> Reduce the number of concurrently executed programs.
> Reduce the program execution rates (variables PRATE, ONRATE).
> Reduce the number of command specified in one program line.
> Reduce the number of autoroutines.
> Simplify the conditions in the autoroutines.
> Reduce the number of concurrently executed motions.
> Avoid short-time motions.
> Use segmented motion instead of a series of short PTP motions.
> Simplify the formula used in the CONNECT and MASTER commands.
Autoroutine example:
The following autoroutine accumulates statistics on the fault. The routine measures a time of 1000
fault occurrences and then displays the average time between faults. The routine relies on zero
initialization of the local variables.
Internal safety The controller raises the fault bit when the servo interrupt is not
condition generated or is irregular.
Default response
S_FDEF.#INT
bits
The Servo Interrupt fault indicates a serious failure. Do not disable the default
response unless it is absolutely necessary in your application, i.e., keep FDEF.#INT = 1.
The MPU sets the fault if the 1ms interrupt is not received. The probable cause is a hardware
problem. The controller response to the fault is to disable all motors. The disable reason reported
by the controller is 5029 'Servo Interrupt'.
Autoroutine example:
The following autoroutine supplements the default response with termination of all ACSPL+
programs and an alarm message.
ON S_FAULT.#INT
STOPALL
DISP "Main interrupt is missing"
RET
Some components other than Drive, for example, power supply, I/O extension card or encoder
card, may have fault outputs that are common for all components. The controller provides system
faults that by default disable all axes if fault occurs.
The controller provides special functions that retrieve the card malfunctioned information
(according to address on the I2C bus) and the fault reason. This allows to user to write an ACSPL+
application that provides user-defined responses for different component faults. The components
that have such outputs provide a special jumper that connects or disconnects the fault output to
the controller.
Component Failure fault is treated as any other system fault. There is a dedicated bit 31 (#FAILURE)
for this fault in S_FAULT, S_FMASK, S_SAFIN, S_SAFINI and S_FDEF.
You use this variable for triggering a response that you have
S_FDEF.#FAILURE programmed.
(orS_FDEF.31) 1 = An MC4U hardware component other than the drive, such as
the Power Supply, I/O card, or encoder card, has failed.
S_SAFIN.#FAILURE Indicates the actual status of the Component Failure controller input -
(or S_SAFIN.31) see Examining System Fault Conditions.
S_SAFINI.#FAILURE
Used for inverting the Component Failure input logic.
(or S_SAFINI.31)
# Local variables
INT res, error, i2c_addr, dev, nexterr
ON S_FAULT.#FAILURE
REP:
res = GETCONF(247, 0)
error = res & 0x7FFF
nexterr = res.15
i2c_addr.0 = res.16
i2c_addr.1 = res.17
i2c_addr.2 = res.18
dev.0 = res.24
dev.1 = res.25
dev.2 = res.26
dev.3 = res.27
dev.4 = res.28
dev.5 = res.29
dev.6 = res.30
dev.7 = res.31
DISP “ERROR =”,error
DISP “I2C ADDRESS =”,i2c_addr
DISP “DEVICE =”,dev
IF(nexterr)
GOTO REP
RET
The SAFIN and S_SAFIN variables are normally read-only. However, they can be written
to when working with the Simulator, to simulate safety inputs.
Internal Safety
Conditions
XOR
Variable FMASK
AND
Variable FAULT
Internal Safety
Conditions XOR
Variable S_FMASK
AND
Variable S_FAULT
The upper part of the diagram shows how motor faults are examined. The list of faults is identical
for each motor and the controller repeats the process for each motor. The end product is the
ACSPL+ FAULT variable.
The lower part of the diagram shows the elements that go into constructing the S_FAULT variable.
Part of its bits are set as the OR-aggregate of the FAULT elements, and other bits are determined
by examining the system faults.
IF SAFIN(0).#DRIVE V0 = 1 ELSE V0 = -1
END
assigns a value of 1 to variable V0 if the Drive Alarm signal of the 0 axis motor is high and -1 if low.
The SAFINI configuration variable defines which level of motor safety input causes a fault. In the
above diagram XOR is a bit-wise operation. Therefore, if a bit of SAFINI is zero, high voltage of the
corresponding signal causes fault. If a bit of SAFINI is 1, low voltage causes fault. Only those bits of
SAFINI that correspond to the meaningful bits of SAFIN are used in fault processing. Other bits have
no effect.
In addition to the safety inputs, the controller examines a number of internal safety conditions for
each motor each controller cycle. The faults caused by the motor safety inputs and the faults
detected by internal conditions provide a set of motor faults.
A detected motor fault is stored in a bit of variable FAULT only if the corresponding bit of variable
FMASK is 1. If a bit of FMASK is zero, the controller does not raise the corresponding fault bit even if
the fault condition or safety input is true. If a bit of FMASK is set to 1, the corresponding bit of FAULT
is immediately set when the fault occurs. The bit rises to 1 or drops to zero in the same controller
cycle as the corresponding safety input or internal safety condition shows change in the fault state.
Only those bits of FAULT that correspond to the motor faults are meaningful.
When a bit is raised, it activates the default response to the fault. An Autoroutine that processes
the fault must use the bit of FAULT in as the condition.
The controller's default safety configuration and responses fit the needs of most
applications.
Only an experienced user should make modifications to the safety configuration.
Improper configuration may result in unsafe operation, may damage the equipment,
and may constitute a hazard to personnel.
As mentioned earlier in this chapter, the controller response to a fault can be modified with the
ACSPL+ FDEF/S_FDEF variables and with autoroutines.
The #SC terminal command reports the current safety system configuration (see Report Safety
Configuration).
There are several other options for safety system configuration:
Safety groups
Two or more axes can be combined in a safety group. All axes belonging to the safety
group respond to any fault synchronously. If a fault affects one axis in the group, it
immediately affects all the other axes in the group (refer to the SAFETYGROUP command
in the SPiiPlus Command & Variable Reference Guide).
Kill -disable response
In response to a fault, the controller executes KILL, decelerates the motor to zero velocity,
and then disables the motor.
Changing response without an autoroutine
An axis can respond to a fault in one of the following basic ways:
No response
Kill response
Disable response
Kill-disable response
For each type of fault, the controller defines a default response, which can be overridden
with an autoroutine. The SAFETYCONF command (refer to the SAFETYCONF command in
the SPiiPlus Command & Variable Reference Guide) switches an axis between the four
basic fault responses. An autoroutine is only required if the desired response is not one of
the these.
Fault generalization
The fault response for a specific fault and a specific axis can be generalized to affect all the
axes. For example, by default the 0 Drive Alarm fault disables the 0 axis motor, but has no
affect on the 1 axis motor or any other motor. However, if you generalize the Drive Alarm
fault for axis 1, the 1 axis motor will be affected by a Drive Alarm fault on any axis.
Specific motor configuration
The default configuration for all axes is identical. For example, the default response to a
Limit Switch fault is to kill motion. However, the response can be modified individually for
each motor. For example, if a Limit Switch fault occurs, the 0 axis motor can be killed while
the 1 axis motor is disabled.
The ACSPL+ variables that provide access from your application to the control object are shown to
the left. The following variables are available:
> RPOS – Reference Position, array of eight elements, contains the desired motor position
calculated by the controller.
> FPOS – Feedback Position, array of eight elements, reads the current motor position.
> IND – Index Position, array of eight elements, reads the position of the last encountered
encoder index.
> MARK – Mark Position, array of eight elements, reads the position of the last encountered
Mark signal.
> M2ARK – Secondary Mark Position, array of eight elements, reads the position of the last
encountered Mark2 signal.
> FAULT – Faults, array of eight elements, the bits of the variable report the axis-related
faults detected by the safety control
> S_FAULT – System Faults, scalar, the bits of the variable report the system faults detected
by the safety control.
> IN – General Purpose Inputs, array of eight elements, each bit reports the state of one
general-purpose input.
> OUT – General Purpose Outputs, array of eight elements, each bit defines the state of one
general-purpose output.
> AIN – Analog Inputs, array of 16 elements, each element reads the numerical value of the
voltage supplied to one analog input. The number of analog inputs varies depending on
the controller model.
> AOUT – Analog Outputs, array of 16 elements, each element defines the voltage
generated by one analog output. The number of analog inputs varies depending on the
controller model.
> EXTIN – Extended Inputs, array of eight elements, each bit represents a bit in the input or
HSSI register.
> EXTOUT – Extended Outputs, array of eight elements, each bit represents a bit in the HSSI
register
Internal Multiplier x4
EFAC(0) = 1 / (500*4)
Where:
Internal Multiplier x4
User units mm
User units mm
Internal Multiplier x4
User units mm
where FPOS is the controller feedback position in user units, FP is an SP-calculated feedback
position in encoder counts, EFAC is a user-defined value of the corresponding EFAC factor, and
EOFFS represents an offset.
EOFFS is a read-only standard variable that provides the offset between the SP-calculated position
and the controller feedback position. The value of EOFFS changes when the set command defines a
new origin for an axis.
When writing the reference position to the SP, the controller executes a direct transform given by
the formula:
The above is only accurate for Digital encoders.In the case of SIN-COS encoders, FPOS(0)
is an interpolated value that contains a position in between zero-crossing of the SIN-
COS signals.
Interpolation is done in the software and the hardware has the ability of latching only
the zero crossings of the sine-cosine.So when you reset IST(0).#IND on the rising edge
of the pulse, it latches the current value of the zero-crossing counter.
This is a low resolution counter that counts the quadrants of the SIN-COS. If the rising
edge is detected a little bit before the zero crossing, the counter still has the previous
zero-crossing position as shown in the following diagram:
The latching is done on the “Quad” signal that has a coarse resolution.So IND holds the
zero-crossing position of SIN-COS only.
The following program fragment reports the index value each time that the index is encountered:
device. Analog inputs and outputs have no predefined function in the controller. You can connect
signals to inputs and outputs and process them as required by the application.
The analog inputs are represented by the integer array: AIN and the analog outputs are
represented by the integer array: AOUT. Each analog input/output is represented by one array
element. The range of the AIN and AOUT arrays depends on the type of the input or output and
the bit resolution of the ADC or DAC.
Example: for ±10V analog outputs, the AOUT range is from -100 (for -10V) to +100 (for +10V).
Example: for ±10V analog inputs ,the AIN range is from-100 (for -10V) to+100 (for +10V) .
If an analog output is connected to a drive, it has a dedicated destination and cannot be used as a
general-purpose analog output.
For model-dependent analog I/O information (for example, the number and range of inputs and
outputs) see the controller's Hardware Guide.
The following example represents an autoroutine in the UDI that displays a message when the
voltage in the 1st analog input rises above +7.5V.
ON AIN1 > 75 !Activate autoroutine once the value of AIN1 exceeds 75(+7.5V)
DISP “AIN1 > 7.5V" !Display a message
RET !End of the autoroutine
8. Advanced Features
This chapter describes various advanced ACSPL+ programming features that are available to you.
Topics covered are:
> Data Collection
> PEG Overview
> Sin-Cos Encoder Multiplier Configuration
> Interrupts
> Dynamic Braking
> Constant Current Mode
> Hall Sensor Commutation
> Communicating with the SPiiPlus C Library
> Communicating with Non-ACS Devices
> TRIGGER Command
> Dynamic TCP/IP Addressing
> Non-Default Connections
> Input Shaping
> DRA Algorithm
> BI-Quad Filter
8.1.1 DC Command
Description
The DC command is used for executing data collection.
Syntax
DC [/switch] [axis], array_name, #_of_samples, period, list_of_variables
STOPDC [/switch] [integer]
Where switch can be one or a combination of:
Create the synchronous data collection, but do not start until a GO command is issued.
w
W can only be used with the S switch.
c Start cyclic data collection (can be used with switches S and W).
> Data collection started by the DC command without the S switch is called system data
collection.
> Data collection started by the DC/S command is called axis data collection.
> Data collection started by the DC/C command is called cyclic data collection.
Unlike the standard data collection that finishes when the collection array is full, cyclic data
collection does not self-terminate. Cyclic data collection uses the collection array as a cyclic buffer
and can continue to collect data indefinitely. When the array is full, each new sample overwrites the
oldest sample in the array. Cyclic data collection can only be terminated by the STOPDC Command.
Arguments
Array that stores collected data. The array must be previously defined as global,
array_
integer or real. The array size must be compatible with the number of samples
name
and number of stored variables (see Understanding System Data Collection).
#_of_
The number of data samples to collect.
samples
Sampling period in milliseconds. Actual sampling period may differ from this
value, because the controller rounds it to an integer number of controller
period periods. For example if you set the period to 3.3 milliseconds, the controller will
round it to 3 milliseconds. If switch T is included in the command, the parameter
defines a minimal period (see explanation of temporal data collection below).
Up to eight variable names, whose values are to be collected. Each variable can
be a scalar variable, or an element of an array. Both local and global variables can
list of
be specified. Irrespective of the storage array type, any combination of integer
variables
and real variables is allowed - the controller automatically executes type
conversion if required.
Arguments
number_of_ The number of samples to collect, the maximum value depends on the size of
samples the array.
sampling_
The time, in millisecords, that each sample is taken.
period
SP_
The address of the Servo Processor variable in the Servo Processor to sample,
Address1
SP_ As an option, you can add another address of an other Servo Processor
Address2 variable in the Servo Processor to sample,
The minimum sampling period is 0.05 millisecond, which defines a sampling frequency of 20kHz.
The maximum sampling period is limited by CTIME value. By default, CTIME is 1 millisecond, which
restricts sampling period to 1 millisecond maximum.
The controller rounds the specified period to an integer number of minimal periods and restricts it
to the permitted range.
Axis State – Bit #DC in this bit-mapped variable is ON while an axis (started with /S)
AST data collection for the corresponding axis is in progress. The bit is OFF if no axis
collection for the axis is executed.
DC Number of Samples (axis variable) – While an axis data collection is in progress the
variable displays the index of the array element that stores the next sample. When
an axis data collection for the corresponding axis terminates, the variable stores the
DCN number of actually collected samples. If the data collection terminates automatically,
the variable is always equal to the requested number of samples specified in the DC
command. If the data collection terminates due to the STOPDC command, the
variable may be less than the requested number of samples.
DC Period (axis variable) – When an axis data collection for the corresponding axis
terminates, the variable stores the sampling period. Unless a temporal data collection
DCP was executed, the variable is always equal to the requested period specified in the
DC command. For temporal data collection (/T) the variable may be greater than the
requested minimal period.
System DC Period – When a system data collection terminates, the variable stores the
sampling period. Unless a temporal data collection was executed, the variable is
S_ always equal (see explanation of the PERIOD parameter above) to the requested
DCP period specified in the dc command, unless it was rounded to the controller cycle. For
temporal data collection (/T) the variable may be greater than the requested minimal
period.
System State – Bit: #DC in this bit-mapped variable is ON while a general (started
S_
without /S) data collection, either standard or cyclical, is in progress. The bit is OFF if
ST
no general collection is executed.
Data collection is disabled when the SPiiPlus MMI Application Studio SCOPE is operating.
When the controller executes the DC command, it starts a separate real-time data collection
process that progresses in parallel with ACSPL+ programs and motion execution. Each sampling
period the process latches the values of all specified variables and stores them in the specified
array. The process continues until the specified number of samples is stored, or the command
STOPDC is executed. After process termination the array contains a time series of the specified
variables that may then be used for data analysis.
This is shown in the following example:
> In the first line, a matrix consisting of two lines and 1,000 columns is set up for data
collection
> The second line starts the data collection of the Feedback Position values for axes 0 and 1.
990 samples are to be collected, with a period of three milliseconds. The first step of the
data collection stores the current value of FPOS0 in DCA(0)(0) and FPOS1 in DCA(1)(0). The
second step stores FPOS0 in DCA(0)(1) and FPOS0 in DCA(1)(1).
Each variable is stored in one line of the array. Therefore the first dimension of the array (the
number of lines) must be equal or greater than the number of variables. If the number of lines is
greater than the number of variables, the extra array lines remain unaffected by the data
collection. If only one variable is specified for data collection, a one-dimensional array is allowed.
Each sample of data collection fills up one column of the array. Therefore the second dimension of
the array (number of columns) must be equal or greater than the requested number of samples. If
the number of columns is greater than the number of samples, the extra array columns remain
unaffected by the data collection. The following examples show incorrect usages of the DC
command.
The following DC command is not allowed because the number of variables exceeds the number of
array lines:
The following DC command is not allowed, because the number of required samples exceeds the
number of array columns:
If /S is not specified, the system data collection process starts immediately after executing the dc
command. Normally, data collection stops automatically after <number of samples> x <period>
milliseconds. If the STOPDC command executes while the data collection is in progress, the data
collection stops prematurely, and the remaining array columns remain unaffected. To terminate
system data collection, the STOPDC command must contain no parameters.
The variable S_DCN provides the number of samples stored during data collection.
global
Set up a one-dimensional 1000-line array for collecting data about a user-
int IA, IC
defined integer variable.
(1000)
global
real RA Set up a two dimensional array with two columns and 2000 lines for collecting
(2) data about a real user-defined variable.
(2000)
DC IC,
1000, 1, Collect 1000 samples of AOUT on the 0 axis at a rate of one per millisecond.
AOUT(0)
DC RA,
Collect 2000 samples of FPOS on axis D, at a rate of 3 per millisecond (it should be
2000,
noted that the command calls for 2.5 milliseconds, but the controller rounds it up
2.5, IA,
to the nearest whole number).
FPOS(7)
DC RA,
500, 1, Collect 500 samples of the ACSPL+ variable TIME at a rate of one per millisecond
TIME
synchronizes data collection to the start of motion of axis 0, but collects data on both axes 0 and 1.
Only one data collection process, started by the DC command, can execute at a time. The next DC
command can execute only after the data collection started by the previous DC command finishes.
However, data collection, initiated by the DC/S command, may progress in parallel with the data
collection initiated by the DC command. Moreover, several data collection processes initiated by the
DC/S command may progress in parallel, providing they refer to different axes or axis groups. For
example these two commands are executed serially:
DC/s 0, Array,500,1,FPOS(0)
DC/s 0, Array,500,1,FPOS(1)
While these commands are executed in parallel (unless the 0 and 1 axes belong to the same axis
group):
DC/s 0,Array,500,1,FPOS(0)
DC/s 1,Array,500,1,FPOS(1)
It should be noted that the syntax of STOPDC that terminates synchronous data collection has been
changed. If your application uses synchronous data collection, slight changes may be required. To
terminate a synchronous data collection that was commanded by a DC/S command, the STOPDC
command must also have switch S. For example:
DC/s Start synchronous data collection by axis 0 to a global real array ARR of
0,ARR,50,10,VAR1 size 50, sampling period 50, collect global variable VAR1.
Each PEG engine can generate 1 PEG pulse: PEGx_PULSE (both in Incremental and Random modes)
signal and 4 state signals (in Random mode only): PEGx_STATEy - a 4-bit output vector, on each
random position PEG event. State signals are set to a defined logical level or set to generate a pulse
on transition, as defined by a 256/1024 member PEGx_STATE_ARRAY integer array.
The PEG engines can be configured to be triggered by a position of any of the controller Encoders,
with certain restrictions that result from the board’s architecture.
The PEG engine outputs can be assigned to 10 physical interface outputs and the PEG pulse width
and polarity are programmable.
Routing of Fast General Purpose Outputs to the Physical PEG Outputs
The PEG pulse signals can be assigned in parallel to opto-isolated General Purpose digital outputs.
There are 10 physical output pins that are shared between the PEG engines’ outputs. A special
command: ASSIGNPOUTS provides the means for routing Fast General Purpose outputs to the
physical PEG outputs.
The schematic block diagram of the PEG engines’ architecture (see Figure 8-1 ) is useful for
understanding the signal paths and routing. To configure the PEG operation, see ASSIGNPOUTS for
the mapping of PEG engine outputs to physical outputs.
For complete details on each command and its parameters see PEG Commands.
The following features are supported by ACS Motion Control products starting at the harware
revisions specified in Table 8-1.
> Time-based PEG
> Incremental PEG (PEG_I) Improvement - error accumulation prevention by taking into
account the rounding of the distance between incremental PEG events
> Fast loading of random PEG arrays
Table 8-1. Minimum HW Revision that supports Position Events Generation (PEG)
Improvements
SPiiPlusNT-LT / DC-LT D1
SPiiPlusNT-HP / DC-HP D1
SPiiPlusNT-LD / DC-LD D1
UDMNT A6
UDMPC C9
SPiiPlusCMBA UDMBA B8
SPiiPlusCMHP / UDMHP B8
UDMLC A8
UDMMC A1
UDILT B2
UDIHP B2
PDICL A2
UDMSD N/A
NPMPM N/A
NPMPC N/A
UDMCB A
UDMPA A
Table 8-2 summarizes the commands used for Incremental PEG setup and operation.
Table 8-2. Commands Associated with Incremental PEG
Digital
output pins ASSIGNPOUTS Assignment of physical output pins.
assignment
Check if
Used to check that the loading of PEG parameters is
ready for
AST.#PEGREADY complete (‘1’ means Ready). In this way movement can
PEG
start safely without losing positions.
movement
Disable PEG STOPPEG Halts the PEG engine for the specified axis (optional).
The Incremental PEG is set and activated by issuing the following commands:
1. Configuring specific PEG engines to specific encoders through the ASSIGNPEG command.
2. Assigning the physical output pins through the ASSIGNPOUTS command.
3. Setting Incremental PEG for the specific axis using PEG_I axis, width, first_point, interval,
last_point
4. Waiting for PEGREADY to be ‘1’ before activating PEG.
5. Starting PEG.
PEG firing is initiated if the specific PEG engine is configured properly by ASSIGNPEG and
PEG_I is issued. PEG continues to be fired periodically until last_point is reached.
Incremental PEG is activated periodically starting from the first_point position event, and
stops at the last_point position event. All pulses, including the last pulse, are of equal
duration (width).
PEG is generated only after first_point is reached. If first_point is not reached during the
motion, PEG will not be generated.
It is recommended that first_point position be the maximum current position for
movement in the positive direction and the minimum current position for movement in
the negative direction, before PEG engine activation.
Stopping the PEG motion with STOPPEG (optional).
6. STOPPEG is a synchronous delayed command which stops the PEGs from firing.
Since the Incremental PEG mechanism does not keep track of the direction of the
movement, you may have to issue STOPPEG after last_point has been reached. This is
needed in order to avoid unintentional PEG firing due to a rapid reversal of a movement’s
direction once last_point has been passed.
If STOPPEG has been executed before last_point has been reached, you can use STARTPEG
to continue PEG from the current position.
Table 8-3 summarizes the commands used for Random PEG setup and operation.
Table 8-3. Commands Associated with Random PEG
Output
PEGx_POS_ A 256/1024 member real array defining the PEG event
Position
ARRAY positions.
array
Output State PEGx_STATE_ A 256/1024 member integer array defining the 4-bit
array ARRAY logical states associated with the PEG event positions.
Digital
Output pin ASSIGNPOUTS Assignment of physical output pins.
assignments
Check if
Used to check that the loading of PEG parameters is
ready for
AST.#PEGREADY complete (‘1’ means Ready). In this way movement can
PEG
start safely without losing positions.
movement
Disable PEG STOPPEG Disable the PEG engine for the specified axis (optional).
The Random PEG is set and activated by issuing the following commands:
1. Setting the event position array: PEGx_POS_ARRAY. The array has a maximum of 256/1024
members.
2. Setting the output states array: PEGx_STATE_ARRAY. This array contains the state vectors
which are to be issued per position event of the PEGx_POS_ARRAY.
3. Assigning the specific PEG engine to a specific encoder through the ASSIGNPEG command.
4. Assigning the physical output pins through the ASSIGNPOUTS command.
5. Setting Random PEG for the specific axis using PEG_R axis, width, mode, first_index, last_
index, PEGx_POS_ARRAY, PEGx_STATE_ARRAY.
6. Waiting for PEGREADY to be ‘1’ before activating PEG.
7. Starting PEG.
PEG firing is initiated if the specific PEG engine is configured properly by ASSIGNPEG and
ASSIGNPOUTS and PEG_R is issued. PEG continues to be fired upon position match until
last_point is reached.
8. Stopping PEG with STOPPEG (optional).
STOPPEG stops the PEGs from firing. If STOPPEG has been issued and the motion has not
reached last_point, you can use STARTPEG to continue PEG from the current position.
The Random PEG Arrays are loaded by issuing the following commands:
1. Load arrays.
2. Activate PEG.
3. Start movement.
The movement will cause the PEG signals to be fired each time a position match event
occurs. Following the last_point event, the sequence above is repeated with the
movement activated in the opposite direction.
This still allows loading 3 axes of the same Servo Processor in parallel, for example:
TILL AST(AXIS0).#PEGREADY
TILL AST(AXIS1).#PEGREADY
TILL AST(AXIS2).#PEGREADY
1 13 13 14 14 15 15
2 13 13 14 14 15 15
4 13 13 14 14 15 15
8 13 13 14 14 15 15
16 13 14 14 16 16 18
32 14 15 17 18 19 21
64 16 17 21 22 24 27
128 19 22 27 32 33 42
256 25 32 39 51 52 71
512 38 52 65 90 91 129
HSSI devices (HSSI-IO16, HSSI-ED2, etc.) cannot be used for the same Servo Processor
when fast loading of Random PEG arrays is activated. SPRT and SPINJECT commands
cannot be used for the same Servo Processor when fast loading of Random PEG arrays
is activated.
Table 8-5. Typical Times to Load PEG Engines for the products that do not support fast loading
of Random PEG arrays
1 16 17 24 25 29 30
2 17 18 26 28 31 33
4 19 21 30 34 37 42
8 23 27 38 46 49 60
16 31 39 55 70 73 100
Since the priority of loading PEG engine command is low, it is recommended not to use
‘SETSP’ / ‘GETSP’ commands and change tuning parameters in parallel with the loading
process, otherwise loading times can be higher than the times mentioned in the table
The PEG output state signals can be configured to reflect the programmed states or be set to
pulses (negative or positive) which are generated on the PEG event. The MC4U provides 10 physical
PEG signals through the pins of its front panel Encoder connectors. Thus, an assignment of the 30
PEG engines’ outputs, i.e., 1 pulse and 4 state signals per engine, to 10 physical output pins is
defined as part of the engines’ configuration.
Use the ASSIGNPEG and ASSIGNPOUTS commands to assign the mapping. A schematic block diagram
aids in understanding the PEG engine output mapping to physical outputs.
PEG engines and associated output signals are indexed 0, 1, 2 and 4, 5, 6. Engines 3 and 7 are
reserved for future expansion. It should be noted that some of the PEG output pins are shared with
pins assigned for HSSI outputs and thus cannot be used simultaneously.
There can be either 4 or 8 Encoder connectors, depending on the controller model, for example,
CMnt-x/UDMpm-x/UDMpc-x/CMhv-x/UDMhv-x/CMba-x/CMhp-x/UDMba-x/UDMhp-x/ PDIcl-x may
have up to four encoders and three PEG engines. The assignment of Encoders to the controller’s
Servo Processor imposes certain restrictions on the PEG configurations, as detailed in this
document:
> Encoders: 0(X), 1(Y), 2(A), and 3(B) are physically assigned to Servo Processor 0
> Encoders: 4(Z), 5(T), 6(C), and 7(D) are physically assigned to Servo Processor 1
8.2.1.3.2 ASSIGNPEG
Description
The ASSIGNPEG function is used for engine-to-encoder assignment as well as for the additional
digital outputs assignment for use as PEG pulse outputs. The parameters are different from the
original SPiiPlus definitions.
Syntax
ASSIGNPEG[/f] axis, engines_to_encoders_code, gp_out_assign_code
Arguments
The axis index, valid numbers are: 0, 1, 2, ... up to the number of axes in the
axis system minus 1.
Axis parameter can be any axis number of the same unit.
The axis parameter actually serves for determining which Servo Processor is used.
Comments
> ASSIGNPEG is a blocking command - the ACSPL+ progam moves to the next line or
command only after this command has been fully executed or an error is generated.
> The axis parameter can be any of the axes controlled by the same servo processor, the
result will be the same.
> If switch: /f is included, fast loading of Random PEG arrays is activated.
HSSI devices (HSSI-IO16, HSSI-ED2, etc.) cannot be used for the same Servo Processor
when fast loading of Random PEG arrays is activated.
SPRT and SPINJECT commands cannot be used for the same Servo Processor when fast
loading of Random PEG arrays is activated.
Bit Code Encoder 0(X) Encoder 1(Y) Encoder 2(A) Encoder 3(B)
PEG0
010 PEG1 no no
PEG2
PEG1
011 PEG0 no no
PEG2
PEG0
100 PEG1 no no no
PEG2
PEG0
101 no PEG1 no no
PEG2
The Bit Code affects all of the connectors in the row, see Bit Code assignment
example.
Bit Code Encoder 4(Z) Encoder 5(T) Encoder 6(C) Encoder 7(D)
PEG4
010 PEG5 no no
PEG6
PEG5
011 PEG4 no no
PEG6
PEG4
100 PEG5 no no no
PEG6
PEG4
101 no PEG5 no no
PEG6
The Bit Code affects all of the connectors in the row, see Bit Code assignment
example.
SPiiPlus CMnt-x/UDMpm-x/UDMpc-x/CMba-x/CMhp-x/UDMba-x/UDMhp-x/CMhv-x/UDMhv-
x/UDMnt-x/UDMpa-x/UDMcb-x Mapping PEG Engines to Encoders (Servo Processor 0)
Bit Code Encoder 0(X) Encoder 1(Y) Encoder 2(A) Encoder 3(B)
PEG0
010 PEG1 no
PEG22
PEG1
011 PEG0 no
PEG22
PEG0
100 PEG1 no no
PEG22
PEG0
101 no PEG1 no
PEG22
PEG01, 2
110 PEG11, 2
PEG21, 2
PEG01, 2
111 PEG11, 2
PEG21, 2
The Bit Code affects all of the connectors in the row, see Bit Code assignment
example.
Bit Code Encoder 0(X) Encoder 1(Y) Encoder 2(A) Encoder 3(B)
001 no PEG0 no no
010 no no PEG0 no
011 no no no PEG01
100 no no no no
101 no no no no
110 no no no no
The Bit Code affects all of the connectors in the row, see Bit Code assignment
example.
Bit Code Encoder 0(X) Encoder 1(Y) Encoder 2(A) Encoder 3(B)
PEG0
010 no no no
PEG1
PEG0
011 no no no
PEG1
Bit Code Encoder 0(X) Encoder 1(Y) Encoder 2(A) Encoder 3(B)
The Bit Code affects the entire row, see Bit Code assignment example.
The Bit Code affects the entire row, see Bit Code assignment example.
The Bit Code affects the entire row, see Bit Code assignment example.
Table 8-14. UDMnt-x/UDMpa-x/UDMcb-x General Purpose Outputs Assignment for Use as PEG
Pulse Outputs (Servo Processor 0)
00
PEG0
(default)
0..7 01 PEG0
0
02 PEG0
03 PEG0
00 PEG1
01
8..15 PEG1
(default)
1
02 PEG1
03 PEG1
00 PEG2
01 PEG2
16..23
2
02
PEG2
(default)
03 PEG2
00 PEG3
01 PEG3
3 24..31
02 PEG3
03 PEG3
assignpeg 0, 0x03020100
This code configures the default mapping: PEG0 to Encoder0, PEG1 to Encoder 1, PEG2 to Encoder2
and PEG3 to Encoder3.
Comments
ASSIGNPEG is a blocking command in the sense that the ACSPL+ progam moves to the next line or
command only after this command has been fully executed or an error is generated.
The axis parameter can be any of the axes controlled by the same servo processor, the result will
be the same.
Related ACSPL+ Commands
PEG_I, ASSIGNPOUTS, PEG_R, STARTPEG, STOPPEG
COM Library Methods
None
C Library Functions
acsc_AssignPegNT
8.2.1.3.3 ASSIGNPOUTS
Description
The ASSIGNPOUTS function is used for setting Fast General Purpose output pins assignment and
mapping between FGP_OUT signals to the bits of the ACSPL+ OUT(x) variable, where x is the index
that has been assigned to the controller in the network during System Configuration.
The assignments can be obtained by running #SI in the SPiiPlus MMI Appication Studio
Communication Terminal. For example, the following is a fragment from the response
to this command:
OUT is an integer array that can be used for reading or writing the current state of the General
Purpose outputs - see SPiiPlus ACSPL+ Command & Variable Reference Guide.
Each PEG engine has 1 PEG pulse output and 4 state outputs for a total of 5 outputs per PEG engine
and a total of 30 outputs for the whole PEG generator. The controller supports 10 physical output
pins that can be assigned to the PEG generator. The user defines which 10 outputs (of the 30) of
the PEG generator are assigned to the 10 available physical output pins. Some of the output pins
are shared between the PEG and the HSSI.
The tables below define how each of the 30 outputs of the 6 PEG engines can be routed to the 10
physical output pins - 4 PEG out signals, 3 PEG state signals, and 3 HSSI signals. It needs to be noted
that some of the signals cannot be routed to the physical pins.
Syntax
ASSIGNPOUTSaxis, output_index, bit_code
Arguments
The axis index, valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
axis
For controllers with firmware version 2.15 or higher, the axis parameter can be
any axis number of the unit.
output_
0 for OUT_0, 1 for OUT_1, ..., 9 for OUT_9
index
Bit code for engine outputs to physical outputs mapping according to:
SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical
Outputs (Servo Processor 0)
SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical
Outputs (Servo Processor 1)
CMnt-x/UDMpm-x/UDMpc-x/CMhv-x/UDMhv-x Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0)
CMnt-x/UDMpm-x/UDMpc-x/CMhv-x/UDMhv-x Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0)
CMba-x/CMhp-x/UDMba-x/UDMhp-x Mapping of Engine Outputs to Physical
bit_
Outputs (Servo Processor 0)
code
CMba-x/CMhp-x/UDMba-x/UDMhp-x Mapping of Engine Outputs to Physical
Outputs (Servo Processor 0)
UDMnt-x/UDMpa-x/UDMcb-x Mapping of Engine Outputs to Physical Outputs
(Servo Processor 0)
UDMlc-x/UDMmc-x/UDIlt-x/UDIhp-x/PDIcl-x Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0)
NPMpm-x/NPMpc-x Mapping of Engine Outputs to Physical Outputs (Servo
Processor 0)
IDMsm/UDMsm/ECMsm Mapping of Engine Outputs to Physical Outputs (Servo
Processor 0)
PEG2_ PEG1_
010 PEG2_STATE1 Reserved Reserved
STATE0 STATE1
Bit Code: 111 is used for switching the physical output pins to Fast General Purpose
Outputs, see Bit Code: 111.
Bit Code: 111 is used for switching the physical output pins to Fast General Purpose
Outputs, see Bit Code: 111.
OUT_1 OUT_0
Bit Code
(Y_PEG) (X_PEG)
Encoder X
001 Encoder X Phase B
Phase A
Encoder Y
010 Encoder Y Phase B
Phase A
Bit Code: 111 is used for switching the physical output pins to Fast General Purpose
Outputs, see Bit Code: 111.
OUT_6 OUT_5
Bit Code
(X_STATE1) (X_STATE0)
OUT_6 OUT_5
Bit Code
(X_STATE1) (X_STATE0)
Encoder Encoder
Encoder Encoder A Encoder A
011 A A Phase
A INDEX Phase B Phase A
Phase B A
PEG2_PULSE or PEG0_PULSE or
101 Reserved Reserved Reserved
PEG1_PULSE PEG2_PULSE
PEG0_PULSE PEG0_PULSE or
110 Reserved Reserved Reserved or PEG1_PULSE PEG1_PULSE or
or PEG2_PULSE PEG2_PULSE
FGP_
111 Reserved Reserved FGP_OUT1 FGP_OUT0
OUT2
Bit Code: 111 is used for switching the physical output pins to Fast General Purpose
Outputs, see Bit Code: 111.
For Bit Codes 101 and 110, the OUT_0 (X_PEG) and OUT_1 (Y_PEG) mappings are
supported for default PEG pulse polarity only.
OUT_9
OUT_8 OUT_7 OUT_6 OUT_5
Bit Code (Y_
(X_STATE3) (X_STATE2) (X_STATE1) (X_STATE0)
STATE3)
Encoder X Encoder X
101 Reserved Reserved Reserved
INDEX INDEX
OUT_1 OUT_0
Bit Code
(X_STATE1) (X_STATE0)
Bit Code: 111 is used for switching the physical output pins to Fast General Purpose
Outputs, see Bit Code: 111.
OUT_0
Bit Code
(X_PEG)
001 Reserved
010 Reserved
011 Reserved
100 Reserved
OUT_0
Bit Code
(X_PEG)
101 Reserved
110 Reserved
111 FGP_OUT0
Bit Code: 111 is used for switching the physical output pins to Fast General Purpose
Outputs, see see Bit Code: 111.
OUT_1 OUT_0
Bit Code
(Y_PEG) (X_PEG)
111
GP_OUT3 GP_OUT2 GP_OUT1 GP_OUT0
(Default)
111
GP_OUT7 GP_OUT6 GP_OUT5 GP_OUT4
(Default)
000
PEG3_Pulse PEG2_Pulse PEG1_Pulse PEG0_Pulse
(Default)
Comments
ASSIGNPOUTS is a blocking command in the sense that the ACSPL+ progam moves to the next line
or command only after this command has been fully executed or an error is generated.
Examples
The following examples illustrate using the ASSIGNPOUTS in order to use PEG outputs as GP outputs
Example 1:
ASSIGNPOUTS 0, 2, 0b111
This defines the Z_PEG output as FGP_OUT2 and maps it to the bit 18 of the ACSPL+ OUT variable
(see SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical Outputs
(Servo Processor 0)).
If you run, for example:
OUT(x).18=0
Where x is the index assigned to the controller during System Configuration, FGP_OUT2 output will
be activated.
Then if you run:
OUT(x).18=0
ASSIGNPOUTS 4, 7, 0b111
This defines the X_STATE2 output as FGP_OUT6 and maps it to the bit 22 of the ACSPL+ OUT variable
(see SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical Outputs
(Servo Processor 1)).
General purpose outputs GP_OUT8, GP_OUT9, GP_OUT10 and GP_OUT11 should be used
by changing the general purpose outputs 16, 17, 18 and 19 in ACSPL+.
For example to set general output 16 run the following command:
OUT0.16 = 1
Comments
ASSIGNPOUTS is a blocking command in the sense that the ACSPL+ progam moves to the next line
or command only after this command has been fully executed or an error is generated.
Examples
The following examples illustrate using the ASSIGNPOUTS in order to use PEG outputs as GP outputs
Example 1:
ASSIGNPOUTS 0, 2, 0b111
This defines the Z_PEG output as FGP_OUT2 and maps it to the bit 18 of the ACSPL+ OUT variable
(see SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical Outputs
(Servo Processor 0)).
If you run, for example:
OUT(x).18=0
Where x is the index assigned to the controller during System Configuration, FGP_OUT2 output will
be activated.
Then if you run:
OUT(x).18=0
ASSIGNPOUTS 4, 7, 0b111
This defines the X_STATE2 output as FGP_OUT6 and maps it to the bit 22 of the ACSPL+ OUT variable
(see SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical Outputs
(Servo Processor 1)).
8.2.1.3.4 STARTPEG
Description
The STARTPEG command initiates the PEG process on the specified axis. The command is used in
both the Incremental and Random PEG modes.
Syntax
STARTPEG axis
Arguments
The axis index, valid numbers are: 0, 1, 2, ... up to the number of axes in the system
axis
minus 1.
Comments
STARTPEG is a blocking command in the sense that the ACSPL+ progam moves to the next line or
command only after this command has been fully executed or an error is generated.
If "STOPPEG" below has been issued before the last PEG position, you have to use STARTPEG to
resume PEG engine firings from the current point.
Related ACSPL+ Commands
ASSIGNPEG, ASSIGNPOUTS, ASSIGNPOUTS, ASSIGNPOUTS, STOPPEG
Related ACSPL+ Variables
AST
COM Library Methods
None
C Library Functions
acsc_StartPegNT
8.2.1.3.5 STOPPEG
Description
The STOPPEG command terminates the PEG process immediately on the specified axis. The
command is used in both the Incremental and Random PEG modes.
Syntax
STOPPEG axis
Arguments
The axis index, valid numbers are: 0, 1, 2, ... up to the number of axes in the system
axis
minus 1.
Comments
STOPPEG is a blocking command in the sense that the ACSPL+ progam moves to the next line or
command only after this command has been fully executed or an error is generated.
Example
8.2.1.3.6 PEG_I
Description
The PEG_I command is used for setting the parameters for the Incremental PEG mode.
Syntax
PEG_I [/awi] axis, width, first_point, interval, last_point
Arguments
The axis index, valid numbers are: 0, 1, 2, ... up to the number of axes in the
axis
system minus 1.
first_
First point for the PEG generation.
point
time-
Optional parameter - number of time-based pulses generated after each
based-
encoder-based pulse, the range is from 0 to 65,535.
pulses
PEG is generated only after the first pre-defined start point is reached. If the current
encoder position exceeds pre-defined start point no PEG pulses are fired. It is
recommended to activate the PEG engine before the maximum current position for
movement in the positive direction and the minimum current position for movement
in the negative direction.
Comments
> If the switch: /w is included, the execution of the command is delayed until the execution
of the STARTPEG command.
> If the switch: /i is included, the PEG pulse output signal is inverted.
> If the switch: /a is included, error accumulation is prevented by taking into account the
rounding of the distance between incremental PEG events.
You must use this switch if interval does not match the whole number of encoder counts.
Using this switch is recommended for any application that uses the PEG_I command,
regardless if interval matches the whole number of encoder counts.
Example
In this example, PEG pulses are fired on axis 6 based on axis encoder 7.
GLOBAL AXIS6
GLOBAL AXIS7
AXIS6=6 ! Axis assignment
AXIS7=7
ST:
peg_i AXIS6,0.5,-100,-200,-10000
TILL AST(AXIS6).#PEGREADY
!Wait till command executes and configuration is set, in order to ensure
!proper PEG engine's execution prior to start of movement
ptp/e AXIS6,-12000
stoppeg AXIS6 ! Prevent PEG pulses' firing on the 'way back'
ptp/e AXIS6,0
goto ST
stop
8.2.1.3.7 PEG_R
Description
The PEG_R command is used for setting the parameters for the Random PEG mode.
Syntax
PEG_R[/wid] axis, width, mode, first_index, last_index, POS_ARRAY, STATE_ARRAY
Arguments
The axis index, valid numbers are: 0, 1, 2, ... up to the number of axes in
axis
the system minus 1.
first_
Index of first entry in the array for PEG generation
index
last_
Index of last entry in the array for PEG generation
index
POS_
The Random Event Positions array, maximum of 256/1024 members
ARRAY
STATE_ The Outputs States array defining the four PEG output states, maximum of
ARRAY 256/1024 members
time-
Optional parameter - number of time-based pulses generated after each
based-
encoder-based pulse, the range is from 0 to 65,535.
pulses
time-based-pulses and time-based-period are omitted, the controller does not generate
time based pulses.
> The dynamic loading feature is limited by the loading frequency. If a high loading
frequency is required, the loading capacity may not suffice to keep the FIFO loaded.
> Dynamic loading can only be implemented on a PEG engine with fast loading (ASSIGNPEG
/f)
> If the FIFO is emptied before all data arrays have been loaded, a memory overflow fault
will be thrown.
Loading Frequency Table
1 200
0.5 400
0.25 800
0.2 1000
Example
In this example PEG pulses are fired on axes 0, 1, and 2 according to encoder of axis 0.
GLOBAL AXIS0
GLOBAL AXIS1
GLOBAL AXIS2
AXIS0=0
AXIS1=1
AXIS2=2
assignpouts AXIS0, 0, 0b000 !Assign bit code 000 from SAnt-x Mapping of
Engine outputs to AXIS0,
!at Pin0
assignpouts AXIS1, 1, 0b000
assignpouts AXIS2, 2, 0b001
ST:
peg_r AXIS0,0.5,0x4444,0,15,ARR,STAT !Activate random PEG for axis 0
peg_r AXIS1,0.5,0x4444,0,15,ARR,STAT
peg_r AXIS2,0.5,0x4444,0,15,ARR,STAT
ptp/e AXIS0,5000
stoppeg AXIS0 ! Prevent PEG pulses' firing on the 'way back'
ptp/e AXIS0,0
goto ST
stop
This example shows the setup for dynamic PEG loading and a PTP motion command.
INT AXIS = 0
! Initialize PEG Arrays
!........
!........
STOP
8.2.1.3.8 ASSIGNMARK
Description
The ASSIGNMARK function is used for Mark inputs-to-encoder assignment. It allows mapping
available physical Mark inputs pins to different encoders.
Syntax
ASSIGNMARK [/i] axis, mark_type, inputs_to_encoder_bit_code
Arguments
The axis index, valid numbers are: 0, 1, 2, ... up to the number of axes in the
Axis
system minus 1.
1 for Mark-1
mark_type
2 for Mark-2
Comments
If the switch: /i is included, the MARK input signal is inverted.
Mark Inputs to Encoders Mapping
Table 8-27. Mark-1 Inputs to Encoders Mapping for SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x
0000
0
0(X) 1(Y) 4(Z) 5(T) - - - -
(defa
ult)
0000
1(Y) 4(Z) 5(T) 0(X) - - - -
1
0001
4(Z) 5(T) 0(X) 1(Y) - - - -
0
0010
- 1(Y) 4(Z) 5(T) 0(X) - - -
0
0100
- - 4(Z) 5(T) 0(X) 1(Y) - -
0
1000
- - - - 4(Z) 5(T) 0(X) 1(Y)
0
The Bit Code affects all of the inputs in the row, see Bit code affects.
0000
0 GP GP GP GP
- - - -
(defa IN6 IN7 IN4 IN5
ult)
0000 GP GP GP GP
- - - -
1 IN7 IN4 IN5 IN6
0001 GP GP GP GP
- - - -
0 IN4 IN5 IN6 IN7
GP GP GP GP
00011 - - - -
IN5 IN6 IN7 IN4
0010 GP GP GP GP
- - - -
0 IN7 IN4 IN5 IN6
GP GP GP GP
00101 - - - -
IN6 IN4 IN5 IN7
GP GP GP GP
00110 - - - -
IN6 IN7 IN5 IN4
GP GP GP GP
00111 - - - -
IN6 IN7 IN4 IN5
0100 GP GP GP GP
- - - -
0 IN4 IN5 IN6 IN7
GP GP GP GP
01001 - - - -
IN6 IN7 IN4 IN5
GP GP GP GP
01010 - - - -
IN6 IN7 IN4 IN5
GP GP GP GP
01011 - - - -
IN7 IN6 IN4 IN5
GP GP GP GP
01100 - - - -
IN4 IN6 IN7 IN5
GP GP GP GP
01101 - - - -
IN5 IN6 IN7 IN4
GP GP GP GP
01110 - - - -
IN6 IN7 IN4 IN5
GP GP GP GP
01111 - - - -
IN7 IN4 IN5 IN6
1000 GP GP GP GP
- - - -
0 IN4 IN5 IN6 IN7
GP GP GP GP
10001 - - - -
IN5 IN6 IN7 IN4
Mark-1 and Mark-2 Inputs to Encoders Mapping for with SPiiPlus CMnt-x/UDMpm-x/UDMpc-
x/CMba-x/CMhp-x/UDMba-x/UDMhp-x/CMhv-x/UDMhv-x
Bit
Mar Mar Mar Mar Mar Mar Mar Mar
code
k-1 k-2 k-1 k-2 k-1 k-2 k-1 k-2
Input Input Input Input Input Input Input Input
Mark-1 and Mark-2 Inputs to Encoders Mapping for with SPiiPlus CMnt-x/UDMpm-x/UDMpc-
x/CMba-x/CMhp-x/UDMba-x/UDMhp-x/CMhv-x/UDMhv-x
Bit
Mar Mar Mar Mar Mar Mar Mar Mar
code
k-1 k-2 k-1 k-2 k-1 k-2 k-1 k-2
Input Input Input Input Input Input Input Input
Mar Mar
GP GP GP GP
010 - k-2 1 k-2 1 -
IN4 IN5 IN6 IN6
(Y) (Y)
GP GP GP GP
011 - - - -
IN7 IN6 IN7 IN7
8.2.1.4.1 GETCONF
Description
GETCONF retrieves system configuration data.
Syntax
GETCONF(key,index)
Arguments
index A 16-bit word used for specifying the axis and output
The following describes the new keys that have been incorporated.
GETCONF(71, index)
Description
GETCONF(71, index) is used to view the actual assignment of digital outputs to PEG states and PEG
pulses outputs.
Arguments
The index argument contains the axis index, valid numbers are: 0, 1, 2, ... up to the number of axes
in the system minus 1.
Return value
Depending on the axis, the function returns the bit code according to
SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x General Purpose Outputs Assignment for Use as PEG
Pulse Outputs (Servo Processor 0)
SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x General Purpose Outputs Assignment for Use as PEG
Pulse Outputs (Servo Processor 1)
SPiiPlus CMnt-x/UDMpm-x/CMhv-x/UDMhv-x General Purpose Outputs Assignment for Use as PEG
Pulse Outputs (Servo Processor 0)
UDMnt-x/UDMpa-x/UDMcb-x General Purpose Outputs Assignment for Use as PEG Pulse Outputs
(Servo Processor 0)
GETCONF(72, index)
Description
GETCONF(72, index) is used to view the actual encoder PEG engine assignment.
Arguments
The index argument contains the axis index, valid numbers are: 0, 1, 2, ... up to the number of axes
in the system minus 1.
Return value
Depending on the axis, the function returns the bit code according to
SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping PEG Engines to Encoders (Servo Processor 0)
SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping PEG Engines to Encoders (Servo Processor 1)
CMnt-x/UDMpm-x/UDMpc-x/CMhv-x/UDMhv-x Mapping of Engine Outputs to Physical Outputs
(Servo Processor 0)
UDMlc-x/UDIlt-x/UDIhp-x/UDMmc-x/PDIcl-x/ Mapping PEG Engines to Encoders (Servo Processor 0)
GETCONF(73, index)
Description
GETCONF(73, index) is used to view the actual output pins assignment.
Arguments
The index argument has to following meaning:
> Bits 0 - 7 - Axis Index
> Bits 8 - 16 - 0 for OUT_0, 1 for OUT_1, ..., 9 for OUT_9
Return value
Depending on the axis, the function returns the bit code according to
SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical Outputs (Servo
Processor 0)
SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to Physical Outputs (Servo
Processor 1)
8.2.1.4.2 AST.#PEGREADY
Description
AST is an integer array containing a set of bits used for displaying the current axis state. Bit 4
(#PEGREADY) has been added to indicate the readiness of a PEG engine.
Syntax
AST(AXIS#).#PEGREADY
AXIS# identifies the axis and can take on values of AXIS0 through AXIS_Last, where _Last is the
number of axes in the system minus 1.
Return value
> 0 - Indicates that the engine is not configured and motion should not be started.(default)
> 1 - Indicates that all values are loaded and the PEG engine is ready to respond to
movement (the user can start a motion).
Comments
The #PEGREADY bit is reset to ‘0’ when PEG is activated.
> The encoder-related controller features: index, Mark, and PEG, do not support the full
resolution of the multiplier. Resolution for these features is limited to 4 counts per
encoder sine signal period.
1/(250*1024) = 0.00000390625
Encoder-related features: index, Mark, PEG use the same user unit. However, actual resolution of
these functions is lower than the resolution of encoder feedback. As mentioned above, the
resolution of index, mark and PEG corresponds to 4 counts per encoder sine period. In the former
example the resolution will be 1/(250*4) = 0.001mm.
The controller continuously checks the integrity of the encoder multiplier feedback. If any error
occurs, the controller activates the Encoder Error fault.
8.4 Interrupts
Typically, you work with the SPiiPlus interrupts using the SPiiPlus C Library and do not need the low-
level details specified in this section. Refer to the SPiiPlus C Library Reference document for
explanation of the interrupt managing functions.
Bit Description
3 PEG 0
4 PEG 1
Bit Description
5 PEG 3
6 PEG 4
7 MARK 1 0
8 M2ARK 0
9 MARK 1 2
10 M2ARK 2
11 MARK 1 3
12 M2ARK 3
13 MARK 1 4
14 M2ARK 4
15 Emergency Stop
Bit Description
20 Program termination
23 Digital input
28 System error (the controller raises this interrupt if system error occurred)
Bit Description
29 EtherCAT error (the controller raises this interrupt if EtherCAT error occurred)
Controller cycle (the controller raises this interrupt in the beginning of each controller
30
cycle)
Communication interrupt (the controller raises this interrupt after sending a complete
31
message to the FIFO)
When a software interrupt occurs, the corresponding tag contains detailed information about the
interrupt source. For example, the tag of the Physical Motion End interrupt specifies the axes that
caused the interrupt. When a specific software interrupt has occurred, the next interrupt of the
same type can be generated only after the host drive reads both interrupt status register and
writes zero to the corresponding tag.
Bit Description
Bit Description
Bit Description
Bit Description
Bit Description
Bit Description
> GETCONF (130, {1|5}) retrieves the present value of current level for the specified axis.
The default value of current level is 0, so it must be defined before constant current mode can be
used.
To set/get the maximum value that can be set with SETCONF (130, . . .), the following
SETCONF/GETCONF parameters are used:
> SETCONF (131, {1|5}, max_current_level), where MAX_CURRENT_LEVEL defines the
maximum allowable value of the current level as a percentage of the maximum current for
the specified axis (1 or 5 only).
> GETCONF (131, {1|5}) retrieves the present maximum allowable current level for the
specified axis.
The following ACSPL+ program illustrates how to implement constant current mode:
Variable/Function Description
Returns the Hall counter of the axis specified by Index. The Hall
GETCONF(110,
direction bit is not taken into account. This function is used by the
Index)
Adjuster commutation program.
GETCONF(111,
This function is used by the Adjuster Wizard during commutation.
Index)
After hardware reset, if the Hall commutation was successful, the firmware
automatically sets bit MFLAGS.9 = 1, if MFLAGS.27 = 1.
For proper Hall commutation, the encoder resolution and number of poles should be
defined correctly. The current loop should be adjusted.
The Callback mechanism provides the fastest response to the controller events. The
implementation is transparent for user applications. In all communication channels, the callback API
consists of the functions, SetCallback and SetCallbackExt.
8.8.2.1 Timing
Callback operations include sending/receiving a message that requires much more time. Specific
rates depend on the communication channel rate.
From the viewpoint of callback mechanism, all communication channels are functionally equivalent,
but differ in timing.
The following interrupts are generated by the controller firmware and therefore are called
software interrupts:
> Physical motion end
> Logical motion end
> Motion failure (Motion interruption due to a fault)
> Motor failure (Motor disable due to a fault)
> Program termination
> Command execution
> ACSPL+ interrupt (by INTERRUPT command)
Emergency The message is sent when bit S_FAULT.#ES changes from zero to one.
stop The message is disabled if S_FMASK.#ES is zero.
Mark 1 and The message is sent when corresponding IST.#MARK or IST.#MARK2 bit
Mark 2 changes from zero to one.
The message is sent when the corresponding AST.#PEG bit changes from
PEG
one to zero.
For a description of all the UMD functions see SPiiPlus Utilities User Guide.
To establish a remote connection using TCP/IP, select Enable Access from Remote Application on
the User Mode Driver (UMD) Remote Connection tab.
If the default port is not busy, no communication error messages are encountered, and no problem
is anticipated. In this case, use the function acsc_SetServerExt with the ACSC_DEFAULT_REMOTE_
PORT parameter to set the remote port address from the user application.
If the default port (9999) is busy, the UMD will return the following error message:
Requested port 9999 is in use by another application. Select another port in the Remote
Connection tab.
In this case, proceed as follows:
1. From the Remote Connection tab, select Change from the Remote Port Connection list.
2. Enter the remote port address in the Enter valid port number dialog.
3. From the Remote Connection tab, select Enable Access from Remote Application. As
soon as the check box is selected, communication with the remote port is attempted. If
communication does not succeed, the following error message appears:
Requested port [port number] is in use by another application. Select another port in the
Remote Connection tab.
4. Repeat Steps 1-3 until communications are established. When communications are
successfully established, the UMD stores the settings.
5. Click OK and then Close.
6. In the user application, use the function acsc_SetServerExt and specify the same port
number that was entered in the UMD GUI.
Every time the User Mode Driver (UMD) initializes, the availability of the specified port is
checked. If the system configuration or port number have changed, the UMD
generates an error message and the Enable Access from Remote Application on the
UMD Remote Connection tab check box will be cleared.
The Infinite setting is not recommended because of a possible disk overflow situation.
5. After clicking Start Log, and the log is active, and the Stop Log button appears.
Currently only serial channels can be connected to devices such as these. All functions
described below are implemented for RS232 serial channels only.
The controller responds with a table that specifies the configuration for each supported
communication channel.
For any specific hardware configuration, not all listed channels may be physically
available.
#CC
Channel Type Commandant
1 Serial Command Rate:115200
2 Serial Special Rate:9600 Parity:Even
10 TCP/IP Command Connection:point-to-point Peer:10.0.0.96
The SETCONF function with key 302 assigns a communication channel for special input as follows:
SETCONF(302, channel, {0|1})
Where:
Indicates the assigned COM channel, it can be one of the following values:
channel 1 – COM1
2 – COM2
The values that can be used in connection with the channel are:
> 1 – assigns the channel for special input
> 0 – returns the channel to regular command processing.
If a channel is assigned for special input, the controller does not process commands from this
channel. Any input from this channel can be processed only by the INP function (see INP Function).
Output to the channel is provided by regular DISPand SENDcommands (see SPiiPlus Command &
Variable Reference Guide).
While a channel can be set to special communication mode by the SETCONF command
through the same communication channel, the channel cannot be returned to normal
mode through the same channel. The reason is that in special communication mode
the channel does not process commands and therefore cannot execute SETCONF. You
have to use another channel to return the channel to the regular command processing
mode.
The GETCONF function with key 302 retrieves the state of a communication channel as follows:
GETCONF(302, channel)
The function returns:
> 0 – if the channel is in normal command-processing mode
> 1 – if the channel is in special-communication mode
Where:
Indicates the assigned COM channel, it can be one of the following values:
channel 1 – COM1
2 – COM2
Parameters Description
Option is bit mask of the communication options. The bits are interpreted as
follows:
options > Bit 2: 0 - normal stop bit, 1 - extended stop bit
> Bit 3: 0 - no parity, 1 - check parity
> Bit 4: 0 - odd parity, 1 - even parity
Example
In order to save the specified setting in the controller, the following ACSPL+ program should be
prepared and saved in one of the available buffers.
The program has an AUTOEXEC label that means that it will automatically start after the
controller power-up.
AUTOEXEC:
CONID = 32 ! Set Slave address 32
setconf(302, 2, 2) ! Set COM2 for MODbus communication
setconf(303, 2, 19200) ! Set baud rate 19200
setconf(304, 2, 0x18) ! Set even parity
STOP
Indicates the assigned COM channel, it can be one of the following values:
channel 1 – COM1
2 – COM2
timeout Maximum waiting time (in milliseconds) for response from the channel.
E Identical to the E format except that E rather than E indicates the exponent.
f Where dddd is one or more decimal digits. The number of digits before the
decimal point depends on the magnitude of the number, and the number of
digits after the decimal point depends on the requested precision.
Signed value printed in F or E format, whichever is more compact for the given
value and precision. The e format is used only when the exponent of the value
g
is less than -4 or greater than or equal to the precision argument. Trailing zeros
are truncated, and the decimal point appears only if one or more digits follow it.
Identical to the G format, except that E, rather than E, introduces the exponent
G
(where appropriate).
If an input string argument contains n format specifiers, the specifiers apply to the n subsequent
expression arguments.
The DISP command processes the arguments from left to right. The processing is as follows:
> Expressions:
The expression is evaluated and the ASCII representation of the result is placed in the
output string. The format of the result is determined by a formatting specification (if any)
in the input string.
> Input strings:
Text is sent as-is to the output string. Escape sequences are replaced by the ASCII codes
that they represent. Formatting specifications are applied to the results of any expressions
that follow the string.
Examples:
The output string is sent to a communication channel. The channel is specified by the current value
of standard DISPCH (default channel) variable. The following values are available:
1 – Serial communication channel COM1.
2 – Serial communication channel COM2.
6 – Ethernet network (TCP).
7 – Ethernet network (TCP).
8 – Ethernet network (TCP).
9 – Ethernet network (TCP).
10 – Ethernet Point-to-Point network. (UDP)
-1 – No default channel is specified, the DISP command uses the last channel activated by the
host.
-2 – All channels.
In order to receive unsolicited messages by a host application, perform the following:
1. Set DISPCH to -2.
2. Set bit 4 of COMMFL to 1.
3. Send SETCONF(306,-1,1) from the same communication channel where unsolicited
messages are expected to be received.
In order to stop the receipt of unsolicited messages by a host application:
Send SETCONF(306,-1,0) from the same communication channel where there is no need any more
to receive unsolicited messages.
Channel # Description
-1 No default channel is specified, uses the last channel activated by the host
-2 All channels
disp-arguments are the same as those detailed for the DISP command (see DISP Command).
Syntax
string STR (variable [,start-index] [,number])
Arguments
Return value
The function returns a string composed of the array elements interpreted as characters.
Comments
Each element of the variable array is interpreted as an ASCII character. If an element value is in the
range from 0 to 255, it is directly converted to the corresponding ASCII character. Otherwise, the
value’s modulo 256 is converted.
If neither start_index nor number is specified, the conversion takes all elements of the array. If only
start_index is specified, the conversion takes all characters from the specified index to the end of
array. Specifying number limits the number of characters in the resulting string.
The function can be used within the SEND or the DISP GUI.
Example
The following example provides a mirror for channel 2, so that any received character is sent back:
int Char(1)
INP(2,Char,,1)
SEND 2,str(Char)
Return value
The function returns the number of actually assigned characters.
Comments
The function decomposes string into individual characters and assigns the characters to the
sequential elements of the variable array.
Each ASCII character is represented as its numerical value and stored in a separate element of the
array.
If start_index is specified, the first character is assigned to the array element with the specified
index. If start_index is omitted, the assignment starts from the first element of the array.
Ifnumber is omitted, the function assigns all characters of the string. If number is specified, the
function assigns the specified number of characters. In both cases the assignment stops when the
last array element is reached.
Comments
One TRIGGER command can cause triggering many times. The controller continues calculating the
expression until another TRIGGER command is executed in the same channel. Each time when the
expression changes its value from zero to non-zero, the controller raises the trigger bit and
produces the interrupt.
The table specifies triggering bit and interrupt tag for each triggering channel:
0 AST0.11 0x00000001
1 AST1.11 0x00000002
2 AST2.11 0x00000004
3 AST3.11 0x00000008
4 AST4.11 0x00000010
5 AST5.11 0x00000020
6 AST6.11 0x00000040
7 AST7.11 0x00000080
GETCONF(310, 0) returns an integer value that contains the TCP/IP address currently assigned to the
controller. The index argument (second argument) of the function should be zero. If a TCP/IP
protocol is not configured, or not supported, the return value is zero.
SETCONF(310, 0, address) configures the TCP/IP address for the controller. The index argument
(second argument) of the function should be zero. If the address argument is zero, SETCONF
activates a new execution of the DHCP protocol and obtains a new TCP/IP address from the host
(the host may configure the same address as before). SETCONF does not change the TCPIP
parameter. After power-up, the controller is initialized with the TCP/IP address set in the TCP/IP
parameter.
The address value is a 32-bit integer that contains four bytes. Each byte represents one part of the
TCP/IP dot address. The bytes follow in computer order. For example:
3. Dynamic Addressing
Configure a zero TCP/IP address in the TCPIP variable and store it in the flash.
After start-up, the controller initiates DHCP communication with the DHCP server and
obtains the TCP/IP address and other network information.
To use this method, the DHCP server should be accessible at the time of controller start-
up.
If the DHCP server is not accessible, the controller repeats the request several times. If all
attempts fail, the controller disables Ethernet channel support and continues initialization.
4. Delayed Dynamic Addressing
Use this method, if the DHCP server is not available at the time of controller start-up. It may
occur, for example, if the controller and the computer running DHCP server are activated
at the same time, and nobody knows which is ready first.
Configure zero TCP/IP address in the TCPIP variable and store it in the flash.
Create an initialization routine in one of the buffers, and store it in the flash:
AUTOEXEC:
WHILE GETCONF(310,0) = 0
SETCONF(310,0,0)
END
! continue initialization
As a result, the controller waits at the beginning of initialization until the DHCP server
succeeds to in supplying a TCP/IP address.
The ROFFS variable is an 8 element array, one element per axis, that reads the offset calculated by
the controller in the connect formula. As long as the motor is in the default connection
(MFLAGS.#DEFCON = 1), offset ROFFS is zero. However, once you have specified a CONNECT (see
CONNECT Command) formula:
the controller calculates offset ROFFS(axis) to prevent any immediate change of RPOS(axis) that
may cause a jump of the motor. Then the controller calculates formula:
RPOS(axis) = F(…) + ROFFS(axis)
The controller recalculates the offset to prevent motor jump when any of the following commands
is executed:
> CONNECT
> SET
> ENABLE
> DISABLE
> KILL
ROFFS reads the current value of the offset. Watching the offset value facilitates development and
debugging of application with complex kinematics.
The DAPOS variable is an 8 element array, one element per axis, that reads the Axis Position
synchronous with the Reference Position. The variable supplements the existing APOS variable.
The problem of the APOS variable is that the axis position is not synchronous with the RPOS and
FPOS. For this reason watching APOS against RPOS or FPOS in the SPiiPlus MMI Application Studio
Scope is inconvenient.
DAPOS reads the same values of axis position, but synchronously with RPOS and FPOS. Using
synchronous axis position facilitates analysis and debugging of the CONNECT formula.
Use only DAPOS for watching the axis position in the Scope.
The CONNECT command cannot be executed as long as the default connection bit
(MFLAGS.#DEFCON) is raised.
Syntax:
CONNECT RPOS (axis) = expression
WhereRPOS(axis) is an axis RPOS variable (for example, RPOS(0)), which receives the value of the
expression.
For more information about RPOS and other common motion variables refer to the SPiiPlus
Command & Variable Reference Guide.
The connect command is not an assignment command (see Assignment Command). It does not
simply assign the result of the formula on the right side to the axis RPOS. The formula is not
evaluated when the connect command is executed (which would be the case for an assignment
command); instead, the formula is stored and then evaluated by the controller every controller
cycle to calculate the corresponding RPOS.
After power-up the controller always starts with the default connection. The default connection
means the following for each axis:
> Bit MFLAGS.#DEFCON is raised.
> The default connect formula is defined as CONNECT RPOS = APOS.
> APOS and RPOS are linked, i.e., explicit (through the SET command see SET Command) or
implicit change of one of these variables causes the same change in the other one.
Once an application resets MFLAGS.#DEFCON, it can then execute a CONNECT and (typically) a
DEPENDS command. At this point, the motor is considered to be in non-default connection.
Consider the following examples:
The commands
MFLAGS(1).#DEFCON = 0
CONNECT RPOS(1) = APOS(0)
DEPENDS 1, 0
connect the 1 axis motor position to the 0 axis reference. If the 0 axis motor is also connected to
the 0 axis reference, this provides gantry-like motion of two motors.
The command
PTP 0, 1000
connects the 0 axis motor position to the 0 axis reference plus analog input 1. In this case the 0 axis
provides a motion and the analog input (for example, an external sensor) supplies a correction for
the 0 axis motor.
The following commands
MFLAGS(2).#DEFCON = 0
connect RPOS(2) = APOS(2) + APOS(3)
depends 2, (2,3)
connect the 2 axis motor to the sum of 2 and 3 axes. The axes can each execute an independent
motion, with the 2 axis motor following the sum of the two motions. Or the axes can participate in a
single multi-axis motion.
The following illustrate uses of the CONNECT command.
A more sophisticated application may require changing the connection in the middle of operations.
The controller applies no limitations regarding when a connection can be changed. In a typical case,
changing connection requires three commands:
and
The DEPENDS command cannot be executed as long as the default connection bit
(MFLAGS.#DEFCON) is raised.
Syntax
DEPENDS dependent_axis, axes_specification
Comments
The dependent_axis argument specifies an axis and the axes_specification argument specifies
one or more axes on which the motor depends.
Typically, a DEPENDS command will follow a CONNECT command. Whereas a CONNECT command can
define a mathematical correspondence between a motor’s reference position (RPOS) and one or
more axis positions (APOS), a DEPENDS command specifies the logical dependence between a
motor and axes.
The DEPENDS command is necessary because generally the controller is not capable of deriving the
dependence information from the CONNECT formula alone. For this reason, once a CONNECT
command is executed, the controller resets the dependence information of the motor; the motor
depends only on the corresponding axis.
Dependence information, as specified using a DEPENDS command, is required in the following
cases. If the dependence information is not provided correctly, the controller may display strange
behavior.
> A motor/axis query (for example, ?0) returns the non-default dependence for that motor.
> When initiating a motion, the controller verifies if each motor dependent on the axes
involved is enabled. If one or more motors are disabled, the motion does not start.
> If in the process of motion a motor is disabled or killed due to a fault or due to a DISABLE or
KILL command, the controller immediately terminates all motions involving the axes that
the motor depends on.
> Once a SET APOS=… command is executed, the controller adjusts offsets in the connection
formula of the motors that depend on the specified axis.
from/to Restricts the range within which the matching value is searched.
Comments
The function is useful in the case of non-default connections if a motor depends only on the same
axis, a typical example is error compensation. For example, the following connection:
can be used to find matching APOS(1) in the range -1000 to +1000 and to set offset ROFFS1 to zero.
In mathematical terms, the function finds the root of equation:
RPOS = F(x)
where RPOS is the current value of the RPOS variable and F(x) is the connect formula specified by
you with APOS substituted for x.
The function succeeds if the unique root exists in the specified range. If there are several roots in
the range, the function returns one of them. If the root does not exist, the function result is
incorrect. It is your responsibility to restrict the range so that the function provides proper result.
8.13.1 INSHAPEON
Description
The INSHAPEON function starts Input Shape algorithm for specified axis. The result is a dynamic
output signal equal to the convolution of the input signal and the convolution pulses.
Syntax
INSHAPEON Axis_Index, T_array, A_array
Arguments
Return Value
None
Comments
Vectors T_array and A_array define characteristics of the convolution pulses. The array sizes should
be identical.
Vector T_array contains real numbers, so fractional numbers may be specified. However, the
position of each pulse is rounded to a multiple of the controller cycle. If the controller cycle is one
millisecond, the numbers in T_array are rounded to integers. The elements of T_array must be
arranged in ascending order.
The sum of A_array entries must equal 1.
See the Using the Convolve Web Site chapter in the ACSPL+ Programmers Guide to get the
explanation how to calculate the T_array and A_array parameters
Examples
enable 0
InShapeOn 0, CnvT, CnvA
ptp/e 0,0
ptp/e 0,50
till ^MST(0).#MOVE
InShapeOff 0
stop
!In this case we need to multiply CnvT array by CTIME. Here CTIME = 0.5
global real CnvT(5), CnvA(5), CnvB(420)
CnvT(0)=0*CTIME; CnvT(1)=1*CTIME ; CnvT(2)=214*CTIME ;CnvT(3)=253*CTIME;
CnvT(4)=501*CTIME
CnvA(0)=22960/1e5; CnvA(1)=10361/1e5; CnvA(2)=3186/1e5; CnvA
(3)=45767/1e5;
CnvA(4)=17726/1e5
enable 0
InShapeOn 0, CnvT, CnvA
ptp/e 0,0
ptp/e 0,30
till ^MST(0).#MOVE
!InShapeOff 0
stop
8.13.2 INSHAPEOFF
Description
The INSHAPEOFF function stops Input Shape algorithm for specified axis
Syntax
INSHAPEOFF Axis_Index
Arguments
Return Value
None
8.13.3 AST
The #INSHAPE bit is set to 1 after calling INSHAPEON. The bit is set to zero after calling INSHAPEOFF.
Description
AST is an integer array, with one element for each axis in the system, the elements of which
contain a set of bits used for displaying the current axis state.
Syntax
[command] AST(axis_index).bit_designator
Arguments
axis_ Designates the specific axis, valid numbers are: 0, 1, 2, ... up to the number of
index axes in the system minus 1.
bit_
A description of the AST bit designators is given in Table 8-35.
designator
The controller sets the bit to inform that a new segment is required
to be provided by the application. The bit is set starvation_margin
#NEWSEGM 16
ms before the starvation condition occurs. The starvation condition
is indicated by #STARV bit.
0: modulation is off
#LCMODUL 22
1: modulation is active
0: hold is off
#HOLD 24
1: hold is in progress
Tag
7
Accessibility
Read-Only
Related ACSPL+ Commands
MASTER, SLAVE
8.13.4 APOSFILT
Description
APOSFILT is real array with one element for each axis in the system. The array elements store the
current desired motor position, including the filtering operation result, such as input shaping.
APOSFILT updates on every controller cycle according to the filtering algorithm. When
the filtering algorithm is not configured, APOSFILT = APOS.
TAG
368
ACCESSIBILITY
Read-Only
RELATED ACSPL+ COMMANDS
All motion commands
RELATED ACSPL+ VARIABLES
FPOS, RPOS, APOS,
.NET LIBRARY METHODS
ReadVariable(), WriteVariable()
C LIBRARY FUNCTIONS
acsc_ReadReal(), acsc_WriteReal()
Use the name and password that you received from ACS Motion Control along with the
controller.
The first time you log into the web site, you will be required to review the licensing agreement for
use of the site. For each subsequent log-in you will be reminded of the licensing agreement and
remaining number of trials until expiration of the account will be displayed.
Click Download to access another window that contains the results of the calculation. A sample
output file is shown below for the design of an Input Shaper with the following parameters:
> Measured Vibration Frequency - 100 Hz
> Damping - 0.05
> Delta T for trajectory generation - 0.001 second
> Amplitude sum - 100000
> Robust was selected - (Constraint = 1)
This is an illustration of the output.
The output from the calculation is five impulses that characterize the Input Shaper™. The delays
are specified in terms of digital time steps and for Delta T =.001 second, the delays would be at 0,
0.002, 0.005, 0.007 and 0.011 seconds.
The reported Time values should be used in the T argument of the inshape function. The reported
Amp values are multiplied by 100000. The following example shows how the inshape arguments
should be initialized to use the reported values:
The results from the calculation can be saved directly by using the web browser file GUI File gSave
as …. Save the results as a text file (*.txt), so Input Shaper™ coefficients can be downloaded into a
controller. The same file will sent by email to the email account specified when the account was
created.
Click the Curve option (shown above) to display the useful frequency range for the Input Shaper™.
A new window, opens to display the Insensitivity Curve. This plot is the Insensitivity Curve for the
example:
The Insensitivity Curve displays the theoretical amount of residual vibration that results after
applying the Input Shaper™ to the system. The horizontal axis is the vibration frequency of the
system and the vertical axis is the percentage of remaining or residual vibration. When the residual
vibration = 0, for a perfect linear system, there should be no vibration after applying the Input
Shaper™. In the case shown above, the residual vibration should be 0 at a frequency of 100 Hz,
which was the design frequency.
If the frequency of the actual system is not equal to 100 Hz, there will be residual vibration present.
This level of vibration is expressed on a percentage basis. If the residual vibration equals 100%, then
the no vibration reduction has occurred. For the Input Shaper™ shown above, the system vibration
frequency could vary between 85 to 115 Hz and the residual vibration should be less than 5% (or
when compared to the case of not using the Input Shaper™, the vibrations should be reduced by
95%).
Vibration reduction is expressed for a “perfect” linear system. There are some
examples of perfect, linear systems in the real world that do achieve close to 100%
cancellation. One good example of a “perfect” system is a simulation. Input Shaping
usually performs very well in simulation. However for most physical systems, the
vibration reduction will usually be in the range of 95 to 98% of the original vibrations.
The frequency range for the Insensitivity Curve can be changed by selecting new minimum and
maximum frequency values and then clicking New Curve. The damping ratio can also be changed
to determine the effect of changes in the estimated damping of the system. In general, changes in
damping in the range from 0.005 to 0.1 have a limited effect on the Insensitivity Curve. When the
system damping ratio is greater than 0.1, the effectiveness of the Input Shaper™ will be improved
by specifying a damping ratio that is close to that of the actual system.
The Insensitivity Curve can also be used to examine the effect of selecting whether or not an
Input Shaper™ should be designed using the Robust selection. If Robust is not selected for a
particular frequency, the useful range of the Input Shaper™ will be reduced. For example the
Insensitivity Curve for the same Input Shaper™ without Robust is:
In this case, the frequency range for 95% cancellation of the vibration is much smaller, 95 to 105Hz.
However the benefit is that the duration of the Input Shaper™ will be 50% less.
It is possible to use non-robust setting to design an Input Shaper™ that will be effective over a
wider range of frequencies. Two frequencies can be specified to create a frequency band for
vibration cancellation.
The most common use of the algorithm is to improve the settling of systems mounted on passive
isolation platforms. Passive isolation is typically used to isolate systems from disturbances
transmitted from the floor. They employ a seismic mass supported on a soft spring made of rubber,
metal, or air. The spring’s damping action absorbs vibrations above the spring’s resonance. For this
reason, passive isolation manufacturers usually try to lower spring resonant frequency to increase
the effective isolation range. When a servo force is applied to generate motion, it also acts on the
isolated stationary base, causing it to vibrate. Because the frequency is low (usually below 1 Hz, to
10 Hz) and damping is very light, the isolation system continues vibrating long after the motion
profile has ended. This vibration acts as disturbance to the servo system, introduces position error,
and extends the settling time.
The Disturbance Rejection algorithm is used to minimize the latter effect and improve the position
error during settling. The green graph shows the velocity command (in [mm/sec]) of a linear stage
mounted on passive isolation, with a resonant frequency of approximately 5 Hz. The red graph
shows the position error with a standard PIV algorithm. The 5Hz disturbance is clearly observed
during settling. The disturbance is relatively small (less than 1 micron), yet it may be critical if the
required settling window is very small (as an example, the resolution of semiconductor instruments
is approaching and in some cases going below 1nm). This disturbance can be minimized by
increasing the PIV gains (SLVKP, SLVKI, SLPKP - see SPiiPlus ACSPL+ Command and Variable
Reference Guide), yet it cannot necessarily be eliminated and if the values of the PIV gains are too
high this may lead to marginal stability. A better solution is using the DRA algorithm. As it can be
seen in the blue graph the disturbance is fully eliminated.
If tuned properly the algorithm has minimal effect on the servo stability margins.
DRA is usually not very effective if the vibration frequency is relatively high (>10Hz), or
the system bandwidth is very low.
Excessive values of SLRA, and SLDRX may cause servo instability, ringing and increased standstill
jitter. In such cases the parameters should be significantly reduced. With good settings, you should
usually be able to double the parameters without getting instability.
Velocity error (1 division = 0.02 mm/sec) during settling process of a linear axis. The maximal value
of the periodical error is used to determine the SLDRX parameter.
The Bi-Quad filter is the most general 2nd order filter. It has two poles and two zeros. It can be
thought of as a high-pass filter in series with a low-pass filter. The transfer function of the Bi-Quad
filter is as follows:
Where:
> ωN and ωD are the numerator (high-pass filter zero) and denominator (low-pass filter pole)
frequencies, respectively.
> ζ N and ζ D are the numerator and denominator damping ratios, respectively.
The Bi-Quad filter can be used to compensate mechanical resonances, improve stability margins
and system bandwidth.
The Bi-Quad filter can be configured as an additional Notch using the following formulas:
> Set the numerator and denominator frequencies equal to the Notch frequency in[Hz]:
>
> Set the numerator damping ratio equal to half the ratio between the Notch width and
Notch frequency:
>
Maximal recommended ratio between width and frequency= 1/3.
> Set the denominator damping ratio equal the numerator damping ratio times the Notch
attenuation (in absolute value):
>
Below there are several examples that demonstrate the generality of the Bi-Quad filter.
SLVB0NF = SLVB0DF
SLVB0ND < SLVB0DD
All bits (except #INSYNC in some cases) should be true for proper bus functioning, for
monitoring the bus state, checking the #OP bit is sufficient. Any bus error will reset the
#OP bit.
9.2.1.2 ECERR
Any EtherCAT error sets ECST.#OP to false and the error code is latched in the ECERR variable. The
only way to reset the error state and to clear the ECERR value is by calling ECRESTART function.
The EtherCAT error codes are:
Table 9-2. EtherCAT Error Codes
9.2.1.3 #ETHERCAT
The #ETHERCAT command is available for gaining complete information about the connected
EtherCAT slaves: The command is entered through the SPiiPlus MMI Application Studio
Communication Terminal. The command provides the following:
> Slave number
> Vendor ID
> Product ID
> Revision
Internal EtherCAT offset (in bytes or bits) of network variable (which can be
seen by running the #ETHERCAT command).
OFFSET
> No suffix: EtherCAT offset in bytes
> "/b" suffix: the offset is in bits
Comments:
Once the function is called successfully, the Firmware copies the value of the network input
variable at the corresponding EtherCAT offset into the ACSPL+ variable, every controller cycle.
There is no restriction on number of mapped network variables.
The mapping is allowed only when stack is operational, that is, ECST.#OP is true.
In the event of incorrect parameters or stack state, the function will produce the corresponding
runtime error.
9.3.1.2 ECOUT
Description:
The ECOUT function is used for mapping output variables to the EtherCAT network.
Syntax:
ECOUT[/B](int offset, Varname)
Arguments:
Internal EtherCAT offset (in bits or bytes) of network variable (which can be
seen by running the #ETHERCAT command).
OFFSET
> No suffix: EtherCAT offset in bytes
> "/b" suffix: the offset is in bits
It’s recommended to use the ECGETOFFSET function to retrieve the offset, in bytes or
in bits.
It’s possible to use combine the “/r suffix with the “/b” suffix.The syntax is as following:
Comments:
The Firmware copies the value of ACSPL+ variable into the network output variable at the
corresponding EtherCAT offset, every controller cycle.
There is no restriction on number of mapped network variables.
The mapping is allowed only when stack is operational, that is, ECST.#OP is true.
In the event of incorrect parameters or stack state, the function will produce the corresponding
runtime error.
9.3.1.3 ECUNMAP
Description:
The ECUNMAP is used for resetting all previous mapping defined by ECIN and ECOUT.
Syntax:
ECUNMAP
Comments:
The function call is legal only when stack is operational, that is, ECST.#OP is true.
9.3.1.4 ECCLRREG
Description
ESC Error Counters Registers Clear. The ECCLRREG function clears the contents of the error counters
registers.
Syntax
void ECCLRREG(index,offset)
Arguments
Return Value
None
Comments
When the Offset value is -1, all error counters in all slaves are cleared. Otherwise, only the specific
register at the specified Offset is cleared.
After executing the ECCLRRG function, we recommend to execute the FCLEAR function without
parameters before running ECGETREG.
Example
Run the following code example in a Program Buffer.
ECCLRREG(0,0x310)
FCLEAR
STOP
You can also enter this code in the SPiiPlus MMI Application Studio Connection Terminal:
ECCLRREG(0,-1).
9.3.1.5 ECGETREG
Description
ESC Error Counters Registers (Beckhoff Memory). The ESCs have numerous error counters that help
you detect and locate errors. The ECGETREG function enables you to view the contents of these
registers.
Syntax
int ECGETREG(index,offset)
Arguments
Return Value
None
Comments
The fsupported error counter registers are:
Table 9-3. Supported Error Counter Registers
Forwarded RX Error
0x309
Counter
Forwarded RX Error
0x30A
Counter (CRC C/D)
Forwarded RX Error
0x30B
Counter
ECAT Processing Unit Invalid frame passing the EtherCAT Processing Unit
0x30C
Error Counter (additional checks by processing unit).
Example
Run the following code example in a Program Buffer.
I0=ECGETREG(0,0x310)
STOP
You can also enter this code in the SPiiPlus MMI Application Studio Connection Terminal:
?ECGETREG(0,0x310)
.
9.3.1.6 ECGETSLAVES
Description
This function is used to retrieve the number of slaves in an EtherCAT network.
Syntax
ECGETSLAVES
Arguments
None
Return Value
Number of EtherCAT slaves in the network.
Comments
If a slave was added or removed, the ECRESCAN command should be used before using
ECGETSLAVES again.
9.3.1.7 ECUNMAPIN
Description
This function is used to reset all previous mapping defined by ECIN to a specfic offset.
Syntax
ECUNMAPIN(ECOffset)
Arguments
ECOffset An integer providing the offset to which a variable was mapped using ECIN.
Return Value
None
Comments
The mapping is allowed only when stack is operational.
Example
Given the previous execution of ECIN(48,I0), ECUNMAPIN(48) will unmap only I0.
9.3.1.8 ECUNMAPOUT
Description
This function is used to reset all previous mapping defined by ECOUT to a specfic offset.
Syntax
ECUNMAPOUT(ECOffset)
Arguments
ECOffset An integer providing the offset to which a variable has been mapped by ECOUT.
Return Value
None
Example
Assuming previous execution of ECOUT(48,I0) and ECOUT(50,I1), executing ECUNMAPOUT(48) will
unmap only I0.
The #ETHERCAT command can be used to check if a slave has Mailbox support.
9.3.2.1 COEWRITE
Description:
The COEWRITE function is used to write a value into a given slave.
Syntax:
COEWRITE[/size] (int slave,int Index,int Subindex,real Value)
Arguments:
Comments:
In case of wrong parameters, the corresponding runtime error will be generated. The function
cannot be used in the SPiiPlus MMI Application Studio Communication Terminal. The function delays
the buffer execution on its line until it is successful or fails the whole buffer with timeout or other
error.
This function with the “/d” suffix provides the capability of reading a double type (64
bit).
9.3.2.2 COEREAD
Description:
The COEREAD function is used to read a value from a given slave.
Syntax:
real COEREAD[/size] (int slave,int Index,int Subindex)
Arguments:
Comments:
The function returns the received value or fails with runtime error.
In case of wrong parameters, the corresponding runtime error will be generated. The function
cannot be used in the SPiiPlus MMI Application Studio Communication Terminal. The function delays
the buffer execution on its line until it is successful or fails the whole buffer with timeout or other
error.
This function with the “/d” suffix provides the capability of reading a double type (64
bit).
10.1.1 StepperClosedLoopFirmwareBased
The firmware-based position correction methods may be implemented on the PDIcl drive interface
hardware. The Full Mode method performs position correction on every cycle during the motion.
End Mode completes the correction at the end of the motion. In both cases, the correction only
takes place if the position is outside the dead zone.
Position Correction is set to Full Mode by setting MFLAGSX=0.
Position Correction is set to End Mode by setting MFLAGSX=1.
The position correction is added to RPOS, as such RPOS turns into an accumulator for all corrections
done for the axis and may inflate to large values – this does not reflect the position itself and
further references to position should be done by FPOS and APOS.
These methods are controlled according to the values of SLSKI, SLSKP, SLSRL, SLSMC, SLSDZ, and
SLSOUT.
The position correction is added to RPOS, so RPOS turns into an accumulator for all corrections done
for the axis and may inflate to large values – this does not reflect the position itself and further
references to position should be done by FPOS and APOS.
10.1.2 StepperClosedLoopServoProcessor
Servo Processor based correction may be implemented on any PWM drive by setting MFLAGSX=2.
The mechanism is controlled according to the values of SLPKP and SLSRL.
Errors in
1000 - Errors in terminal commands are reported immediately in the
terminal
1999 prompt that is displayed in response to the command.
commands
6000
EtherCAT Stored in the ECERR variable, and when occurs, sets ECST.#OP to
-
code false.
6999
EtherCAT
codes
7000 -
based on Stored in the ECALERR variable, and a value "0" indicates no error.
7999
AL Status
codes
If a command cannot be executed for any reason, the controller responds with the error prompt.
The error prompt contains the “?” character and 4-digit error code. For example:
VEL(0) = 1000
FPOS(0) = 0
Motor 0(X): enabled, idle, in positionAxis 0(X): motion was killed by user
Motor 13(Axis13): enabled, idle, in positionMotor 13(Axis13): motion failed, reason 5011
Motor 2(Z): disabled Disable reason: 5023 - Critical Position ErrorAxis 2(Z): motion was killed
because a motor was disabled
10 11 12 13 14 15 16 17 18 19 20
Feed
00 00 0 0 00 0 00 0 00 00 00
back
0 0 00 00 0 00 0 00 0 0 0
10 10 11 12 13 15 16 17 18 18 19
Actu
01 99 9 9 99 0 01 02 00 99 99
al
2 8 85 81 7 07 3 3 5 3 1
+1 - - +1 +2
Error -2 -3 +7 +5 -7 -9
2 15 19 3 3
Only the third row is entered to a controller variable and is stored in the flash X_ERROR file. Details
of the calibration routine, which can be implemented using ACSPL+, are not discussed here.
An application that uses the file may provide an initialization routine like this:
The CONNECT function specifies that the reference position be calculated by subtracting the
interpolated error from the desired position so that the actual value will be closer to the desired
value.
In this case the application can implement an initialization routine like this:
WRITE X_CALREAD X_CAL Write to and read from calibration table from the flash memory.
And the X_CALIBR file can also contain a table with non-uniform points.
By using this CONNECT, the value added to desired position changes immediately when the
direction of the motion changes. In many cases such jumps in the desired position are harmful. In
this case the third parameter in the DSIGN function (see SPiiPlus Command & Variable Reference
Guide) can be used to gradually implement the backlash compensation. In the following example
the backlash compensation is introduced by small steps, so that the compensation growth to the
entire value by 20 milliseconds:
If the 0 axis executes master-slave motion slaved to some physical value like encoder feedback,
the RVEL value contains noise that can cause undesirable switching of the backlash sign. In this case
the second parameter of the DSIGN function can be used to introduce anti-bouncing effect. In the
following example the backlash compensation changes its sign only if RVEL holds its new sign for
more than 10 milliseconds:
AUTOEXEC:
WRITE CAMTABLEREAD Write to and read from calibration table from the
CAMTABLE,CAMTABLE flash memory.
12.6 Joystick
Assume that a joystick that controls the motion of an X,Y table is connected to analog inputs AIN(0),
AIN(1). The velocity of each coordinate must be proportional to the corresponding analog input.
Analog input lower than 20 counts must be ignored to avoid motion due to analog drift or bias. The
X (axis 0) motion is limited in the range from -500 to 100000 counts. The Y (axis 1) motion is limited
in the range from -500 to 500000 counts.
The following program fragment initializes the joystick motion:
real JK
JK = 10 Joystick factor
The illustration below shows the rotation of the plane from the original (x, y, z) plane to a rotated
(x’’’, y’’’, z’’’) plane.
Where R is the product of the rotation matrices used to shift the plane, represents the vector
coordinates in the rotated plane, and represents the vector coordinates in the initial plane. For
example, rotation about the Z axis can be expressed as: . The three-dimensional
rotation matrix is expressed as the product of all three individual matrices:
This allows the final plane coordinates to be solved for from the initial plane coordinates. To utilize
this rotation on the ACS controller, it is also necessary to solve this equation such that the initial
plane coordinates are solved for using the final plane coordinates, or . In this
With these equations, it is now possible to utilize the SET and CONNECT equations to establish a
rotated plane on the controller. Consider RPOS of the axes to be the axis positions in the initial
plane, and APOS to be the commanded positions in the rotated plane. It is now possible to use the
CONNECT equation to allow the controller to automatically calculate the actuator positions based on
user commanded positions in the rotated plane. See below for an example of how this is done: