0% found this document useful (0 votes)
11 views

SPiiPlus .NET Library Programmer's Guide

The SPiiPlus .NET Library Programmer's Guide, released in April 2019, provides comprehensive instructions for using the SPiiPlus .NET Library, including programming examples and methods for communication and motion control. The document includes a revision history, conventions used, and related documents for further reference. It emphasizes that information is subject to change and cannot be reproduced without permission from ACS Motion Control Ltd.

Uploaded by

liuaiwei2005
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

SPiiPlus .NET Library Programmer's Guide

The SPiiPlus .NET Library Programmer's Guide, released in April 2019, provides comprehensive instructions for using the SPiiPlus .NET Library, including programming examples and methods for communication and motion control. The document includes a revision history, conventions used, and related documents for further reference. It emphasizes that information is subject to change and cannot be reproduced without permission from ACS Motion Control Ltd.

Uploaded by

liuaiwei2005
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 295

SPiiPlus .

NET Library

Programmer's Guide
April 2019
Document Revision: 2.70
SPiiPlus .NET Library Programmer's Guide

SPiiPlus .NET Library

Release Date: April 2019

COPYRIGHT

© ACS Motion Control Ltd.2019. All rights reserved.

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.

Windows and Visual Basic are trademarks of Microsoft Corporation.

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

[email protected]

[email protected]

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 2.70 2
SPiiPlus .NET Library Programmer's Guide

Revision History
Date Revision Description

March > Removed internal use Program Management functions


2.70
2019 controlling breakpoints

> Replace "X" in programming examples with and axis


number, as necessary
> Updated all programming examples
July 2018 2.60
> Replace extended segmented motion function
SegmentArc1 with ExtendedSegment ARC1
SegmentArc2 with ExtendedSegment ARC2

February
2.50.10 Replaced "GUI" with "command"
2018

December
2.50 Updated for SPiiPlus ADK Suite v2.50
2017

June 2017 2.40 Updated for SPiiPlus ADK Suite v2.40

October
2.30.01 Removed ACSC_INTR_MESSAGE
2016

August
2.30 First release
2016

Version 2.70 3
SPiiPlus .NET Library Programmer's Guide

Conventions Used in this Guide


Text Formats

Format Description

Bold Names of GUI objects or commands

BOLD + UPPERCASE ACSPL+ variables and commands

Monospace + grey
Code example
background

Italic Names of other documents

Blue Hyperlink

[] In commands indicates optional item(s)

| In commands indicates either/or items

Flagged Text

Note - includes additional information or programming tips.

Caution - describes a condition that may result in damage to equipment.

Warning - describes a condition that may result in serious bodily injury or death.

Model - highlights a specification, procedure, condition, or statement that


depends on the product model

Advanced - indicates a topic for advanced users.

Version 2.70 4
SPiiPlus .NET Library 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 and SPiiPlus ADK suite Release Notes 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 associated
Studio User monitoring tools.
Guide

SPiiPlus
Command &
Describes all of the variables and commands available in the ACSPL+
Variable
programming language.
Reference
Guide

SPiiPlus C
Library
C++ and Visual Basic® libraries for host PC applications. This guide is
Reference
applicable for all the SPiiPlus motion control products
Programmer
Guide

SPiiPlus COM
Library COM Methods, Properties, and Events for Communication with the
Programmer's Controller.
Guide

SPiiPlus
A guide for using the SPiiPlus User Mode Driver (UMD) for setting up
Utilities User
communication with the SPiiPlus motion controller.
Guide

SPiiPlus
ACSPL+ Provides practical instruction on how to use ACSPL+ to program your
Programmer's motion controller
Guide

AN PEG and
Provides detailed description, specification and operation instructions
MARK
for PEG capabilities.
Operations

Version 2.70 5
SPiiPlus .NET Library Programmer's Guide

Table of Contents
1. General Information 19
1.1 General 19
1.2 Operating Environment 19
1.3 Communication Channels 19
1.4 Controller Simulation 19
1.5 Supported Programming Languages 19
1.6 Installation and Supplied Components 19
1.7 Asynchronous Calls Support 20
1.8 Standard (SPiiPlus C Library) Features 20
1.9 Specific .NET Library Features 21
1.10 Communication Scenarios 21
2. Using the SPiiPlus NET Library 24
2.1 Redistribution 24
2.2 Visual Studio .NET 24
3. Methods 25
3.1 Communication Methods 26
3.1.1 Structures 27
3.1.1.1 ACSC_CONNECTION_DESC 27
3.1.1.2 ACSC_PCI_SLOT 28
3.1.1.3 ACSC_CONNECTION_INFO 28
3.1.2 Enumerations 29
3.1.2.1 ACSC_CONNECTION_TYPE 29
3.1.3 CancelOperation 29
3.1.4 Command 30
3.1.5 CloseComm 30
3.1.6 CloseSimulator 31
3.1.7 GetConnectionInfo 31
3.1.8 GetConnectionsList 32
3.1.9 GetEthernetCards 33
3.1.10 GetPCICards 33
3.1.11 OpenCommSimulator 34
3.1.12 OpenCommEthernetTCP 35

Version 2.70 6
SPiiPlus .NET Library Programmer's Guide

3.1.13 OpenCommEthernetUDP 35
3.1.14 OpenCommPCI 36
3.1.15 OpenCommSerial 37
3.1.16 SetServerExtLogin 37
3.1.17 TerminateConnection 38
3.1.18 Transaction 39
3.2 EtherCAT® Methods 39
3.2.1 GetEtherCATState 40
3.2.2 GetEtherCATError 41
3.2.3 MapEtherCATInput 42
3.2.4 MapEtherCATOutput 43
3.2.5 UnmapEtherCATInputsOutputs 44
3.2.6 GetEtherCATSlaveIndex 44
3.2.7 GetEtherCATSlaveOffset 45
3.2.8 GetEtherCATSlaveVendorID 46
3.2.9 GetEtherCATSlaveProductID 46
3.2.10 GetEtherCATSlaveRevision 46
3.2.11 GetEtherCATSlaveType 47
3.2.12 GetEtherCATSlaveState 47
3.3 Service Communication Methods 49
3.3.1 GetACSCHandle 49
3.3.2 GetNETLibraryVersion 49
3.3.3 GetCommOptions 50
3.3.4 GetDefaultTimeout 51
3.3.5 GetErrorString 51
3.3.6 GetLibraryVersion 52
3.3.7 GetTimeout 52
3.3.8 SetIterations 53
3.3.9 SetCommOptions 54
3.3.10 SetTimeout 54
3.4 ACSPL+ Program Management Methods 55
3.4.1 AppendBuffer 56
3.4.2 ClearBuffer 56
3.4.3 CompileBuffer 57

Version 2.70 7
SPiiPlus .NET Library Programmer's Guide

3.4.4 LoadBuffer 58
3.4.5 LoadBuffersFromFile 59
3.4.6 RunBuffer 60
3.4.7 StopBuffer 61
3.4.8 SuspendBuffer 61
3.4.9 UploadBuffer 62
3.5 Read and Write Variables Methods 63
3.5.1 ReadVariable 63
3.5.2 ReadVariableAsScalar 67
3.5.3 ReadVariableAsVector 69
3.5.4 ReadVariableAsMatrix 72
3.5.5 WriteVariable 75
3.6 History Buffer Management Methods 80
3.6.1 OpenHistoryBuffer 80
3.6.2 CloseHistoryBuffer 80
3.6.3 GetHistory 81
3.7 Unsolicited Messages Buffer Management Methods 82
3.7.1 OpenMessageBuffer 82
3.7.2 CloseMessageBuffer 83
3.7.3 GetSingleMessage 83
3.8 Log File Management Methods 84
3.8.1 OpenLogFile 85
3.8.2 CloseLogFile 85
3.8.3 WriteLogFile 86
3.8.4 FlushLogFile 87
3.9 SPiiPlusSC Log File Management Methods 87
3.9.1 OpenSCLogFile 88
3.9.2 CloseSCLogFile 88
3.9.3 WriteSCLogFile 88
3.9.4 FlushSCLogFile 89
3.10 Shared Memory Methods 90
3.10.1 GetSharedMemoryAddress 90
3.10.2 ReadSharedMemoryInteger 90
3.10.3 ReadSharedMemoryReal 91

Version 2.70 8
SPiiPlus .NET Library Programmer's Guide

3.10.4 WriteSharedMemoryVariable 91
3.10.5 Shared Memory Program Example 92
3.11 System Configuration Methods 92
3.11.1 SetConf 93
3.11.2 GetConf 94
3.11.3 GetVolatileMemoryUsage 95
3.11.4 GetVolatileMemoryTotal 95
3.11.5 GetVolatileMemoryFree 96
3.11.6 GetNonVolatileMemoryUsage 96
3.11.7 GetNonVolatileMemoryTotal 97
3.11.8 GetNonVolatileMemoryFree 97
3.12 Setting and Reading Motion Parameters Methods 98
3.12.1 SetVelocity 99
3.12.2 SetVelocityImm 100
3.12.3 GetVelocity 101
3.12.4 SetAcceleration 102
3.12.5 SetAccelerationImm 103
3.12.6 GetAcceleration 103
3.12.7 SetDeceleration 104
3.12.8 SetDecelerationImm 105
3.12.9 GetDeceleration 106
3.12.10 SetJerk 107
3.12.11 SetJerkImm 107
3.12.12 GetJerk 108
3.12.13 SetKillDeceleration 109
3.12.14 SetKillDecelerationImm 110
3.12.15 GetKillDeceleration 111
3.12.16 SetFPosition 111
3.12.17 GetFPosition 112
3.12.18 SetRPosition 113
3.12.19 GetRPosition 113
3.12.20 GetFVelocity 114
3.12.21 GetRVelocity 115
3.13 Axis/Motor Management Methods 115

Version 2.70 9
SPiiPlus .NET Library Programmer's Guide

3.13.1 CommutExt 116


3.13.2 Enable 117
3.13.3 EnableM 117
3.13.4 Disable 118
3.13.5 DisableAll 119
3.13.6 DisableExt 119
3.13.7 DisableM 120
3.13.8 Group 121
3.13.9 Split 122
3.13.10 SplitAll 122
3.14 Motion Management Methods 123
3.14.1 Go 124
3.14.2 GoM 125
3.14.3 Halt 126
3.14.4 HaltM 127
3.14.5 Kill 128
3.14.6 KillAll 129
3.14.7 KillM 130
3.14.8 KillExt 131
3.14.9 Break 132
3.14.10 BreakM 133
3.15 Point-to-Point Motion Methods 134
3.15.1 ToPoint 135
3.15.2 ToPointM 136
3.15.3 ExtToPoint 138
3.15.4 ExtToPointM 139
3.16 Track Motion Control Method 141
3.16.1 Track 142
3.17 Jog Methods 142
3.17.1 Jog 143
3.17.2 JogM 144
3.18 Slaved Motion Methods 146
3.18.1 SetMaster 146
3.18.2 Slave 147

Version 2.70 10
SPiiPlus .NET Library Programmer's Guide

3.18.3 SlaveStalled 149


3.19 Multi-Point Motion Methods 151
3.19.1 MultiPoint 151
3.19.2 MultiPointM 152
3.20 Arbitrary Path Motion Methods 154
3.20.1 Spline 155
3.20.2 SplineM 156
3.21 PVT Methods 158
3.21.1 AddPVPoint 159
3.21.2 AddPVPointM 160
3.21.3 AddPVTPoint 161
3.21.4 AddPVTPointM 163
3.22 Segmented Motion Methods 164
3.22.1 SegmentedMotion 165
3.22.2 ExtendedSegmentedMotion 166
3.22.3 SegmentLine 170
3.22.4 ExtendedSegmentArc1 172
3.22.5 ExtendedSegmentArc2 175
3.22.6 Stopper 178
3.22.7 Projection 180
4. Blended Segmented Motion Functions 182
4.0.1 BlendedSegmentMotion 182
4.0.2 BlendedLine 184
4.0.3 BlendedArc1 186
4.0.4 BlendedArc2 188
4.1 Points and Segments Manipulation Methods 190
4.1.1 AddPoint 191
4.1.2 AddPointM 192
4.1.3 ExtAddPoint 193
4.1.4 ExtAddPointM 194
4.1.5 EndSequence 196
4.1.6 EndSequenceM 197
4.2 Data Collection Methods 198
4.2.1 DataCollectionExt 198

Version 2.70 11
SPiiPlus .NET Library Programmer's Guide

4.2.2 StopCollect 200


4.3 Status Report Methods 201
4.3.1 GetMotorState 201
4.3.2 GetAxisState 202
4.3.3 GetIndexState 202
4.3.4 ResetIndexState 203
4.3.5 GetProgramState 204
4.4 Inputs/Outputs Access Methods 205
4.4.1 GetInput 206
4.4.2 GetInputPort 207
4.4.3 GetOutput 207
4.4.4 GetOutputPort 208
4.4.5 SetOutput 209
4.4.6 SetOutputPort 209
4.4.7 GetAnalogInputNT 210
4.4.8 GetAnalogOutputNT 211
4.4.9 SetAnalogOutputNT 212
4.4.10 GetExtInput 212
4.4.11 GetExtInputPort 213
4.4.12 GetExtOutput 214
4.4.13 GetExtOutputPort 215
4.4.14 SetExtOutput 215
4.4.15 SetExtOutputPort 216
4.5 Safety Control Methods 217
4.5.1 GetFault 218
4.5.2 SetFaultMask 219
4.5.3 GetFaultMask 220
4.5.4 EnableFault 220
4.5.5 DisableFault 221
4.5.6 SetResponseMask 222
4.5.7 GetResponseMask 223
4.5.8 EnableResponse 224
4.5.9 DisableResponse 225
4.5.10 GetSafetyInput 225

Version 2.70 12
SPiiPlus .NET Library Programmer's Guide

4.5.11 GetSafetyInputPort 226


4.5.12 GetSafetyInputPortInv 227
4.5.13 SetSafetyInputPortInv 228
4.5.14 FaultClear 229
4.5.15 FaultClearM 230
4.6 Wait-for-Condition Methods 231
4.6.1 WaitMotionEnd 231
4.6.2 WaitLogicalMotionEnd 232
4.6.3 WaitCollectEndExt 232
4.6.4 WaitProgramEnd 233
4.6.5 WaitMotorCommutated 234
4.6.6 WaitMotorEnabled 235
4.6.7 WaitInput 235
4.7 Event and Interrupt Handling Methods 236
4.7.1 EnableEvent 236
4.7.2 DisableEvent 237
4.7.3 SetInterruptMask 238
4.7.4 GetInterruptMask 239
4.8 Variables Management Methods 241
4.8.1 DeclareVariable 241
4.8.2 ClearVariables 242
4.9 Service Methods 242
4.9.1 GetLogData 243
4.9.2 GetFirmwareVersion 243
4.9.3 GetSerialNumber 244
4.9.4 SysInfo 244
4.9.5 GetBuffersCount 245
4.9.6 GetAxesCount 245
4.9.7 GetDBufferIndex 246
4.10 Error Diagnostics Methods 246
4.10.1 GetMotorError 246
4.10.2 GetMotionError 247
4.10.3 GetProgramError 248
4.11 Position Event Generation (PEG) Methods 248

Version 2.70 13
SPiiPlus .NET Library Programmer's Guide

4.11.1 AssignPegNT 249


4.11.2 AssignPegOutputsNT 250
4.11.3 AssignFastInputsNT 250
4.11.4 PegIncNT 251
4.11.5 PegRandomNT 252
4.11.6 WaitPegReadyNT 254
4.11.7 StartPegNT 254
4.11.8 StopPegNT 255
4.12 Application Save/Load Methods 255
4.12.1 Structures and Classes 256
4.12.1.1 ApplicationFileInfo 256
4.12.1.2 ACSC_APPSL_STRING 257
4.12.2 Enumerations 257
4.12.2.1 ACSC_APPSL_FILETYPE 257
4.12.3 AnalyzeApplication 257
4.12.4 LoadApplication 258
4.12.5 SaveApplication 259
4.12.6 FreeApplication 259
4.13 Load/Upload Data To/From Controller Methods 260
4.13.1 LoadDataToController 260
4.13.2 UploadDataFromController 261
4.14 Emergency Stop Methods 263
4.14.1 RegisterEmergencyStop 263
4.14.2 UnregisterEmergencyStop 264
4.15 Reboot Methods 265
4.15.1 ControllerReboot 265
4.15.2 ControllerFactoryDefault 265
4.16 Host-Controller File Operations 266
4.16.1 CopyFileToController 266
4.16.2 DeleteFileFromController 267
4.17 Save to Flash Functions 267
4.17.1 ControllerSaveToFlash 267
4.18 SPiiPlusSC Management 269
4.18.1 StartSPiiPlusSC 269

Version 2.70 14
SPiiPlus .NET Library Programmer's Guide

4.18.2 StopSPiiPlusSC 269


5. Enumerations 271
5.1 General Definitions 271
5.2 General Communication Options 271
5.3 Ethernet Communication Options 272
5.4 Serial Communication Options 272
5.5 Axis Definitions 272
5.6 Buffer Definitions 273
5.7 Servo Processor (SP) Definitions 273
5.8 EtherCAT Flags 273
5.9 Motion Flags 274
5.10 Data Collection Flags 276
5.11 Motor State Flags 276
5.12 Axis State Flags 277
5.13 Index and Mark State Flags 277
5.14 Program State Flags 278
5.15 Safety Control Masks 278
5.16 Interrupt Types 280
5.17 Callback Interrupt Masks 281
5.18 Configuration Keys 282
5.19 System Information Keys 283
5.20 Represantaion, Variables and Return Types Definitions 284
5.21 Log Detalization and Presentation Definitions 284
6. Events 286
7. Error Handling 287
7.1 Error Handling Example in C# 287
7.2 Error Codes 287

Version 2.70 15
SPiiPlus .NET Library Programmer's Guide

List of Tables
Table 3-1. Communication Methods 26
Table 3-2. EtherCAT Methods 39
Table 3-3. EtherCAT States 40
Table 3-4. EtherCAT Error Codes 42
Table 3-5. Service Communication Methods 49
Table 3-6. ACSPL+ Program Management Methods 55
Table 3-7. Read and Write Variables Methods 63
Table 3-8. Value Dimension Indices 76
Table 3-9. History Buffer Management Methods 80
Table 3-10. Unsolicited Messages Buffer Management Methods 82
Table 3-11. Log File Management Methods 84
Table 3-12. SPiiPlusSC Log File Management Methods 87
Table 3-13. Shared Memory Methods 90
Table 3-14. System Configuration Methods 92
Table 3-15. Setting and Reading Motion Parameters Methods 98
Table 3-16. Axis/Motor Management Methods 116
Table 3-17. Motion Management Methods 123
Table 3-18. Point-to-Point Motion Methods 135
Table 3-19. Track Motion Control Method 141
Table 3-20. Jog Methods 142
Table 3-21. Slaved Motion Methods 146
Table 3-22. Multi-Point Motion Methods 151
Table 3-23. Arbitrary Path Motion Methods 154
Table 3-24. PVT Methods 158
Table 3-25. Segmented Motion Methods 164
Table 3-26. Points and Segments Manipulation Methods 190
Table 3-27. Data Collection Methods 198
Table 3-28. Status Report Methods 201
Table 3-29. Inputs/Outputs Access Methods 205
Table 3-30. Safety Control Methods 217
Table 3-31. Wait-for-Condition Methods 231

Version 2.70 16
SPiiPlus .NET Library Programmer's Guide

Table 3-32. Event and Interrupt Handling Methods 236


Table 3-33. Variables Management Methods 241
Table 3-34. Service Methods 242
Table 3-35. Error Diagnostics Methods 246
Table 3-36. Position Event Generation (PEG) Methods 248
Table 3-37. Application Save/Load Methods 255
Table 3-38. Load/Upload Data To/From Controller Methods 260
Table 3-39. Emergency Stop Methods 263
Table 3-40. Reboot Methods 265
Table 3-41. Host-Controller File Copying Methods 266
Table 3-42. Save to Flash Methods 267
Table 3-43. SPiiPlusSC Management Methods 269
Table 4-1. General Definitions 271
Table 4-2. General Communication Options 271
Table 4-3. Ethernet Communication Options 272
Table 4-4. Serial Communication Option 272
Table 4-5. EtherCAT Flags 273
Table 4-6. Motion Flags 274
Table 4-7. Rotation Direction Flags 275
Table 4-8. Global Direction Flags 275
Table 4-9. Data Collection Flags 276
Table 4-10. Motor State Flags 276
Table 4-11. Axis State Flags 277
Table 4-12. Index and Mark State Flags 277
Table 4-13. Program State Flags 278
Table 4-14. Safety Control Masks 279
Table 4-15. Interrupt Types 280
Table 4-16. Callback Interrupt Masks 281
Table 4-17. Configuration Keys 282
Table 4-18. System Information Keys 283
Table 4-19. ACSPL+ Variables Types 284
Table 4-20. Representation Types 284
Table 4-21. Log Detalization Definitions 284
Table 4-22. Log Presentation Definitions 285

Version 2.70 17
SPiiPlus .NET Library Programmer's Guide

Table 5-1. Events and Interrupts 286


Table 6-1. NET Library Error Codes 287

Version 2.70 18
SPiiPlus .NET Library Programmer's Guide
1. General Information

1. General Information
1.1 General
The Microsoft .NET has become the most widely used software technology in the world of
Windows. The SPiiPlus NET Library provides the easiest way to incorporate SPiiPlus motion control
functionality.

1.2 Operating Environment


The SPiiPlus NET Library supports Microsoft® Windows® environments:
> Windows XP SP3 (32-bit and 64-bit)
> Windows 7 SP1 (32-bit and 64-bit)
> Windows Server 2003 (32-bit and 64-bit)
> Windows Server 2008 (32-bit and 64-bit)
> Windows Server 2008 R2 (64-bit)
> Windows Server 2012 R2 (64-bit)
> Windows 8.1 (32-bit and 64-bit)
> Windows 10 (32-bit and 64-bit)

1.3 Communication Channels


The SPiiPlus NET Library supports all communication channels provided by SPiiPlus motion
controllers:
> Serial (RS-232)
> Ethernet (point-to-point and network)
> PCI Bus

1.4 Controller Simulation


The SPiiPlus NET Library supports communication with a SPiiPlus Controller Simulator running on the
same PC. The SPiiPlus Controller Simulator emulates a controller, enabling program debugging and
demonstrations without a connection to a physical controller.

1.5 Supported Programming Languages


The SPiiPlus NET Library supports any programming languages that support the use of .NET
components. The SPiiPlus NET Library has been tested with Visual C#.NET applications.

1.6 Installation and Supplied Components


The SPiiPlus NET Library is supplied as a standard .NET assembly (DLL module) and can be references
from any .NET application. See Using the SPiiPlus NET Library for details. Samples for.NET are also
installed.

Version 2.70 19
SPiiPlus .NET Library Programmer's Guide
1. General Information

1.7 Asynchronous Calls Support


The SPiiPlus NET Library provides an ability of asynchronous operations. Each method that supports
asynchronous mode has compliment method with Async postfix. These async methods return
ACSC_WAITBLOCK object that can be used to wait for operation completion and receive operation
results.
To get a result of a previous asynchronous call GetResult method should be used. It receives the
wait block returned by async function and a timeout for wait operation. The Return Value of
GetResult method is NET object that can be further cast to string, int or double type, according to
asynchronous function called.

ACSC_
WAITBLOCK Wait block returned by Async method.
Waitblock

int timeout Number of milliseconds to wait for result.

Return When asynchronous execution completes returns result of execution that can
Value be further cast to specific .NET type.

1.8 Standard (SPiiPlus C Library) Features


The SPiiPlus NET Library provides the same standard features as the SPiiPlus C Library Rererence,
including:
> Unified support for all communication channels (Serial, Ethernet, PCI Bus)
All SPiiPlus NET Library methods except the OpenCommxxx methods are identical for all
communication channels. A (host computer) user application doesn't require any other
modification to work with different communication channels.
> Controller simulator communication channel
All SPiiPlus NET Library methods support the SPiiPlus Controller Simulator. The user client
application activates the simulator by opening a special communication channel. The user
is not required to change his application in order to communicate with the simulator.
> Concurrent support for up to 10 communication channels in one application
One user client application can open up to 10 communication channels simultaneously.
Different communication channels are usually connected to different controllers.
However, two or more communication channels can be connected to the same controller.
For Example, an application can communicate with a controller through both the
controller's Ethernet channel and its serial channels.
> Acknowledgement for each command to the controller
The library automatically checks the status of each command sent by the user application
to the controller. The user application can check the status to confirm that the command
was received successfully.
> Communication history

Version 2.70 20
SPiiPlus .NET Library Programmer's Guide
1. General Information

The SPiiPlus NET Library enables storage in a memory buffer of all messages sent to, and
received from, the controller. The application can retrieve data from the buffer and can
clear the buffer.
> Separate processing of unsolicited messages
Most messages sent from the controller to the host are responses to host commands.
However, the controller can send unsolicited messages, for Example, as output from a DISP
command. The library separates the unsolicited messages from the overall message flow
and provides a special method for handling unsolicited messages.
> Rich functionality
The .NET library supports setting and reading parameters, advanced motion control,
program management, I/O, safety, and more.
> Debug tools
The SPiiPlus NET Library provides tools that facilitate debugging of the user application.
The simulator and the communication history mentioned above are the primary
debugging tools. The user can also open a log file that stores all communications between
the application and the controller.

1.9 Specific .NET Library Features


The SPiiPlus NET Library also supports features based on .NET technology:
> Generating events for predefined controller events
The SPiiPlus NET Library generates events for the user client application if one of the
following events occurs:
> Emergency Stop signal has been generated
> Motion has ended
> Motion has been interrupted due to a fault
> Motor has been disabled due to a fault
> ACSPL+ program in the controller has completed
> User-defined event with passed parameters by INTERRUPTEX command
> Other events
> Error handling
The SPiiPlus NET Library raises ACSException with rich error information to a user client
application such as error code, Error Description and help context.

1.10 Communication Scenarios


One user application can open up to 10 communication channels simultaneously through the
SPiiPlus NET Library. Usually the application opens different communication channels to work with
different controller at the same time.
The following communication scenarios are typical for application development.
> Application works with one controller through one communication channel

Version 2.70 21
SPiiPlus .NET Library Programmer's Guide
1. General Information

Application creates communication channel object, opens communication and then uses
any SPiiPlus NET Library methods. Before closing the application closes communication and
then destroys the communication channel object.

// create communication object


Api channel = new Api();

// open connection (simulator)


channel.OpenCommSimulator();

// get axis position


double position = channel.GetFPosition(Axis.ACSC_AXIS_1);

// close communication
channel.CloseComm();

> Application works with several controllers by turns. Only one communication channel is
open at the same time
Application creates communication channel object, opens communication with first
controller and then uses any SPiiPlus NET Library methods. When the application needs to
connect to the second controller, it closes the previous communication and then opens
new a communication. In this case the application uses the same communication channel
object for each controller.
Before closing the application closes communication, then destroys communication
channel.

// create communication object


Api channel = new Api();

// open connection (simulator)


channel.OpenCommSimulator();

// get axis position


double position = channel.GetFPosition(Axis.ACSC_AXIS_1);

// close communication
channel.CloseComm();

// open connection (serial)


channel.OpenCommSerial(1, 115200);

// get axis position


position = channel.GetFPosition(Axis.ACSC_AXIS_0);

// close communication
channel.CloseComm();

> Application works with several controllers at the same time

Version 2.70 22
SPiiPlus .NET Library Programmer's Guide
1. General Information

In this case the application needs to open several communication channel objects, one for
each controller. Then for each communication channel it opens communication with
different controllers. Before closing the application closes all communications, then
destroys all communication channels.

// create communication object


Api channel1 = new Api();
Api channel2 = new Api();
Api channel3 = new Api();

// open connections
channel1.OpenCommSimulator();
channel2.OpenCommSerial(1, 115200);
channel3.OpenCommPCI(Api.ACSC_NONE);

// get axis position


double position1 = channel1.GetFPosition(Axis.ACSC_AXIS_1);
double position2 = channel1.GetFPosition(Axis.ACSC_AXIS_2);
double position2 = channel1.GetFPosition(Axis.ACSC_AXIS_3);

// close communication
channel1.CloseComm();
channel2.CloseComm();
channel3.CloseComm();

Version 2.70 23
SPiiPlus .NET Library Programmer's Guide
2. Using the SPiiPlus NET Library

2. Using the SPiiPlus NET Library


This chapter describes how to use the SPiiPlus NET Library and provides Examples of how to call
SPiiPlus NET methods from C#.

2.1 Redistribution

SPiiPlus NET Library is installed automatically by the SPiiPlus ADK Suite installation.

2.2 Visual Studio .NET


1. In the “Solution Explorer” window right click on Reference and select “Add
Reference…” In the Project menu click References. The dialog box opens.
2. In the dialog box click on “Browse” button and select ACS.SPiiPlusNET.dll.
3. Declare in your project:

C#:

Using ACS.SPiiPlusNET;

1. In the method that is called when your form is loaded, include:

Api channel = new Api();

1. Now you can call SPiiPlus NET Library methods. For Example,

channel.OpenCommSimulator();

Version 2.70 24
SPiiPlus .NET Library Programmer's Guide
3. Methods

3. Methods
This chapter details the methods available in the SPiiPlus NET Library. For each method there is a:
> Brief description
> Syntax in the form of: object.method_name(argument, argument, …), where object is a
placeholder for a valid object name, and each argument is of the form: type argument_
name.
> Description of the arguments and their function.
> Return Value
> Remarks
> Example - A short C# code example.
The methods are broken down into the following categories:
> Communication Methods
> EtherCAT® Methods
> Service Communication Methods
> ACSPL+ Program Management Methods
> Read and Write Variable Methods
> History Buffer Management Methods
> Unsolicited Messages Buffer Management Methods
> Log File Management Methods
> SPiiPlusSC Log File Management Methods
> Shared Memory Methods
> System Configuration Methods
> Setting and Reading Motion Parameters Methods
> Axis/Motor Management Methods
> Motion Management Methods
> Point to Point Motion Methods
> Track Motion Control Method
> Jog Methods
> Slaved Motion Methods
> Multi-Point Motion Methods
> Arbitrary Path Motion Methods
> PVT Methods
> Segmented Motion Methods
> Points and Segments Manipulation Methods

Version 2.70 25
SPiiPlus .NET Library Programmer's Guide
3. Methods

> Data Collection Methods


> Status Report Methods
> Inputs/Outputs Access Methods
> Safety Control Methods
> Wait for Condition Methods
> Event and Interrupt Handing Methods
> Variables Management Methods
> Service Methods
> Error Diagnostics Methods
> Position Event Generation (PEG) Methods
> Application Save/Load Methods
> Load/Upload Data To/From Controller Methods
> Emergency Stop Methods
> Reboot Methods
> Host-Controller File Operations
> Save to Flash Function

3.1 Communication Methods


SPiiPlus NET Communication methods are as follows:
Table 3-1. Communication Methods

Method Description

CancelOperation Cancels all operations.

Sends a command to the controller and analyzes the controller


Command
response.

CloseComm Closes communication (for all kinds of communication).

CloseSimulator Stops the Simulator in case it is running.

GetConnectionInfo Retrieves the details of opened communication channel.

Retrieves all currently opened on active server connections and


GetConnectionList
its details.

Retrieves all SPiiPlus controller IP addresses within a local


GetEthenetCards
domain.

GetPCICards Retrieves information about the installed SPiiPlus PCI cards.

Version 2.70 26
SPiiPlus .NET Library Programmer's Guide
3. Methods

Method Description

Starts up the Simulator and opens communication with the


OpenCommSimulator
Simulator.

Opens communication with the controller via Ethernet using the


OpenCommEthernetTCP
TCP protocol.

Opens communication with the controller via Ethernet using the


OpenCommEthernetUDP
UDP protocol.

OpenCommPCI Opens a communication channel with the controller via PCI Bus.

OpenCommSerial Opens communication with the controller via a serial port.

Sets the remote User-Mode Driver (UMD) with a specified IP


SetServerExtLogin
address, port number, and user login.

Terminates specified communication channel (connection) on


TerminateConnection
active server.

Executes one transaction with the controller, i.e., it sends a


Transaction
command and receives a controller response.

The Communication methods employ the following structures:

3.1.1 Structures
The Communication methods employ the following structures:

3.1.1.1 ACSC_CONNECTION_DESC
Description
This structure describes the connection information.
Syntax

struct ApplicationFileInfo
{
string Application; IntPtr handle;
UInt32 ProcessId;
}

Members

Application Application Name

handle Channel’s handle

ProcessId Application process ID

Version 2.70 27
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.1.1.2 ACSC_PCI_SLOT
Description
This structure defines a physical location of PCI card.
Syntax

struct ACSC_PCI_SLOT
{
UInt32 BusNumber;
UInt32 SlotNumber;
UInt32 Function;
}

Members

BusNumber PCI physical bus number of card

SlotNumber PCI physical slot number of card

Function PCI function of card

3.1.1.3 ACSC_CONNECTION_INFO
Description
This structure provides information about specified controller connection for an application. Used in
the GetConnectionInfo method.
Syntax

struct ACSC_CONNECTION_INFO
{
ACSC_CONNECTION_TYPE Type;
int SerialPort;
int SerialBaudRate;
int PCISlot;
int EthernetProtocol;
string EthernetIP;
int EthernetPort;
}

Members

Type Connection Type

Communication channel of serial communication: 1 corresponds to


SerialPort
COM1, 2 – to COM2, etc.

SerialBaudRate Communication rate of serial communication in bits per second

Version 2.70 28
SPiiPlus .NET Library Programmer's Guide
3. Methods

PCISlot Number of the PCI slot of the controller card.

EthernetProtocol Ethernet protocol

Contains the network address of the controller in symbolic or TCP/IP


EthernetIP
dotted form.

EthernetPort Service port.

3.1.2 Enumerations
The Communication methods employ the following enums:

3.1.2.1 ACSC_CONNECTION_TYPE
Description
This enum is used for setting communication type. Used in the GetConnectionInfo method.
Values

ACSC_NOT_CONNECTED Value 0: Not Connected

ACSC_SERIAL Value 1: Serial Communication

ACSC_PCI Value 2: PCI Communication

ACSC_ETHERNET Value 3: Ethernet Communication

ACSC_DIRECT Value 4: Direct (Simulator) Communication

3.1.3 CancelOperation
Description
This method cancels asynchronous (non-waiting) call.
Syntax
object.CancelOperation(ACSC_WAITBLOCK wait)

ACSC_WAITBLOCK object returned by invocation of asynchronous call that needed to


Wait
be canceled

Return Value
None.
Remarks
The method waits for the controller response. If the method fails, the Error object is filled with the
Error Description.
Example

Version 2.70 29
SPiiPlus .NET Library Programmer's Guide
3. Methods

// Shutdown all motors


ACSC_WAITBLOCK wait= Ch.DisableAllAsync();
// Cancel shutdown
Ch.CancelOperation(wait);

3.1.4 Command
Description
The method sends a command to the controller and analyzes the controller response.
Syntax
object.Command(string commendName)
Async Syntax
object.CommandAsync(string commandName)
Arguments

commandName The command to be sent.

Return Value
None.
Remarks
The method sends a string containing one or more ACSPL+ commands to the controller. The
method verifies that the controller receives the command but does not return the controller
response. The method is intended for commands where the controller response does not include
any information except the prompt.

For commands where the controller response includes some information, use
Transaction.

If the method fails, the Error object is filled with the Error Description.
Example

// Executed controller’s command


Ch.Command(“enable 0”);

3.1.5 CloseComm
Description
The method closes communication via the specified communication channel.
Syntax
object.CloseComm()
Arguments

Version 2.70 30
SPiiPlus .NET Library Programmer's Guide
3. Methods

None
Return Value
None.
Remarks
The method closes the communication channel and releases all system resources related to the
channel. If the method closes communication with the Simulator, it also terminates the Simulator.
Each OpenComm*** (for Example, OpenCommSerial) call in the application must be followed at
some time with a CloseComm call in order to return the resources to the system.
If the method fails, the Error object is filled with the Error Description.
Example

// Closes the communication channel


Ch.CloseComm();

3.1.6 CloseSimulator
Description
The method stops the Simulator in case it is running.
Syntax
object.CloseSimulator()
Arguments
None.
Return Value
None.
Remarks
If the method fails, the Error object is filled with the Error Description.
Example

// Closes the Simulator


Ch.CloseSimulator();

3.1.7 GetConnectionInfo
Description
The method is used to retrieve the details of opened communication channel.
Syntax
object.GetConnectionInfo();
Arguments
None
Return Value

Version 2.70 31
SPiiPlus .NET Library Programmer's Guide
3. Methods

ACSC_CONNECTION_INFO.
Example

// Get connection info


ACSC_CONNECTION_INFO connInfo = Ch.GetConnectionInfo();
string txtLog = "";
txtLog += "Serial Port: " + connInfo.SerialPort.ToString() + "\n\r";
txtLog += "IP: " + connInfo.EthernetIP.ToString() + "\n\r";
txtLog += "Ethernet Port:" + connInfo.EthernetPort.ToString() + "\n\r";
txtLog += "Ethernet Protocol: " + connInfo.EthernetProtocol.ToString() +
"\n\r";
txtLog += "PCI Slot: " + connInfo.PCISlot.ToString() + "\n\r";
txtLog += "Serial Baud Rate: " + connInfo.SerialBaudRate.ToString() +
"\n\r";
txtLog += "Serial Port: " + connInfo.SerialPort.ToString() + "\n\r";

3.1.8 GetConnectionsList
Description
This method retrieves all currently opened connections on active server and their details.
Syntax
object.GetConnectionsList()
Arguments
None
Return Value
ACSC_CONNECTION_DESC[].
The method returns connections Description array. Array length equal to number of active
connections found or zero if there are no connections on active server.
Remarks
Each connection is described by its handle, application name and process ID, therefore, all
Arguments will have the same size and order, after the method returns.
This method can be used to check if there are some unused connections that remain from
applications that did not close the communication channel or were not gracefully closed
(terminated or killed).
Each returned connection can be terminated only by the TerminateConnection method.
Using any method of the SetServer family makes previously returned connections irrelevant
because it changes the active server.
Example

// Get active connections list, find application by name and terminate


// its connection
string name = "neededApplication.exe";

Version 2.70 32
SPiiPlus .NET Library Programmer's Guide
3. Methods

ACSC_CONNECTION_DESC[] connectionList = Ch.GetConnectionsList();


for (int index = 0; index < connectionList.Length; index++)
{
if (name.Equals(connectionList[index].Application))
{
Ch.TerminateConnection(connectionList[index]);
}
}

3.1.9 GetEthernetCards
Description
The method retrieves all SPiiPlus controller IP addresses within a local domain through a standard
Ethernet communication protocol.
Syntax
object.GetEthernetCards(IPAddress broadcast)
Arguments

broadcast IP address for broadcasting. Normally has to be IPAddress.Broadcast.

Return Value
IPAddress[].
The method returns array of IP addresses of found SPiiPlus cards or empty array if no cards are
detected.
Example

// Example call GetThernetCards


IPAddress[] ipAddresses = Ch.GetEthernetCards(IPAdress.Broadcast);
for (int index = 0; index < ipAddresses.Length; index++)
{
string address = ipAddresses[index].ToString();
/*...*/
}

3.1.10 GetPCICards
Description
This method retrieves information about the controller cards inserted in the computer PCI Bus.
Syntax
object.GetPCICards()
Arguments
None
Return Value
ACSC_PCI_SLOT[].

Version 2.70 33
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method returns array of found cards.


Remarks
If no controller cards are detected, the method returns empty array, otherwise method fills the
array with information about the detected cards.
The slotNumber member of ACSC_PCI_SLOT structure can be used in the OpenCommPCI call to open
communication with a specific card. Other parameters have no use in the SPiiPlus NET Library.
If the method fails, the Error object is filled with the Error Description.
Example

// Example call GetPCICards


ACSC_PCI_SLOT[] cards = Ch.GetPCICards();
// Get info about found cards
for (int index = 0; index < cards.Length; index++)
{
var busNumber = cards[index].BusNumber;
var slotNumber = cards[index].SlotNumber;
var func = cards[index].Function;

/*...*/

3.1.11 OpenCommSimulator
Description
The method starts up the Simulator and opens communication with the Simulator.
Syntax
object.OpenCommSimulator()
Arguments
None.
Return Value
None.
Remarks
The Simulator is a part of the SPiiPlus NET Library. When the application calls OpenCommSimulator,
the library starts up the Simulator as a separate process on the same PC and opens a simulator
communication channel for communication with the simulator.
After a channel is open, any SPiiPlus NET method works with the Simulator exactly as with a physical
controller.

For the simulator to be to be found by OpenCommSimulator a copy of the simulator


executable file, sb4.exe (located in the SPiiPlus BIN folder) must be in the same folder
as the application executable file.

Version 2.70 34
SPiiPlus .NET Library Programmer's Guide
3. Methods

If the method fails, the Error object is filled with the Error Description.
Example

// Starts up the Simulator and opens communication with the Simulator


Ch.OpenCommSimulator();

3.1.12 OpenCommEthernetTCP
Description
The method opens communication with the controller via Ethernet using the TCP protocol.
Syntax
object.OpenCommEthernetTCP(string address, int port)
Arguments

String that contains the network address of the controller in symbolic or TCP/IP
address
dotted form.

port Service port.

Return Value
None.
Remarks
After a channel is open, any SPiiPlus NET method works with the channel irrespective of the
physical nature of the channel.
Use TCP protocol if the host computer is connected to the controller through the multi-node
Ethernet network.
If the method fails, the Error object is filled with the Error Description.
Example

// Open Ethernet with TCP protocol communication with the controller


// IP address: 10.0.0.100
int port = (int)EthernetCommOption.ACSC_SOCKET_STREAM_PORT;
Ch.OpenCommEthernetTCP("10.0.0.100", port);

3.1.13 OpenCommEthernetUDP
Description
The method opens communication with the controller via Ethernet using the UDP protocol.
Syntax
object.OpenCommEthernetUDP(string address, int port)
Arguements

Version 2.70 35
SPiiPlus .NET Library Programmer's Guide
3. Methods

String that contains the network address of the controller in symbolic or TCP/IP
address
dotted form.

port Service port.

Return Value
None.
Remarks
After a channel is open, any SPiiPlus NET method works with the channel irrespective of the
physical nature of the channel.
Use UDP protocol if the host computer has a point-to-point Ethernet connection tothe controller.
If the method fails, the Error object is filled with the Error Description.
Example

// Open Ethernet with UDP protocol communication with the controller


// IP address: 10.0.0.100
int port = (int) EthernetCommOption.ACSC_SOCKET_DGRAM_PORT;
Ch.OpenCommEthernetUDP("10.0.0.100", port);

3.1.14 OpenCommPCI
Description
The method opens a communication channel with the controller via PCI Bus.
Up to 4-communication channels can be open simultaneously with the same SPiiPlus card through
the PCI Bus.
Syntax
object.OpenCommPCI(int SlotNumber)
Arguments

Number of the slot of the controller card. If slotNumber is Api.ACSC_NONE,


slotNumber
the method opens communication with the first found controller card.

Return Value
None.
Remarks
To open PCI communication the host PC, one or more controller cards must be inserted into the
computer PCI Bus.
After a channel is open, any SPiiPlus NET method works with the channel irrespective of the
physical nature of the channel.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 36
SPiiPlus .NET Library Programmer's Guide
3. Methods

// Open communication with the first found controller card


Ch.OpenCommPCI(Api.ACSC_NONE);

3.1.15 OpenCommSerial
Description
The method opens communication with the controller via a serial port.
Syntax
object.OpenCommSerial(int channel, int rate)
Arguments

channel Communication channel: 1 corresponds to COM1, 2 – to COM2, etc.

Communication rate in bits per second (baud).

rate
This parameter must be equal to the controller variable IOBAUD for the
successful link with the controller.

Return Value
None.
Remarks
After a channel is open, any SPiiPlus NET method works with the channel irrespective of the
physical nature of the channel.
If the method fails, the Error object is filled with the Error Description.
Example

// Open serial communication through port COM1 with baud rate 115200
Ch.OpenCommSerial(1, 115200);

3.1.16 SetServerExtLogin
Description
The method sets the remote User-Mode Driver (UMD) with a specified IP address, port number, and
user login.
Syntax
object.SetServerExtLogin(string iP,int port, string username, string password, string domain)
Arguments

IP address of the remote UMD. This address should be the same address
iP
displayed in the remote UMD dialog.

Version 2.70 37
SPiiPlus .NET Library Programmer's Guide
3. Methods

port Remote service port

username User name on the remote host.

password Password on the remote host.

domain Domain name on the remote host.

Return Value
None.
Remarks
The method sets the remote UMD with the specified IP address, port number, and user login
information. User login information is required if the remote UMD does not run in the current
domain, or the remote computer was not previously logged in to the current domain.
Example

string ip = "10.0.0.100";
string userName = "USER";
string password = "1234";
string domain = "ACS";
Ch.SetServerExtLogin(ip, (int)GeneralDefinition.ACSC_DEFAULT_REMOTE_PORT,
userName, password, domain);
EthernetCommOption port = EthernetCommOption.ACSC_SOCKET_STREAM_PORT;

3.1.17 TerminateConnection
Description
This method terminates specified communication channel (connection) on active server.
Syntax
object.TerminateConnection(ACSC_CONNECTION_DESC connection)
Arguments

Connection description structure obtained through call to GetConnectionsList


connection
method.

Return Value
None
Remarks
This method can be used to terminate connections that remain from applications that did not close
the communication channel or were not gracefully closed (terminated or killed).
Using any method of the SetServer family makes previously returned connections list irrelevant
because it changes active server, and obligates new call of GetConnectionsList.
Example

Version 2.70 38
SPiiPlus .NET Library Programmer's Guide
3. Methods

// Get active connections list , find application by name and terminate


//its connection
string name = "neededApplication.exe";

3.1.18 Transaction
Description
The method executes one transaction with the controller, i.e., it sends a command and receives a
controller response.
Syntax
object.Transaction(string command)
Async Syntax
object.TransactionAsync(string command)
Arguments

command Command to be sent.

Return Value
String.
Remarks
The full operation of transaction includes the following steps:
1. Send Command to the controller.
2. Wait until the controller response is received or the timeout occurs.
3. Return a controller response.
4. If the method fails, the Error object is filled with the error Description.
Example

// Get controller serial number


String cmd = "?SN";
// The method executes one transaction
String reply = Ch.Transaction(cmd);

3.2 EtherCAT® Methods


The EtherCAT methods are:
Table 3-2. EtherCAT Methods

Method Description

GetEtherCATState Retrieves the EtherCAT state.

GetEtherCATError Retrieves the last EtherCAT error code.

Version 2.70 39
SPiiPlus .NET Library Programmer's Guide
3. Methods

Method Description

MapEtherCATInput Maps network input variables.

MapEtherCATOutput Maps network output variables.

UnmapEtherCATInputsOutputs Cancels mapping of input or output variables.

GetETherCATSlaveIndex Retrieves index of specified EtherCAT slave.

GetEtherCATSlaveOffset Retrieves offset of specified EtherCAT slave.

GetETHERCATSlaveVendorID Retrieves Vendor ID of specified EtherCAT slave.

GetEtherCATSlaveProductID Retrieves Product ID of specified EtherCAT slave.

GetEtherCATSlaveRevision Retrieves revision of specified EtherCAT slave.

GetEtherCATSlaveType Retrieves type of specified EtherCAT slave.

GetEtherCATSlaveState Retrieves EtherCAT state of specified EtherCAT slave.

3.2.1 GetEtherCATState
Description
The method is used to retrieve the EtherCAT state.
Syntax
object.GetEtherCATState()
Async Syntax
object.GetEtherCATStateAsync()
Arguments
None
Return Value
EtherCatFlags.
Remarks
The EtherCAT State contained in the variable designated by the State argument is defined by the
following bits:
Table 3-3. EtherCAT States

Bit Name Description

0 #SCAN The scan process was performed successfully.

1 #CONFIG There is no deviation between XML and actual setup.

Version 2.70 40
SPiiPlus .NET Library Programmer's Guide
3. Methods

Bit Name Description

2 #INITOK All bus devices are successfully set to INIT state.

3 #CONNECTED Indicates valid Ethernet cable connection to the master.

4 #INSYNC Indicates synchronization between master and the bus.

5 #OP The EtherCAT bus is operational.

6 #DCSYNC Distributed clocks are synchronized.

7 #RINGMODE Ring Topology mode status

8 #RINGCOMM Ring Communication active status

9 #EXTCONN External clock is connected

10 #DCXSYNC External clock/slaves are synchronized

All bits (except #RINGMODE and #RINGCOMM in some cases) should be ON for proper bus
functioning. When monitoring the bus state, checking bit #OP is enough. Any bus error will reset
the #OP bit.
Example

// class="Reference">Example call GetEtherCATState


EtherCatFlags state = Ch.GetEtherCatState();

3.2.2 GetEtherCATError
Description
The method is used to retrieve the last EtherCAT error code.
Syntax
object.GetEtherCATError()
Async Syntax
object.GetEtherCATErrorAsync()
Arguments
None
Return Value
Int32.
Remarks
The EtherCAT error codes are:

Version 2.70 41
SPiiPlus .NET Library Programmer's Guide
3. Methods

Table 3-4. EtherCAT Error Codes

Error Description

6000 General EtherCAT Error

6001 EtherCAT cable not connected

6002 EtherCAT master is in incorrect state

6003 Not all EtherCAT frames can be processed

6004 EtherCAT Slave Error

6005 EtherCAT initialization failure

6007 EtherCAT work count error

6008 Not all EtherCAT slaves are in the OP State

6009 EtherCAT protocol timeout

6010 Slave initialization failed

6011 Bus configuration mismatch

6012 CoE Emergency

6013 EtherCAT Slave won't enter INIT state

6014 EtherCAT ring topology requires network reconfiguration

6015 One or more EtherCAT cables are not connected

6018 EtherCAT Master won't enter PREOP state

6019 EtherCAT Master won't enter SAFEOP state

6020 EtherCAT Master won't enter OP state

Example

// Example call GetEtherCATError


int error = Ch.GetEtherCATError();

3.2.3 MapEtherCATInput
Description

Version 2.70 42
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method is used for raw mapping of network input variables of any size. Once the method 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.

The method call is legal only when the EtherCAT State is OP.

Syntax
object.MapEtherCATInput(MotionFlags flags, int offset, string variableName)
Async Syntax
object.MapEtherCATInputAsync(MotionFlags flags, int offset, string variableName)
Arguments

flags Bit-mapped parameter. Currently should be ACSC_NONE.

Internal EtherCAT offset of network input variable. Should be taken from


offset the response to the #ETHERCAT command in the SPiiPlus MMI Application
Studio Communication Terminal or can be seen via EtherCAT Configurator.

variableName Valid name of ACSPL+ variable, global or standard

Return Value
None.
Example
In the following Example, network variable of EtherCAT node 0 at offset 43 is being mapped to the
global variable: I0.

// Example synchronous call MapEtherCATInput


Ch.MapEtherCATInput(MotionFlags.ACSC_NONE, 43, "I0");

3.2.4 MapEtherCATOutput
Description
The method is used for raw mapping of network output variables of any size. Once the method is
called successfully, the firmware copies the value of specified ACSPL+ variable into the network
output variable at the corresponding EtherCAT offset, during every controller cycle.

The method call is legal only when the EtherCAT State is OP.

Syntax
object.MapEtherCATOutput(MotionFlags flags, int offset, string variableName)
Async Syntax
object.MapEtherCATOutputAsync(MotionFlags flags, int offset, string var

Version 2.70 43
SPiiPlus .NET Library Programmer's Guide
3. Methods

Arguements

flags Bit-mapped parameter. Currently should be ACSC_NONE.

Internal EtherCAT offset of network output variable. Should be taken from


offset the response to the #ETHERCAT command in the SPiiPlus MMI Application
Studio Communication Terminal or can be seen via EtherCAT Configurator.

variableName Valid name of ACSPL+ variable, global or standard

Return Value
None.
Example
In the following example, network variable of EtherCAT node 0 at offset 26 is being mapped to
global variable: I1.

// Example synchronous call MapEtherCATOutput


Ch.MapEtherCATInput(MotionFlags.ACSC_NONE, 26, "I0");

3.2.5 UnmapEtherCATInputsOutputs
Description
The method resets all previous mapping defined by MapEtherCATInput and "MapEtherCATOutput"
on the previous page methods.

The method call is legal only when the EtherCAT State is OP.

Syntax
object.UnmapEtherCATInputsOutputs()
Async Syntax
object.UnmapEtherCATInputsOutputsAsync()
Arguments
None
Return Value
None.
Example

// Example synchronous call UnmapEtherCATInputsOutputs


Ch.UnmapEtherCATInputsOutputs();

3.2.6 GetEtherCATSlaveIndex
Description

Version 2.70 44
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method retrieves the index of an EtherCAT slave according to provided parameters.
Syntax
object.GetEtherCATSlaveIndex(int vendorID, int productID, int count)
Async Syntax
object.GetEtherCATSlaveIndexAsync(int vendorID, int productID, int count)
Arguments

vendorID EtherCAT Vendor ID of the desired slave.

productID EtherCAT Product ID of the desired slave.

count Internal count of devices with the same Product and Vendor IDs.

Return Value
Double.

// Example synchronous call GetEtherCATSlaveIndex


double sIndex = Ch.GetEtherCATSlaveIndex(0x2,0x10243052,0);

3.2.7 GetEtherCATSlaveOffset
Description
The method retrieves the offset of a network variable of a specified EtherCAT slave in EtherCAT
telegram.
Syntax
object.GetEtherCATSlaveOffset(string variableName, int slaveIndex)
Async Syntax
object.GetEtherCATSlaveOffsetAsync(string variableName, int slaveIndex)
Arguments

variableName Name of the EtherCAT network variable.

Index of the required EtherCAT slave, which can be determined by using


slaveIndex
the GetEtherCATSlaveIndex method.

Return Value
Double.
Example

// Example synchronous call GetEtherCATSlaveOffset


double sOffset = Ch.GetEtherCATSlaveOffset("Output",3);

Version 2.70 45
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.2.8 GetEtherCATSlaveVendorID
Description
The method retrieves the Vendor ID of a specified EtherCAT slave.
Syntax
object.GetEtherCATSlaveVendorID(int slaveIndex)
Async Syntax
object.GetEtherCATSlaveVendorIDAsync(int slaveIndex)
Arguments

slaveIndex Index of the desired EtherCAT slave, which can be determined by using the

Return Value

// Example synchronous call GetEtherCATSlaveVendorID


double vendorID = Ch.GetEtherCATSlaveVendorID(0);

3.2.9 GetEtherCATSlaveProductID
Description
The method retrieves the Product ID of a specified EtherCAT slave.
Syntax
object.GetEtherCATSlaveProductID(int slaveIndex)
Async Syntax
object.GetEtherCATSlaveProductID(int slaveIndex)
Arguments

SlaveIndex Index of the desired EtherCAT slave, which can be determined by using the

Return Value
Double.
Example

// Example synchronous call GetEtherCATSlaveProductID


double productID = Ch.GetEtherCATSlaveProductID(0);

3.2.10 GetEtherCATSlaveRevision
Description
The method retrieves the revision of a specified EtherCAT slave.
Syntax
object.GetEtherCATSlaveRevision (int slaveIndex)
Async Syntax

Version 2.70 46
SPiiPlus .NET Library Programmer's Guide
3. Methods

object.GetEtherCATSlaveRevisionAsync (int slaveIndex)


Arguments

slaveIndex Index of the desired EtherCAT slave, which can be determined by using the

Return Value
Double.
Example

// Example synchronous call GetEtherCATSlaveRevision


double revision = Ch.GetEtherCATSlaveRevision(0);

3.2.11 GetEtherCATSlaveType
Description
The method retrieves the type of a specified EtherCAT slave.
Syntax
object.GetEtherCATSlaveType(int vendorID, int productID)
Async Syntax
object.GetEtherCATSlaveTypeAsync(int vendorID, int productID)
Arguments

vendorID Vendor ID of the EtherCAT slave.

productID Product ID of the EtherCAT slave.

Return Value
Double.
The type of specified EtherCAT slave. The value can be one of the following:
> 0 – ACS device
> 1 – Non-ACS Servo
> 2 – Non-ACS Stepper
> 3 – Non-ACS I/O
> -1 – Device not found at slave index
Example

// Example synchronous call GetEtherCATSlaveType


double type = Ch.GetEtherCATSlaveType(0x2,0x044c2c52);

3.2.12 GetEtherCATSlaveState
Description
The method retrieves the EtherCAT state of a specified EtherCAT slave.

Version 2.70 47
SPiiPlus .NET Library Programmer's Guide
3. Methods

Syntax
object.GetEtherCATSlaveState (int slaveIndex)
Async Syntax
object.GetEtherCATSlaveProductID(int slaveIndex)
Arguments

SlaveIndex Index of the desired EtherCAT slave, which can be determined by using the

Return Value
Double.
Returns the state of specified EtherCAT slave. The value can be one of the following:
> 1 – INIT
> 2 – PREOP
> 4 – SAFEOP
> 8 – OP
> -1 – Device not found at slave index
Example

// Example synchronous call GetEtherCATSlaveState


double state = Ch.GetEtherCATSlaveState(0);

Version 2.70 48
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.3 Service Communication Methods


The Service Communication methods are:
Table 3-5. Service Communication Methods

Method Description

GetACSHandle Retrieves the SPiiPlus C Library communication handle

GetNETLibraryVersion Retrieves the SPiiPlus NET Library version number.

GetCommOptions Retrieves the communication options.

GetDefaultTimeout Retrieves default communication timeout.

GetErrorString Retrieves the explanation of an error code.

GetLibraryVersion Retrieves the legacy SPiiPlus C Library version number.

GetTimeout Retrieves communication timeout.

SetIterations Sets the number of iterations of one transaction.

SetCommOpions Sets the communication options.

SetTimeout Sets communication timeout.

3.3.1 GetACSCHandle
Description
The method retrieves the SPiiPlus C Library communication handle.
Syntax
object.GetACSCHandle()Arguments
None.
Return Value
IntPtr
Remarks
The method retrieves the SPiiPlus C Library communication handle. If the method fails, the Error
object is filled with the Error Description.
Example

// Retrieves communication handle


IntPtr handle = Ch.GetACSCHandle();

3.3.2 GetNETLibraryVersion
Description

Version 2.70 49
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method retrieves the SPiiPlus NET Library version number.


Syntax
object.GetNETLibraryVersion()
Arguments
None.
Return Value
UInt32.
The method retrieves the SPiiPlus NET Library version number.
Remarks
The SPiiPlus NET Library version consists of four (or less) numbers separated by points:
#.#.#.#. The binary version number is represented by 32-bit unsigned integer value. Each byte of
this value specifies one number in the following order: high byte of high word – first number, low
byte of high word – second number, high byte of low word – third number and low byte of low
word – forth number. For example the version “2.10” has the following binary representation
(hexadecimal format): 0x020A0000.
The first two numbers in the string form are obligatory. Any release version of the library consists
of two numbers. The third and fourth numbers specify an alpha or beta version, special or private
build, etc.
If the method fails, the Error object is filled with the Error Description.
Example

// Retrieves the SPiiPlus .NET Library


uint version = Ch.GetNETLibraryVersion();

3.3.3 GetCommOptions
Description
The method retrieves the communication options.
Syntax
object.GetCommOptions()
None.
Return Value
CommOptions.
The method retrieves the current communication options.
Remarks
To set the communication options call SetCommOptions.
The Return Value is bit-mapped to represent the current communication options. Currently only
the following option flag is supported:

Version 2.70 50
SPiiPlus .NET Library Programmer's Guide
3. Methods

ACSC_COMM_USE_CHECKSUM - communication mode when each command sends to the controller


with checksum and the controller responds with checksum.
If the method fails, the Error object is filled with the Error Description.
Example

// Retrieves the current communication options


CommOptions options = Ch.GetCommOptions();

3.3.4 GetDefaultTimeout
Description
The method retrieves default communication timeout.
Syntax
object.GetDefaultTimeout()
Arguments
None.
Return Value
Int32.
Remarks
The value of the default timeout depends on the type of the established communication channel.
Timeout depends also on the baud rate value for serial communication.
If the method fails, the Error object is filled with the Error Description.
Example

// Retrieves default communication timeout


int timeout = Ch.GetDefaultTimeout();

3.3.5 GetErrorString
Description
The method retrieves the explanation of an error code.
Syntax
object.GetErrorString(ErrorCodes
Arguments

An error code returned by the following methods:


ErrorCode
GetMotorError GetMotionError GetProgramError

Return Value
String.

Version 2.70 51
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method retrieves the string that contains the text explanation of the error code returned by
the GetMotorError, GetMotionError, and GetProgramError methods.
Remarks
If the error relates to SPiiPlus NET Library, the method returns immediately with the text
explanation. If the error relates to the controller, the method receives the text explanation from
the controller.
If the method fails, the Error object is filled with the Error Description.
Example

// The method retrieves the explanation of an error code 3260.


string s = Ch.GetErrorString(3260);

3.3.6 GetLibraryVersion
Description
The method retrieves the SPiiPlus C Library version number.
Syntax
object.GetLibraryVersion()
Arguments
None.
Return Value
Uint32.
The method retrieves the legacy SPiiPlus C Library version number.
Remarks
The SPiiPlus C Library version consists of four (or less) numbers separated by points: #.#.#.#. The
binary version number is represented by 32-bit unsigned integer value. Each byte of this value
specifies one number in the following order: high byte of high word – first number, low byte of
high word – second number, high byte of low word – third number and low byte of low word –
forth number. For example the version “2.10” has the following binary representation (hexadecimal
format): 0x020A0000.
The first two numbers in the string form are obligatory. Any release version of the library consists
of two numbers. The third and fourth numbers specify an alpha or beta version, special or private
build, etc.
If the method fails, the Error object is filled with the Error Description.
Example

// Retrieves the SPiiPlus C Library version number


uint libVersion = Ch.GetLibraryVersion();

3.3.7 GetTimeout
Description

Version 2.70 52
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method retrieves communication timeout.


Syntax
object.GetTimeout()
Arguments
None.
Return Value
Int32.
The method retrieves communication timeout.
Remarks
If the method succeeds, the return value is the current timeout value in milliseconds. If the method
fails, the Error object is filled with the Error Description.
Example

// Retrieves communication timeout


int timeout = Ch.GetTimeout();

3.3.8 SetIterations
Description
The method sets the number of iterations in one transaction.
Syntax
object.SetIterations(int iterations)
Arguments

iterations Number of iterations

Return Value
None.
Remarks
If, after the transmission of command to the controller, the controller response is not received
during the predefined time, the library repeats the command transmission. The number of those
iterations is defined by iterations parameter for each communication channel independently.
Most of the SPiiPlus NET methods perform communication with the controller by transactions (i.e.
they send commands and wait for responses) that are based on the Transaction method.
Therefore, the changing of the number of iterations can have an influence on the behavior of the
user application.
The default number of iterations for all communication channels is 2. If the method fails, the Error
object is filled with the Error Description.
Example

Version 2.70 53
SPiiPlus .NET Library Programmer's Guide
3. Methods

// Sets the number of iterations in one transaction


// number of iterations for all communication channels is 2
Ch.SetIterations(2);

3.3.9 SetCommOptions
Description
The method sets the communication options.
Syntax
object.SetCommOptions(CommOptions options)
Arguments

Communication options to be set. Bit-mapped parameter that can include one of


the following flags:
> ACSC_COMM_USE_CHECKSUM: the communication mode used when each
Command is sent to the controller with checksum and the controller also
options
responds with checksum.
> ACSC_COMM_AUTORECOVER_HW_ERROR: when a hardware error is
detected in the communication channel and this bit is set, the library
automatically repeats the transaction, without counting iterations.

Return Value
None.
Remarks
The method sets the communication options. To get current communication option, call
GetCommOptions.
To add some communication options to the current configuration, modify options that have been
filled in by a call to GetCommOptions. This ensures that the other communication options will have
same values.
If the method fails, the Error object is filled with the Error Description.
Example

// Example sets the mode with checksum


CommOptions options= Ch.GetCommOptions();
Ch.SetCommOptions( options | CommOptions.ACSC_COMM_USE_CHECKSUM );

3.3.10 SetTimeout
Description
The method sets the communication timeout.
Syntax
object.SetTimeout(int timeout)
Arguments

Version 2.70 54
SPiiPlus .NET Library Programmer's Guide
3. Methods

timeout Maximum waiting time in milliseconds.

Return Value
None.
Remarks
The method sets the communication timeout.
All of the subsequent waiting calls of the methods will wait for the controller response timeout in
milliseconds. If the controller does not respond to the sent command during this time, SPiiPlus NET
methods will throw ACSException with the error code assigned to ACSC_TIMEOUT.
If the method fails, the Error object is filled with the Error Description.
Example

// Sets the communication timeout of 2 seconds


Ch.SetTimeout(2000);

3.4 ACSPL+ Program Management Methods


The ACSPL+ Program Management methods are:
Table 3-6. ACSPL+ Program Management Methods

Method Description

Appends one or more ACSPL+ lines to the program in the specified


AppendBuffer
program buffer.

Deletes the specified ACSPL+ program lines in the specified


ClearBuffer
program buffer.

CompileBuffer Compiles ACSPL+ program in the specified program buffer(s).

Clears the specified program buffer and then loads ACSPL+ program
LoadBuffer
to this buffer.

Opens a file that contains one or more ACSPL+ programs allocated


LoadBuffersFromFile to several buffers and download the programs to the
corresponding buffers.

RunBuffer Starts up ACSPL+ program in the specified program buffer.

StopBuffer Stops ACSPL+ program in the specified program buffer(s).

SuspendBuffer Suspends ACSPL+ program in the specified program buffer(s).

UploadBuffer Uploads ACSPL+ program from the specified program buffer.

Version 2.70 55
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.4.1 AppendBuffer
Description
The method appends one or more ACSPL+ lines to the program in the specified buffer.
Syntax
object.AppendBuffer(ProgramBuffer buffer, string text)
Async Syntax
object.AppendBufferAsync(ProgramBuffer buffer, string text)
Arguments

Buffer Number of a program buffer in the controller.

text String containing an ACSPL+ program(s).

Return Value
None.
Remarks
The method appends one or more ACSPL+ lines to the program in the specified buffer. If the buffer
already contains any program, the new text is appended to the end of the existing program.
No compilation or syntax check is provided during downloading. In fact, any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy, the
compile command must be executed after downloading.
If the method fails, the Error object is filled with the Error Description.
Example

string program = "enable x; jog x; stop\n";


// The method appends one ACSPL+ line to buffer 0
Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_0, program);

3.4.2 ClearBuffer
Description
Deletes the specified ACSPL+ program lines in the specified program buffer.
Syntax
object.ClearBuffer(ProgramBuffer buffer, int fromLine, int toLine)
Async Syntax
object.ClearBufferAsync(ProgramBuffer buffer, int fromLine, int toLine)
Arguments

buffer Buffer number, from 0 to 9.

FromLine, These Arguments specify a range of lines to be deleted.

Version 2.70 56
SPiiPlus .NET Library Programmer's Guide
3. Methods

fromLine starts from 1.


ToLine If toLine is larger then the total number of lines in the specified program
buffer, the range includes the last program line.

Return Value
None.
Remarks
The method deletes the specified ACSPL+ program lines in the specified program buffer. If the
method fails, the Error object is filled with the Error Description.
Example

string program = "enable x; jog x; stop\n";


// The method appends one ACSPL+ line to buffer 0
Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_0, program);
// Get program of buffer 0
string buf = Ch.UploadBuffer(ProgramBuffer.ACSC_BUFFER_0);
// Delete buffer 0 from line 1 to 1000
Ch.ClearBuffer(ProgramBuffer.ACSC_BUFFER_0, 1, 1000);
// Get program of buffer 0
buf = Ch.UploadBuffer(ProgramBuffer.ACSC_BUFFER_0);

3.4.3 CompileBuffer
Description
The method compiles the ACSPL+ program in the specified program buffer(s).
Syntax
object.CompileBuffer(ProgramBufferbuffer)
Async Syntax
object.CompileBufferAsync(ProgramBufferbuffer)
Arguments

Buffer number, from 0 to 9.


buffer You can use ACSC_NONE instead of the buffer number to compile all programs in
all buffers.

Return Value
None.
Remarks
The method compiles an ACSPL+ program in the specified program buffer or all programs in all
buffers if buffer is ACSC_NONE.

Version 2.70 57
SPiiPlus .NET Library Programmer's Guide
3. Methods

If attempting to compile the D-Buffer, all other buffers will be stopped and put in a
non-compiled state.

The method succeeds if the compile command was transmitted successfully to the controller, i.e.,
the communication channel is OK and the specified buffer was not running. However, this does not
mean that the compile operation was completed successfully.
In order to get information about the results of the compile operation, use ReadVariable to read
PERR, which contains the most recent error that occurred in each buffer. If PERR is zero. the buffer
was compiled successfully.
Otherwise, PERR contains the error that occurred during the compilation. The method waits for the
controller response. If the method fails, the Error object is filled with the Error Description.
Example

string program = "!Compiled buffer; stop\n";


// Appends line to buffer 0
Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_0, program);
// The method compiles ACSPL+ program in buffer 0
Ch.CompileBuffer(ProgramBuffer.ACSC_BUFFER_0);

3.4.4 LoadBuffer
Description
The method clears the specified program buffer and then loads ACSPL+ program to this buffer.
Syntax
object.LoadBuffer(ProgramBuffer buffer, string text)
Async Syntax
object.LoadBufferAsync(ProgramBuffer buffer, string text)
Arguments

buffer Number of a program buffer in the controller.

text String containing an ACSPL+ program(s).

Return Value
None.
Remarks
The method clears the specified program buffer and then loads ACSPL+ program to this buffer.
No compilation or Syntax check is provided during downloading. Any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy, the
compile command must be executed after downloading.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 58
SPiiPlus .NET Library Programmer's Guide
3. Methods

string program = "!This is a test ACSPL + program; Stop\n";


// Load a line to buffer 0
Ch.LoadBuffer(ProgramBuffer.ACSC_BUFFER_0, program);

3.4.5 LoadBuffersFromFile
Description
The method opens a file that contains one or more ACSPL+ programs allocated to several buffers
and download the programs to the corresponding buffers.
Syntax
object.LoadBuffersFromFile(string filename)
Async Syntax
object.LoadBuffersFromFileAsync(string filename)
Arguments

filename Name and path of the file to be loaded.

Return Value
None.
Remarks
The method analyzes the file, determines which program buffers should be loaded, clears them
and then loads ACSPL+ programs to those buffers.

The method can be called only synchronously.

SPiiPlus software tools save ACSPL+ programs in the following format:

# Header: Date, Firmware version, etc.


#Buf1 (buffer number) ACSPL+ program of Buf1
#Buf2 (buffer number) ACSPL+ program of Buf2
#Buf3 (buffer number) ACSPL+ program of Buf3 etc.

The number of buffers in file may change from 1 to 10, without any default order.
No compilation or Syntax check is provided during downloading. Any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy, the
compile command must be executed after downloading.
If the method fails, the Error object is filled with the Error Description.
Example

String file = "C:\\ACSPLFile.txt";


// Opens a file to load
Ch.LoadBuffersFromFile(file);

Version 2.70 59
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.4.6 RunBuffer
Description
The method starts up ACSPL+ program in the specified buffer.
Syntax
object.RunBuffer(ProgramBuffer buffer, [string label])
Async Syntax
object.RunBufferAsync(ProgramBuffer buffer, [string label])
Arguments

buffer Number of a program buffer in the controller.

Label in the program from which the execution starts.

Label
If NULL (“” - the default) is specified instead of a pointer, the execution starts from
the first line.

Return Value
None.
Remarks
The method starts up ACSPL+ program in the specified buffer. The execution starts from the
specified label, or from the first line if the label is not specified.
If the program was not compiled before, the method first compiles the program and then starts it.
If an error was encountered during compilation, the program does not start.
If the program was suspended by the SuspendBuffer method, the method resumes the program
execution from the point where the program was suspended.
The method waits for the controller response.
The controller response indicates that the program in the specified buffer was started successfully.
The method does not wait for the program end. To wait for the program end, use the
WaitProgramEnd method.
If the method fails, the Error object is filled with the Error Description.
Example

// Appends and runs buffers 0 to 8


for (int index = 0 ; index < 8 ; index++)
{
Ch.AppendBuffer((ProgramBuffer)index,”ST:”);
Ch.AppendBuffer((ProgramBuffer)index,”!an empty loop”);
Ch.AppendBuffer((ProgramBuffer)index,”goto ST”);
Ch.RunBuffer((ProgramBuffer)index,null);
}

Version 2.70 60
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.4.7 StopBuffer
Description
The method stops the execution of ACSPL+ program in the specified buffer(s).
Syntax
object.StopBuffer(ProgramBuffer buffer)
Async Syntax
object.StopBufferAsync(ProgramBuffer buffer)
Arguments

Buffer number.
buffer
To stop the execution of all buffers, use ACSC_NONE instead of the buffer number.

Return Value
None.
Remarks
The method stops ACSPL+ program execution in the specified buffer or in all buffers if Buffer is
ACSC_NONE.
The method has no effect if the program in the specified buffer is not running. If the method fails,
the Error object is filled with the Error Description.
Example

// Appends and runs buffers 0 to 8


for (int index = 0; index < 8; index++)
{
// Append line to buffer
Ch.AppendBuffer((ProgramBuffer)index, "ST:; !Empty buffer");
// Append line to buffer
Ch.AppendBuffer((ProgramBuffer)index, "goto ST;");
// Append line to buffer
Ch.AppendBuffer((ProgramBuffer)index, "stop");
// Run buffer
Ch.RunBuffer((ProgramBuffer)index, null);
// Stop running
Ch.StopBuffer((ProgramBuffer)index);

3.4.8 SuspendBuffer
Description
The method suspends the execution of ACSPL+ program in the specified program buffer(s).
Syntax
object.SuspendBuffer(ProgramBuffer buffer)
Async Syntax

Version 2.70 61
SPiiPlus .NET Library Programmer's Guide
3. Methods

object.SuspendBufferAsync(ProgramBuffer buffer)
Arguments

Buffer number.
buffer To suspend the execution of all buffers, use ACSC_NONE instead of the buffer
number.

Return Value
None.
Remarks
The method suspends ACSPL+ program execution in the specified buffer or in all buffers if buffer is
ACSC_NONE. The method has no effect if the program in the specified buffer is not running.
To resume execution of the program in the specified buffer, call the RunBuffer method. If the
method fails, the Error object is filled with the Error Description.
Example

// Appends and runs buffers 0 to 8


for (int index = 0 ; index < 8 ; index++)
{
Ch.AppendBuffer((ProgramBuffer)index,”ST:”);
Ch.AppendBuffer((ProgramBuffer)index,”!an empty loop”);
Ch.AppendBuffer((ProgramBuffer)index,”goto ST”);
Ch.RunBuffer((ProgramBuffer)index,null);
}
// Suspend all buffers
Ch.SuspendBuffer(ProgramBuffer.ACSC_NONE);

3.4.9 UploadBuffer
Description
The method uploads ACSPL+ program from the specified program buffer.
Syntax
object.UploadBuffer(ProgramBuffer buffer)
Arguments

Buffer Number of a program buffer in the controller.

Return Value
String.
Remarks
The method uploads ACSPL+ program from the specified program buffer. If the method fails, the
Error object is filled with the Error Description.
Example

Version 2.70 62
SPiiPlus .NET Library Programmer's Guide
3. Methods

String program = "!This is an empty buffer\n";


// Appendsprogram to buffer 0
Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_0, program);
// Get program of buffer 0
String buf = Ch.UploadBuffer(ProgramBuffer.ACSC_BUFFER_0);

3.5 Read and Write Variables Methods


The Read and Write Variable methods are:
Table 3-7. Read and Write Variables Methods

Method Description

ReadVariable Reads variable from a controller and returns it in the form of object

ReadVariableAsScalar Reads variable from a controller and returns it as scalar object

Reads variable from a controller and returns it in the form object


ReadVariableAsVector
that contains one-dimension array

Reads variable from a controller and returns it in the form object


ReadVariableAsMatrix
that contains two-dimensions array

WriteVariable Writes to controller variable(s)

3.5.1 ReadVariable
Description
The method reads a variable from the controller.
Syntax
object.ReadVariable(string variable, [ProgramBuffer nBuf], [int from1], [int to1], [int from2], [int to2])
Async Syntax
object.ReadVariableAsync(string variable, [ProgramBuffer nBuf], [int from1], [int to1], [int from2], [int
to2])
Arguments

variable Name of the controller variable

Number of program buffer for local variable or


nBuf
ProgramBuffer.ACSC_NONE for global and ACSPL+ variables.

Index range (first dimension) starting from zero. Default value:


from1, to1
Api.ACSC_NONE.

from2, to2 Index range (second dimension) starting from zero. Default value:

Version 2.70 63
SPiiPlus .NET Library Programmer's Guide
3. Methods

Api.ACSC_NONE.

Return Value
Object.
The type of return value is real or integer, depending on the type of controller variable.
The return value can be scalar, vector (one-dimensional array) or matrix (two-dimensional array)
depending on data that the controller retrieves.
Remarks
The method reads scalar variables, vectors, rows of matrix, and columns of matrix or matrices from
a controller and retrieves data as object. The resultant data are initialized depending on what data
is received from the controller: scalar, vector or matrix.
If you want the return value to be in some specified type, use ReadVariableAsScalar,
ReadVariableAsVector or ReadVariableAsMatrix methods.
The variable can be an ACSPL+ controller variable, a user global variable, or a user local variable.
ACSPL+ and user global variables have global scope; therefore nBuf must be omitted or specified
as ProgramBuffer.ACSC_NONE (-1) for these classes of variables.
User local variable exists only within a buffer. The buffer number must be specified for user local
variable.
The index parameters can be specified as follows:
> To read the whole variable
> To read one element of the variable
> To read several elements of the variable
The following explains how to specify indexes in several typical cases.
1. Reading whole variable

The from1, to1, from2 and to2 indexes should be omitted or specified as Api.ACSC_NONE.
The method returns all elements of Variable as object initialized as:
> Scalar, if the Variable is scalar
> Vector, if the Variable is a one-dimensional array
> Matrix, if the Variable is a two-dimensional array
2. Reading one element from vector (one-dimensional array)
The from1 and to1 should be equal and specify the index of the element. from2 and to2
should be omitted or specified as Api.ACSC_NONE. The method returns the element value
as object, initialized as scalar.
3. Reading one element from matrix (two-dimensional array)
from1 should equal to1 and specify row number. The from2 and to2 should be equal and
specify column number. The method returns the element value as object, initialized as
scalar method
4. Reading a sub-vector (more than one vector element)

Version 2.70 64
SPiiPlus .NET Library Programmer's Guide
3. Methods

from1 and to1 should specify the sub-vector index range, where from1 should be less than
to1. from2 and to2 should be omitted or specified as Api.ACSC_NONE. The method returns
data as object, initialized as a vector with the number of elements equal to to1– from1 +1.
5. Reading a row or part of a row from a matrix
from1 should equal to1and specify the row number. The from2 and to2 should specify the
element range within the specified row, where from2 should be less than to2. The method
returns data as object, initialized as a vector with the number of elements equal to2 –
from2 +1.
6. Reading a column or part of a column from a matrix
from1 and to1 should specify the range of rows within the specified column, where from1
should be less than to1. from2 and to2 should be equal and specify the column number.
The method returns data as object, initialized as a vector with the number of elements
equal to to1–from1+1.
7. Reading sub-matrix from matrix
from1 and to1 should specify the range of rows, where from1 should be less then to1.
from2 and to2 should specify columns range, where from2 should be less than to2. The
method returns data as object, initialized as a matrix with the number of rows equal to
to1– from1 +1 and the number of columns equal to to2 – from2 +1.
If the method fails, the Error object is filled with the Error Description.
Example

// Read variable
object var;
//Reading whole variable, if the variable is scalar:
//Parameters: "BAUD" - controller variable name
//(optional:)ProgramBuffer.ACSC_NONE - ACSPL+ variable
var = Ch.ReadVariable("BAUD");
//or:
var = Ch.ReadVariable("BAUD", ProgramBuffer.ACSC_NONE);
//Now var is a scalar value
//Reading whole variable, if the variable is
//one-dimensional array:
//Parameters: "VEL" - controller variable name
//(optional:)ProgramBuffer.ACSC_NONE - ACSPL+ variable
var = Ch.ReadVariable("VEL");
//or:
var = Ch.ReadVariable("VEL", ProgramBuffer.ACSC_NONE);
//Now var is a vector of size 8
//Reading whole variable, if the variable is
//two-dimensional array:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: "MyMatrix” – user variable name
//(optional:)ProgramBuffer.ACSC_NONE - global variable
var = Ch.ReadVariable("MyMatrix");

Version 2.70 65
SPiiPlus .NET Library Programmer's Guide
3. Methods

//or:
var = Ch.ReadVariable("MyMatrix", ProgramBuffer.ACSC_NONE);
//Now var is a matrix of size 3x4
//Reading one element from vector (one-dimensional array):
//Reading one element with index 3:
//Parameters: "VEL" - controller variable name
//ProgramBuffer.ACSC_NONE - ACSPL+ variable
//elementIndex - from1, to1
int elementIndex = 3;
var = Ch.ReadVariable("VEL", ProgramBuffer.ACSC_NONE,
elementIndex, elementIndex);
//Now var is a scalar value
//Reading one element from matrix (two-dimensional array):
//Reading one element of matrix from row 1, column 2:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: "MyMatrix” – user variable name

//ProgramBuffer.ACSC_NONE - global variable


//elementRow - from1, to1
//elementColumn – from2, to2
int elementRow = 1;
int elementColumn = 2;
var = Ch.ReadVariable("MyMatrix", ProgramBuffer.ACSC_NONE,
elementRow, elementRow, elementColumn, elementColumn);
//Now var is a scalar value
//Reading sub-vector (more then one element) from vector:
//Reading sub-vector with indexes from 1 to 5:
//Parameters: "VEL" - controller variable name
//ProgramBuffer.ACSC_NONE - ACSPL+ variable
//fromIndex - from1
//toIndex – to1
int fromIndex = 1;
int toIndex = 5;
var = Ch.ReadVariable("VEL", ProgramBuffer.ACSC_NONE,
fromIndex, toIndex);
//Now var is a vector of size 5
//Reading row or part of row from matrix:
//Reading a part of row 1 from element with
//index 0 till element with index 2:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4)
//in the controller:
//Parameters: "MyMatrix" - user variable name
//ProgramBuffer.ACSC_NONE - global variable
//rowIndex - from1, to1
//fromColumnIndex – from2
//toColumnIndex – to2
int rowIndex = 1;

Version 2.70 66
SPiiPlus .NET Library Programmer's Guide
3. Methods

int fromColumnIndex = 0;
int toColumnIndex = 2;
var = Ch.ReadVariable("MyMatrix", ProgramBuffer.ACSC_NONE,
rowIndex, rowIndex, fromColumnIndex, toColumnIndex);
//Now var is a vector of size 3
//Reading column or part of column from matrix:
//Reading a part of column 1 from element with index 0 till
//element with index 1:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: "MyMatrix" - user variable name
//ProgramBuffer.ACSC_NONE - global variable
//fromRowIndex - from1
//toRowIndex – to1
//columnIndex – from2, to2
int fromRowIndex = 0;
int toRowIndex = 1;
int columnIndex = 1;
var = Ch.ReadVariable("MyMatrix", ProgramBuffer.ACSC_NONE,
fromRowIndex, toRowIndex, columnIndex, columnIndex);
//Now var is a vector of size 2
//Reading sub-matrix from matrix:
//Reading sub-matrix with rows from 0 to 1 and colomns from
//0 to 2:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: "MyMatrix" - user variable name
//ProgramBuffer.ACSC_NONE - global variable
//fromRowIndex - from1
//toRowIndex – to1
//fromColumnIndex – from2
//toColumnIndex – to2
fromRowIndex = 0;
toRowIndex = 1;
fromColumnIndex = 0;
toColumnIndex = 2;
var = Ch.ReadVariable("MyMatrix", ProgramBuffer.ACSC_NONE,
fromRowIndex, toRowIndex, fromColumnIndex,
toColumnIndex);
//Now var is a matrix 2x3

3.5.2 ReadVariableAsScalar
Description
The method reads the variable from a controller and returns as a scalar.
Syntax
object.ReadVariableAsScalar (string variable, ProgramBuffer nBuf, [int ind1], [int ind2])

Version 2.70 67
SPiiPlus .NET Library Programmer's Guide
3. Methods

Async Syntax
object.ReadVariableAsScalarAsync(string variable, ProgramBuffer nBuf, [int ind1], [int ind2])
Arguments

variable Name of the controller variable

Number of program buffer for local variable or


nBuf
ProgramBuffer.ACSC_NONE for user global and ACSPL+ variables.

Index of first dimension (row number) starting from zero. Default value:
ind1
Api.ACSC_NONE.

Index of second dimension (column number) starting from zero. Default value:
ind2
Api.ACSC_NONE.

Return Value
Object.
The return value is scalar, that is, the type of Return Value is real or integer, corresponding to the
type of controller variable.
Remarks
Reads a scalar variable, one element of a vector or one element of a matrix from a controller and
returns the value as scalar.
If you require a method Return Value as one vector element, use the ReadVariableAsVector
method. If you require a method Return Value as one matrix element, use the
ReadVariableAsMatrix method.
The variable can be an ACSPL+ variable, a user-defined global variable, or a user-defined local
variable.
ACSPL+ and user global variables have global scope; therefore nBuf must be ProgramBuffer.ACSC_
NONE (–1) for these classes of variables.
User-defined local variables exist only within a buffer. The buffer number must be specified for
user-defined local variables.
The following explains how to read indexes in several typical cases.
1. Reading a scalar variable:
The ind1 and ind2 indexes should be omitted or specified as Api.ACSC_NONE.
2. Reading one element from a vector (one-dimensional array):
ind1 should specify index of the element in the vector. ind2 should be omitted or specified
as Api.ACSC_NONE.
3. Reading one element from a matrix (two-dimensional array):
ind1 should specify a row number and ind2 should specify a column number of the
element in the matrix.

Version 2.70 68
SPiiPlus .NET Library Programmer's Guide
3. Methods

If the method fails, the Error object is filled with the Error Description.
Example

// Read variable as scalar


//var in the next examples is returned as scalar object var;
//Reading scalar variable:
//Parameters: "BAUD" - controller variable name
//ProgramBuffer.ACSC_NONE - ACSPL+ variable
object var;
var = Ch.ReadVariableAsScalar("BAUD",
ProgramBuffer.ACSC_NONE);
//Reading one element from vector (one-dimensional array):
//Reading one element with index 2:
//Parameters: "VEL" - controller variable name
//ProgramBuffer.ACSC_NONE - ACSPL+ variable
//index – ind1
int index = 2;
var = Ch.ReadVariableAsScalar("VEL",
ProgramBuffer.ACSC_NONE, index);
//Reading one element from matrix (two-dimensional array):
//Reading one element of matrix from row 1, column 2:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4)
//in the controller:
//Parameters: "MyMatrix” – user variable name
//ProgramBuffer.ACSC_NONE - global variable
//rowIndex – ind1
//columnIndex – ind2
int rowIndex = 1;
int columnIndex = 2;
var = Ch.ReadVariableAsScalar("MyMatrix",
ProgramBuffer.ACSC_NONE, rowIndex, columnIndex);

3.5.3 ReadVariableAsVector
Description
The method reads a variable from a controller and returns it as vector.
Syntax
object.ReadVariableAsVector(string variable, [ProgramBuffer nBuf], [int from1], [int to1], [int from2],
[int to2])
Async Syntax
object.ReadVariableAsVectorAsync(string variable, [ProgramBuffer nBuf], [int from1], [int to1], [int
from2], [int to2])
Arguments

variable Name of the controller variable

Version 2.70 69
SPiiPlus .NET Library Programmer's Guide
3. Methods

Number of program buffer for local variable or


nBuf
ProgramBuffer.ACSC_NONE for global and ACSPL+ variables.

Index range (first dimension) starting from zero. Default value:


from1, to1
Api.ACSC_NONE.

Index range (second dimension) starting from zero. Default value:


from2, to2
Api.ACSC_NONE.

Return Value
Object.
The return value is a one-dimensional array (vector). The type of return value is real or integer,
corresponding to the type of controller variable.
Remarks
If you want a return value as scalar or matrix use ReadVariableAsScalar or ReadVariableAsMatrix
methods correspondingly.
The variable can be an ACSPL+ variable, a user global variable, or a user local variable. ACSPL+ and
user global variables have global scope; therefore nBuf must be omitted or specified as
ProgramBuffer.ACSC_NONE (–1) for these classes of variables.
User local variables exist only within a buffer. The buffer number must be specified for user local
variable.
The index parameters can be specified in many different ways to read whole variable, one element
of the variable or several elements of the variable. The following explains how to specify indexes in
several typical cases.
1. Reading whole variable:
The from1, to1, from2 and to2 indexes should be omitted or specified as Api.ACSC_NONE.
The method returns all elements of variable as object initialized as: Vector of size 1, if the
variable is scalar
Vector of size N, if the variable is vector of size N
If the variable is matrix, the method will return an error.
2. Reading sub-vector from vector:
The from1 and to1 should specify sub-vector index range, from1 should be less than or
equal to to1. The from2 and to2 should be omitted or specified as Api.ACSC_NONE. The
methods returns data as vector with number of elements equals to to1- from1 +1.
3. Reading a row or part of a row from matrix:
The from1 and to1 should be equal and specify row number. The from2 and to2 should
specify elements range within the specified row, from2 should be less than or equal to to2.
The methods returns data as vector with number of elements equals to to2 - from2 +1.
4. Reading a column or part of a column from matrix:

Version 2.70 70
SPiiPlus .NET Library Programmer's Guide
3. Methods

The from1 and to1 should specify rows range within the specified column, from1 should be
less than or equal to to1. The from2 and to2 should be equal and specify column number.
The methods returns data as vector with number of elements equals to to1- from1 +1.
If the method fails, the Error object is filled with the Error Description.
Example

// Read variable as vector


object var;
//var in the next Examples is returned as vector object var;
//Reading whole variable, if the variable is scalar:
//Parameters: "BAUD" - controller variable name
//(optional:)ProgramBuffer.ACSC_NONE - ACSPL+ variable
var = Ch.ReadVariableAsVector("BAUD");
//or:
var = Ch.ReadVariableAsVector("BAUD",
ProgramBuffer.ACSC_NONE);
//now var is a vector of size 1
//Reading whole variable, if the variable is one-dimensional
//array:
//Parameters: "VEL" - controller variable name
//(optional:)ProgramBuffer.ACSC_NONE - ACSPL+ variable
var = Ch.ReadVariableAsVector("VEL");
//or:
var = Ch.ReadVariableAsVector("VEL",
ProgramBuffer.ACSC_NONE);
//now var is a vector of size 8
//Reading sub-vector from vector:
//Reading sub-vector with indexes from 1 to 5:
//Parameters: "VEL" - controller variable nam
//ProgramBuffer.ACSC_NONE - ACSPL+ variable
//fromIndex – from1
//toIndex – to1
int fromIndex = 1;
int toIndex = 5;
var = Ch.ReadVariableAsVector("VEL",
ProgramBuffer.ACSC_NONE, fromIndex, toIndex);
//now var is a vector of size 5
//Reading row or part of row from matrix:
//Reading a part of row 1 from element with index 0 till
//element with index 2
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: "MyMatrix” – user variable name
//ProgramBuffer.ACSC_NONE - global variable
//rowIndex – from1, to1
//fromColumnIndex – from2
//toColumnIndex – to2
int rowIndex = 1;
int fromColumnIndex = 0;

Version 2.70 71
SPiiPlus .NET Library Programmer's Guide
3. Methods

int toColumnIndex = 2;
var = Ch.ReadVariableAsVector("MyMatrix",
ProgramBuffer.ACSC_NONE, rowIndex,
rowIndex, fromColumnIndex, toColumnIndex);
//Now var is a vector of size 3
//Reading column or part of column from matrix:
//Reading a part of colomn 1 from element with index 0 till
//element with index 1
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: "MyMatrix” – user variable name
//ProgramBuffer.ACSC_NONE - global variable
//fromRowIndex – from1
//toRowIndex – to1
//columnIndex – from2, to2
int fromRowIndex = 0;
int toRowIndex = 1;
int columnIndex = 1;
var = Ch.ReadVariableAsVector("MyMatrix",
ProgramBuffer.ACSC_NONE, fromRowIndex, toRowIndex,
columnIndex, columnIndex);
//Now var is a vector of size 2

3.5.4 ReadVariableAsMatrix
Description
The method reads the variable from a controller and returns it as matrix.
Syntax
object.ReadVariableAsMatrix(string variable, [ProgramBuffer nBuf], [int from1], [intto1], [int from2],
[int to2])
Async Syntax
object.ReadVariableAsMatrixAsync(string variable, [ProgramBuffer nBuf], [int from1], [int to1], [int
from2], [int to2])
Arguments

variable Name of the controller variable

Number of program buffer for local variable or


nBuf
ProgramBuffer.ACSC_NONE for global and ACSPL+ variables.

Index range (first dimension) starting from zero. Default value:


from1, to1
Api.ACSC_NONE.

Index range (second dimension) starting from zero. Default value:


from2, to2
Api.ACSC_NONE.

Version 2.70 72
SPiiPlus .NET Library Programmer's Guide
3. Methods

Return Value
Object.
The return value is a two-dimensional array (matrix). The type of return value is real or integer,
corresponding to the type of controller variable.
Remarks
If you want a Return Value as scalar or vector use ReadVariableAsScalar or ReadVariableAsVector
methods correspondingly.
The variable can be an ACSPL+ controller variable, a user global variable, or a user local variable.
ACSPL+ variables and user global variables have a global scope; therefore nBuf must be omitted or
specified as ProgramBuffer.ACSC_NONE (–1) for these classes of variables.
User local variables exist only within a buffer. The buffer number must be specified for user local
variable.
The index parameters can be specified in many different ways to read whole variable, one element
of the variable or several elements of the variable. The following explains how to specify indexes in
several typical cases.
> Reading a whole variable
from1, to1, from2 and to2 indexes should be omitted or specified as Api.ACSC_NONE. The
method returns all elements of variable as object initialized as follows:
Matrix 1x1 , if the variable is scalar
Matrix 1xN, if the variable is vector of size N Matrix NxM, if the variable matrix NxM
> Reading a sub-vector from a vector
from1 and to1 should specify the sub-vector index range, from1 should be less than or
equal to to1. from2 and to2 should be omitted or specified as Api.ACSC_NONE. The method
returns data as object, initialized as a matrix of size (to1–from1 +1)x1.
> Reading a sub-matrix from a matrix
from1 and to1 should specify a range of rows, where from1 should be less than or equal to
to1. from2 and to2 should specify a range of columns , where from2 should be less than or
equal to to2. The method returns data as object, initialized as matrix with the number of
rows equal to to1–from1 +1 and the number of columns equals to2–from2 +1.
If the method fails, the Error object is filled with the Error Description.
Example

//Read variable as matrix


object var;
//var in the next Examples is returned as matrix object var;
//Reading whole variable, if the variable is scalar:
//Parameters: "BAUD" - controller variable name
//(optional:)ProgramBuffer.ACSC_NONE - ACSPL+ variable
var = Ch.ReadVariableAsMatrix("BAUD");
//or:
var = Ch.ReadVariableAsMatrix("BAUD",

Version 2.70 73
SPiiPlus .NET Library Programmer's Guide
3. Methods

ProgramBuffer.ACSC_NONE);
//now var is a matrix of size 1x1
//Reading whole variable, if the variable is one-dimensional
//array:
//Parameters: "VEL" - controller variable name
//(optional:)ProgramBuffer.ACSC_NONE - ACSPL+ variable
var = Ch.ReadVariableAsMatrix("VEL");
//or:
var = Ch.ReadVariableAsMatrix("VEL",
ProgramBuffer.ACSC_NONE);
//now var is a matrix of size 1x8
//Reading whole variable, if the variable is two-dimensional
//array:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: "MyMatrix” – user variable name
//(optional:)ProgramBuffer.ACSC_NONE - global variable
var = Ch.ReadVariableAsMatrix("MyMatrix");
//or:
var = Ch.ReadVariableAsMatrix("MyMatrix",
ProgramBuffer.ACSC_NONE);
//now var is a matrix of size 3x4
//Reading sub-vector (more then one element) from vector:
//Reading sub-vector with indexes from 1 to 5:
//Parameters: "VEL" - controller variable name
//ProgramBuffer.ACSC_NONE - ACSPL+ variable
//fromIndex – from11
//toIndex – to1
int fromIndex = 1;
int toIndex = 5;
var = Ch.ReadVariableAsMatrix("VEL",
ProgramBuffer.ACSC_NONE, fromIndex, toIndex);
//now var is a matrix of size 1x5
//Reading sub-matrix from matrix:
//Reading sub-matrix from with rows from 0 to 1 and colomns
//from 0 to 2
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: "MyMatrix” – user variable name
//ProgramBuffer.ACSC_NONE - global variable
//fromRowIndex – from1
//toRowIndex – to1
//fromColumnIndex – from2
//toColumnIndex - to2
int fromRowIndex = 0;
int toRowIndex = 1;
int fromColumnIndex = 0;
int toColumnIndex = 2;
var = Ch.ReadVariableAsMatrix("MyMatrix",

Version 2.70 74
SPiiPlus .NET Library Programmer's Guide
3. Methods

ProgramBuffer.ACSC_NONE, fromRowIndex,
toRowIndex, fromColumnIndex, toColumnIndex);
//Now var is a matrix 2x3

3.5.5 WriteVariable
Description
The method writes a value defined as object to the controller variable(s).
Syntax
object.WriteVariable(object value, string variable, [ProgramBuffer nBuf], [int from1],[int to1], [int
from2], [int to2])
Async Syntax
object.WriteVariableAsync(object value, string variable, [ProgramBuffer nBuf], [int from1],[int to1],
[int from2], [int to2])
Arguments

Value to be assigned to the variable. The value can contain an integer or real
value number(s). The value can be scalar, one-dimensional array (vector) or two-
dimensional array (matrix).

variable Name of the controller variable

Number of program buffer for local variable or


nBuf
ProgramBuffer.ACSC_NONE for global and ACSPL+ variables.

from1, Index range (first dimension) starting from zero of variable (not of
to1 value). Default value: Api.ACSC_NONE.

from2, Index range (second dimension) starting from zero of variable (not of value).
to2 Default value: Api.ACSC_NONE.

Return Value
None.
Remarks
This method writes value to the specified variable. variable can be scalar, vector (one- dimensional
array) or matrix (two-dimensional array).
variable can be either an ASCPL+ variable, user global variable or a user local variable. ASCPL+ and
user global variables have global scope; therefore nBuf must be must be omitted or specified as
ProgramBuffer.ACSC_NONE (–1) for these classes of variables.
User local variable exist only within a buffer. The buffer number must be specified for user local
variable.
The index parameters can be specified in many different ways. Write the entire variable,a single
element of the variable or several elements of the variable as follows:

Version 2.70 75
SPiiPlus .NET Library Programmer's Guide
3. Methods

> Write value to whole variable


from1, to1, from2 and to2 indexes should be omitted or specified as Api.ACSC_NONE. The
value dimension should correspond to the variable dimension as follows:
> If variable is scalar, value should be scalar, or vector of size 1, or matrix of size 1x1
> If variable is vector of size N, value should be vector of size N, or matrix of size 1xN, or
matrix of size Nx1
> If variable is matrix of size NxM, value should be matrix of size NxM
> Writing a value to one element of vector (one-dimensional array)
The from1 and to1 should be equal and specify index of the element. from2 and to2 should
be omitted or specified as Api.ACSC_NONE.
> Writing value to one element of matrix (two-dimensional array)
The from1 and to1 should be equal and specify row number. The from2 and to2 should be
equal and specify column number.
> Writing a value to sub-vector (more then one element) of vector
The from1 and to1 should specify sub-vector index range, from1 should be less then to1.
The from2 and to2 should be omitted or specified as Api.ACSC_NONE.
> Writing a value to row or part of row of matrix
The from1 and to1 should be equal and specify row number. The from2 and to2 should
specify elements range within the specified row, from2 should be less then to2.
> Writing a value to column or part of column of matrix
The from1 and to1 should specify rows range within the specified column, from1 should be
less than to1. The from2 and to2 should be equal and specify column number.
> Writing a value to sub-matrix of matrix
The from1 and to1 should specify rows range, from1 should be less then to1. The from2 and
to2 should specify columns range, from2 should be less then to2.
If indexes (from1, to1, from2, to2) are specified, their values must correspond to value dimensions
described below:
Table 3-8. Value Dimension Indices

Dimension Indices

Scalar from1=to1 and from2=to2

Vector of size N (to1-from1+1=N and to2=from2) or (to1=from1 and to2-from2+1=N)

Matrix of size NxM to1-from1+1=N and to2-from2+1=M

Scalar from1=to1 and from2=to2

Vector of size N (to1-from1+1=N and to2=from2) or (to1=from1 and to2-from2+1=N)

Version 2.70 76
SPiiPlus .NET Library Programmer's Guide
3. Methods

value type is not required to be the same as variable type. The library provides automatic
conversion from integer to real and from real to integer.
If the method fails, the Error object is filled with the Error Description.
Example

// Write variable
//Initialize scalar
int scalar = 57600;
//Initialize vector
double[] vector = new double[8];
for (int i = 0; i < vector.Length; i++)
{
vector[i] = 1.1;
}
//Initialize matrix
int[,] matrix = new int[3, 4];
for (int i = 0; i <= matrix.GetUpperBound(0); i++)
{
for (int j = 0; j <= matrix.GetUpperBound(1); j++)
{
matrix[i, j] = 2;
}
}
//Initialize subVector
int[] subVector = new int[] { 3, 3 };
//Initialize subMatrix
double[,] subMatrix = new double[,] { { 4.0, 4.0 },
{ 4.0, 4.0 } };
//Writing scalar to whole variable:
//Parameters: scalar - value to be assigned to the variable
//"BAUD" - controller variable name
//(optional:)ProgramBuffer.ACSC_NONE - ACSPL+ variable
Ch.WriteVariable(scalar, "BAUD");
//or:
Ch.WriteVariable(scalar, "BAUD", ProgramBuffer.ACSC_NONE);
//Writing vector (one-dimensional array) to the whole
//variable:
//Parameters: vector - value to be assigned to the variable
//"VEL" - controller variable name
//(optional:)ProgramBuffer.ACSC_NONE - ACSPL+ variable
Ch.WriteVariable(vector, "VEL");
//or:
Ch.WriteVariable(vector, "VEL", ProgramBuffer.ACSC_NONE);
//Writing matrix to whole variable:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: matrix - value to be assigned to the variable
//"MyMatrix" - user variable name
//(optional:)ProgramBuffer.ACSC_NONE - global variable

Version 2.70 77
SPiiPlus .NET Library Programmer's Guide
3. Methods

Ch.WriteVariable(matrix, "MyMatrix");
//or:
Ch.WriteVariable(matrix, "MyMatrix",
ProgramBuffer.ACSC_NONE);
//Writing value to one element of vector (one-dimensional
//array):
//Parameters: scalar - value to be assigned to the variable
//"VEL" - controller variable name
//ProgramBuffer.ACSC_NONE - ACSPL+ variable
//elementIndex - from1, to1
int elementIndex = 3;
Ch.WriteVariable(scalar, "VEL", ProgramBuffer.ACSC_NONE,
elementIndex, elementIndex);
//Writing value to one element of matrix (two-dimensional
//array):
//Writing value to one element of matrix from row 1,
//column 2:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: scalar - value to be assigned to the variable
//"MyMatrix" - user variable name
//ProgramBuffer.ACSC_NONE - global variable
//elementRow - from1, to1
//elementColumn – from2, to2
int elementRow = 1;
int elementColumn = 2;
Ch.WriteVariable(scalar, "MyMatrix",
ProgramBuffer.ACSC_NONE, elementRow, elementRow,
elementColumn, elementColumn);
//Writing value to sub-vector (more then one element) of
//vector:
//Writing sub-vector with indexes from 2 to 3:
//Parameters: subVector - value to be assigned to the
//variable
//"VEL" - controller variable name
//ProgramBuffer.ACSC_NONE - ACSPL+ variable
//fromIndex - from1
//toIndex – to1
int fromIndex = 2;
int toIndex = 3;
Ch.WriteVariable(subVector, "VEL", ProgramBuffer.ACSC_NONE,
fromIndex, toIndex);
//Writing value to row or part of row of matrix:
//Writing value to row 1, from element with index 0 till
//element with index 1:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: subVector - value to be assigned to the
//variable

Version 2.70 78
SPiiPlus .NET Library Programmer's Guide
3. Methods

//"MyMatrix" - user variable name


//ProgramBuffer.ACSC_NONE - global variable
//rowIndex - from1, to1
//fromColumnIndex – from2
//toColumnIndex – to2
int rowIndex = 1;
int fromColumnIndex = 0;
int toColumnIndex = 1;
Ch.WriteVariable(subVector, "MyMatrix",
ProgramBuffer.ACSC_NONE, rowIndex, rowIndex,
fromColumnIndex, toColumnIndex);
//Writing value to column or part of column of matrix:
//Writing value to column 2, from element with index 0 till
//element with index 1:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: subVector - value to be assigned to the
//variable
//"MyMatrix" - user variable name
//ProgramBuffer.ACSC_NONE - global variable
//fromRowIndex - from1
//toRowIndex – to1
//columnIndex – from2, to2
int fromRowIndex = 0;
int toRowIndex = 1;
int columnIndex = 2;
Ch.WriteVariable(subVector, "MyMatrix",
ProgramBuffer.ACSC_NONE, fromRowIndex,
toRowIndex, columnIndex, columnIndex);
//Writing value to sub-matrix of matrix:
//Writing sub-matrix to rows from 2 to 3 and colomns from 1
//to 2:
//Assumed that MyMatrix variable is declared as global
//MyMatrix(3)(4) in the controller:
//Parameters: subMatrix - value to be assigned to the
//variable
//"MyMatrix" - user variable name
//ProgramBuffer.ACSC_NONE - global variable
//fromRowIndex - from1
//toRowIndex – to1
//fromColumnIndex – from2
//toColumnIndex – to2
fromRowIndex = 1;
toRowIndex = 2;
fromColumnIndex = 2;
toColumnIndex = 3;
Ch.WriteVariable(subMatrix, "MyMatrix",
ProgramBuffer.ACSC_NONE, fromRowIndex, toRowIndex,
fromColumnIndex, toColumnIndex);

Version 2.70 79
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.6 History Buffer Management Methods


The History Buffer Management methods are:
Table 3-9. History Buffer Management Methods

Methods Description

OpenHistoryBuffer Opens a history buffer.

CloseHistoryBuffer Closes a history buffer.

GetHistory Retrieves the contents of the history buffer.

3.6.1 OpenHistoryBuffer
Description
The method opens a history buffer.
Syntax
object.OpenHistoryBuffer(int Size)
Arguments

size Required size of the buffer in bytes

Return Value
None.
Remarks
The method allocates a history buffer that stores all commands sent to the controller and all
responses and unsolicited messages received from the controller.
Only one history buffer can be open for each communication channel.
The buffer works as a cyclic buffer. When the amount of the stored data exceeds the buffer size,
the newly stored data overwrites the earliest data in the buffer.
If the method fails, the Error object is filled with the Error Description.
Example

// Open history buffer


int bufferSize = 5000;
//The method opens an history buffer
//size of the buffer is 5000
Ch.OpenHistoryBuffer(bufferSize);

3.6.2 CloseHistoryBuffer
Description
The method closes the history buffer and discards all stored history.
Syntax

Version 2.70 80
SPiiPlus .NET Library Programmer's Guide
3. Methods

object.CloseHistoryBuffer()
Arguments
None.
Return Value
None.
Remarks
The method closes the history buffer and releases the used memory. All information stored in the
buffer is discarded.
If the method fails, the Error object is filled with the Error Description.
Example

// Close history buffer


//The method closes an history buffer
Ch.CloseHistoryBuffer();

3.6.3 GetHistory
Description
The method retrieves the contents of the history buffer.
Syntax
object.GetHistory(bool bClear)
Arguments

If TRUE, the method clears contents of the history buffer. If FALSE, the history
bClear
buffer content is not cleared.

Return Value
String
The method retrieves the communication history from the history buffer.
Remarks
The communication history includes all commands sent to the controller and all responses and
unsolicited messages from the controller. The amount of history data is limited by the size of the
history buffer. The history buffer works as a cyclic buffer: when the amount of the stored data
exceeds the buffer size, the newly stored data overwrites the earliest data in the buffer.
Therefore, as a rule, the retrieved communication history includes only recent commands,
responses and unsolicited messages. The depth of the retrieved history depends on the history
buffer size.
The history data is retrieved in historical order, i.e. the earliest message is stored at the beginning
of the returned string. The beginning of the return string might be incomplete, if it has been
partially overwritten in the history buffer.
If the method fails, the Error object is filled with the Error Description.

Version 2.70 81
SPiiPlus .NET Library Programmer's Guide
3. Methods

Example

// Get history buffer


int bufferSize = 5000;
string cmd = "enable 0";
//The method opens an history buffer
//size of the buffer is 5000
Ch.OpenHistoryBuffer(bufferSize);
//Sending the GUI "enable 0"
Ch.Send(cmd);
//The method retrieves the contents of the
//history buffer.
string str = Ch.GetHistory(false);
//The method closes the history buffer
Ch.CloseHistoryBuffer();

3.7 Unsolicited Messages Buffer Management Methods


The Unsolicited Messages Buffer Management methods are:
Table 3-10. Unsolicited Messages Buffer Management Methods

Methods Description

OpenMessageBuffer Opens an unsolicited messages buffer.

CloseMessageBuffer Closes an unsolicited messages buffer.

GetSingleMessage Retrieves single unsolicited message from the buffer.

3.7.1 OpenMessageBuffer
Description
The method opens an unsolicited messages buffer.
Syntax
object.OpenMessageBuffer(int size)
Arguments

size Required size of the buffer in bytes

Return Value
None.
Remarks
The method allocates a buffer that stores unsolicited messages from the controller.
Unsolicited messages are messages that the controller sends on its own initiative and not as a
response to a command. For Example, the disp command in an ACSPL+ program forces the
controller to send an unsolicited message.

Version 2.70 82
SPiiPlus .NET Library Programmer's Guide
3. Methods

Only one message buffer can be open for each communicationchannel.


The message buffer works as a FIFO buffer: GetSingleMessage extracts the earliest message stored
in the buffer. If GetSingleMessage extracts the messages slower than the controller produces
them, buffer overflow can occur, and some messages will be lost. Generally, the greater the buffer,
the less likely is buffer overflow to occur.
If the method fails, the Error object is filled with the Error Description.
Example

// Open message buffer


int bufferSize = 5000;
//The method opens an unsolicited messages
//buffer size of the opened buffer is 5000
Ch.OpenMessageBuffer(bufferSize);

3.7.2 CloseMessageBuffer
Description
The method closes the messages buffer and discards all stored unsolicited messages.
Syntax
object.CloseMessageBuffer()
Arguments
None.
Return Value
None.
Remarks
The method closes the message buffer and releases the used memory. All unsolicited messages
stored in the buffer are discarded.
If the method fails, the Error object is filled with the Error Description.
Example

// Close message buffer


//The method closes the messages buffer
//and discards all stored unsolicited messages
Ch.CloseMessageBuffer();

3.7.3 GetSingleMessage
Description
The method retrieves single unsolicited message from the buffer. This method only works if you
setup a buffer using OpenMessageBuffer. If there is no message in the buffer the method waits
until the message arrives or time out expires.
Syntax
object.GetSingleMessage(int timeout)

Version 2.70 83
SPiiPlus .NET Library Programmer's Guide
3. Methods

Arguments

timeout Maximum waiting time in milliseconds.

Return Value
String.
Remarks
The method retrieves single unsolicited message from the message buffer.
If no, unsolicited message is received the method waits until a message arrives. If the timeout
expires, the method exits with ACSC_TIMEOUT error.
If the method fails, the Error object is filled with the Error Description.
Example

int bufferSize = 5000;


int timeout = 1000;
//The method opens an unsolicited messages
//buffer, size of the opened buffer is 5000
Ch.OpenMessageBuffer(bufferSize);

string program = "disp\"Test Message\"; stop\n";


// The method appends one ACSPL+ line to buffer 0
Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_0, program);
// Get program of buffer 0
string buf = Ch.UploadBuffer(ProgramBuffer.ACSC_BUFFER_0);
Ch.CompileBuffer(ProgramBuffer.ACSC_BUFFER_0);
Ch.RunBuffer(ProgramBuffer.ACSC_BUFFER_0,null);

//The method retrieves unsolicited message


//from the buffer and wait 1 second till a
//message arrives
string message = Ch.GetSingleMessage(timeout);

//The method closes the messages buffer


//and discards all stored unsolicited messages
Ch.CloseMessageBuffer();

Ch.ClearBuffer(ProgramBuffer.ACSC_BUFFER_0, 1, 1000);

3.8 Log File Management Methods


The Log File Management methods are:
Table 3-11. Log File Management Methods

Method Description

OpenLogFile Opens a log file.

Version 2.70 84
SPiiPlus .NET Library Programmer's Guide
3. Methods

Method Description

CloseLogFile Closes a log file.

WriteSCLogFile Writes a log file.

FlushLogFile Flushes log to file.

3.8.1 OpenLogFile
Description
The method opens a log file.
Syntax
object.OpenLogFile(string filename)
Arguments

filename String containing the name or path and name of the log file.

Return Value
None.
Remarks
The method opens a binary file that stores all communication history. Only one log file can be open
for each communication channel.
If the log file has been open, the library writes all incoming and outgoing messages to the specified
file. The messages are written to the file in binary format, i.e., exactly as they are received and sent,
including all service bytes.
Unlike the history buffer, the log file cannot be read within the library. The main usage of the log
file is for debug purposes.
If the method fails, the Error object is filled with the Error Description.
Example

// Open log file


Ch.OpenLogFile("C:\\COMLogFile.log");

3.8.2 CloseLogFile
Description
The method closes the log file.
Syntax
object.CloseLogFile()
Arguments
None.
Return Value

Version 2.70 85
SPiiPlus .NET Library Programmer's Guide
3. Methods

None.
Remarks
An application must always call CloseLogFile before it exits. Otherwise, the data written to the file
might be lost.
If the method fails, the Error object is filled with the Error Description.
Example

// Close log file


//The method opens the log file "COMLogFile.log"
Ch.OpenLogFile("C:\\COMLogFile.log");
//The method closes the log file "COMLogFile.log"
Ch.CloseLogFile();

3.8.3 WriteLogFile
Description
The method writes to log file.
Syntax
object.WriteLogFile(string buf)
Arguments

buf The string to be written to log file.

Return Value
None.
Remarks
The method writes data from a buffer to log file. The log file should be previously opened by the
OpenLogFile method.
The method adds its Arguments to the internal UMD binary buffer. In previous C Library versions,
the log file had to be explicitly opened by the OpenLogFile method, otherwise the function would
return an error. Starting with new versions, this is no longer the case. See FlushLogFile.
If the method fails, the Error object is populated with the Error Description.
Example

// Open log file


//Check you have a permision write a file to this place
Ch.OpenLogFile("C:\\Test\\LogFile.log");
//Write to log file a text "Writing to log file";
Ch.WriteLogFile("Writing to log file");
//Close the log file
Ch.CloseLogFile();

Version 2.70 86
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.8.4 FlushLogFile
Description
The method flushes log to file.
Syntax
object.FlushLogFile(string fileName)
Arguments

fileName String specifying the text file into which the buffer is to be flushed.

Return Value
None.
Remarks
If Continuous Log is active, the function will fail.
Example

// Open log file


//Check you have a permision write a file to this place
Ch.OpenLogFile("C:\\Test\\LogFile.log");
//Write to log file a text "First writing to log file";
Ch.WriteLogFile("First writing to log file");
//Write to log file a text "Second writing to log file";
Ch.WriteLogFile("Second writing to log file");
//Close the log file
Ch.CloseLogFile();
// Flush log file
Ch.FlushLogFile("C:\\Test\\NewLogFile.log");

3.9 SPiiPlusSC Log File Management Methods

These methods can only be used with the SPiiPlusSC Motion Controller.

The SPiiPlusSC Log File Management methods are:


Table 3-12. SPiiPlusSC Log File Management Methods

Method Description

OpenSCLogFile Used for opening the SPiiPlusSC log file.

CloseSCLogFile Used for closing the SPiiPlusSC log file.

WriteSCLogFile Used for writing to the SPiiPlusSC log file.

Enables flushing the SPiiPlusSC internal buffer to a specified text file from
FlushSCLogFile
the NET Library application.

Version 2.70 87
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.9.1 OpenSCLogFile
Description
The method opens the SPiiPlusSC log file.
Syntax
object.OpenSCLogFile(string filename);
Arguments

filename The name or path of the log file.

Return Value
None.
Remarks
The method opens a binary file that stores all SPiiPlusSC log history. The messages are written to
the file in binary format, i.e., exactly as they are received and sent, including all service bytes.
The main use of the SPiiPlusSC log file is for debugging purposes.
Example

// Open SPiiPlusSC log file


Ch.OpenSCLogFile("C:\\SCLogFile2.txt");

3.9.2 CloseSCLogFile
Description
The method closes the SPiiPlusSC log file.
Syntax
object.CloseSCLogFile();
Arguments
None.
Return Value
None.
Remarks
An application must always call CloseSCLogFile before it exits; otherwise, the data written to the file
might be lost.
Example

// Close SPiiPlusSC log file


Ch.CloseSCLogFile();

3.9.3 WriteSCLogFile
Description

Version 2.70 88
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method writes to the SPiiPlusSC log file.


Syntax
object.WriteSCLogFile(string buf);
Arguments

buf The string to be written to the log file.

Return Value
None.
Remarks
The method writes data from a buffer to the SPiiPlusSC log file.
Example

// Write to SPiiPlusSC log file


Ch.WriteSCLogFile("Hello World!");

3.9.4 FlushSCLogFile
Description
The method enables flushing the SPiiPlusSC internal buffer to a specified text file from the .NET
Library application.
Syntax
object.FlushSCLogFile(string filename, bool bClear);
Arguments

filename String that specifies the file name.

Can be TRUE or FALSE:


bClear TRUE – the method clears contents of the log buffer. FALSE – the log buffer
content is not cleared.

Return Value
None.
Remarks
If Continuous Log is active, the function will fail.
Example

// Flush to SPiiPlusSC log file


Ch.FlushSCLogFile("C:\\SCLogFile3.txt", true);

Version 2.70 89
SPiiPlus .NET Library Programmer's Guide
3. Methods

3.10 Shared Memory Methods

The Shared Memory methods have been added in support of SPiiPlusSC Motion
Controller to enable accessing shared memory addresses. They cannot be used with
any other SPiiPlus family product.

The Shared Memory methods are:


Table 3-13. Shared Memory Methods

Method Description

GetSharedMemoryAddress Reads the address of shared memory variable.

ReadSharedMemoryInteger Reads value(s) from an integer shared memory variable.

ReadSharedMemoryReal Reads value(s) from a real shared memory variable.

WriteSharedMemoryVariable Writes value(s) to a real or integer shared memory variable.

3.10.1 GetSharedMemoryAddress
Description
The method reads the address of shared memory variable.
Syntax
object.GetSharedMemoryAddress(ProgramBuffer nBuf, string var);
Async Syntax
object.GetSharedMemoryAddressAsync(ProgramBuffer nBuf, string var);
Arguments

Number of program buffer for local variable or ACSC_NONE for global and ACSPL+
nBuf
variable.

var Pointer to a buffer that contains a name of the variable.

Return Value
Uint.
Example
See Shared Memory Program Example.

3.10.2 ReadSharedMemoryInteger
Description
The method reads value(s) from an integer shared memory variable.
Syntax

Version 2.70 90
SPiiPlus .NET Library Programmer's Guide
3. Methods

object.ReadSharedMemoryInteger(uint address, int from1, int to1, int from2, int to2, int[] values);
Arguments

address Shared memory address of the variable that should be read.

from1, to1 Index range (first dimension) for one dimensional array variables.

from2, to2 Index range (second dimension) for two dimensional matrix

Return Value
object.
Returned value is a scalar or an array of integers
Example
See Shared Memory Program Example.

3.10.3 ReadSharedMemoryReal
Description
The method reads value(s) from a real shared memory variable.
Syntax
object.ReadSharedMemoryReal(uint address, int from1, int to1, int from2, int to2, double[] values);
Arguments

Address Shared memory address of the variable that should be read.

from1, to1 Index range (first dimension) for one dimensional array variables.

from2, to2 Index range (second dimension) for two dimensional matrix

Return Value
object.
Returned value is a scalar or an array of doubles
Example
See Shared Memory Program Example.

3.10.4 WriteSharedMemoryVariable
Description
The method writes value(s) to the integer or real shared memory variable.
Syntax
object.WriteSharedMemoryVariable(object value, uint address, int from1, int to1, int from2, int to2);
Arguments

Version 2.70 91
SPiiPlus .NET Library Programmer's Guide
3. Methods

A value to be written. The value could be of integer type or real type or an array
value
of integers or reals.

address Shared memory address of the variable is to written to.

from1,
Index range (first dimension) for one dimensional array variables.
to1

from2,
Index range (second dimension) for two dimensional matrix variables.
to2

values Buffer containing values that should be written.

Return Value
None.
Example
See Shared Memory Program Example.

3.10.5 Shared Memory Program Example

int[] intValues = new int[] { 1, 2, 3, 4 };


int[] intResults = new int[4];

uint address1 = Ch.GetSharedMemoryAddress(ProgramBuffer.ACSC_NONE,


"intVariable");

Ch.WriteSharedMemoryVariable(intValues, address1, 0, 1, 0, 1);


intResults = (int[])Ch.ReadSharedMemoryInteger(address1, 0, 1, 0, 1);

double[] realValues = new double[] { 666.66, 777.77, 888.88, 999.99 };


double[] realResults = new double[4];

uint address2 = Ch.GetSharedMemoryAddress(ProgramBuffer.ACSC_NONE,


"realVariable");

Ch.WriteSharedMemoryVariable(realValues, address2, 0, 1, 0, 1);


realResults = (double[])Ch.ReadSharedMemoryReal(address2, 0, 1, 0, 1);

3.11 System Configuration Methods


The System Configuration methods are:
Table 3-14. System Configuration Methods

Method Description

SetConf The method writes system configuration data.

Version 2.70 92
SPiiPlus .NET Library Programmer's Guide
3. Methods

Method Description

GetConf The method reads system configuration data.

The function retrieves the volatile memory load in


GetVolatileMemoryUsage
percentage.

The function retrieves the amount of total volatile memory.


GetVolatileMemoryTotal

The function retrieves the amount of free volatile memory.


GetVolatileMemoryFree

The function retrieves the non-volatile memory load in


GetNonVolatileMemoryUsage
percentage.

The function retrieves the amount of total non-volatile


GetNonVolatileMemoryTotal
memory.

The function retrieves the amount of free non-volatile


GetNonVolatileMemoryFree
memory.

3.11.1 SetConf
Description
The method writes system configuration data.
Syntax
object.SetConf(int key, int index, double value)
Async Syntax
object.SetConfAsync(int key, int index, double value)
Arguments

Configuration Key (see Axis Definitions that specifies the configured feature.
key Assigns value of key argument in ACSPL+ SetConf command (see SPiiPlus
Command& Variable Reference Guide).

Specifies corresponding axis or buffer number. Assigns value of


index
index

Value to write to specified key. Assigns value of value argument in ACSPL+ SetConf
value
command.

Return Value
None.
Remarks

Version 2.70 93
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method writes system configuration data. key specifies the feature number and index defines
the axis or buffer to which it should be applied. Use ACSC_CONF_XXX properties in the value field.
For detailed description of system configuration see the description of the SetConf method in the
SPiiPlus Command & Variable Reference Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Set configuration of axis 0


//Writes system configuration data of axis 0
//to 1 with key 204
Ch.SetConf((int)ConfigKey.ACSC_CONF_MFLAGS9_KEY,
(int)Axis.ACSC_AXIS_0, 1);
// Asynchronous Set configuration of axis 0
ACSC_WAITBLOCK wb =
Ch.SetConfAsync((int)ConfigKey.ACSC_CONF_MFLAGS9_KEY,
(int)Axis.ACSC_AXIS_0, 1);

3.11.2 GetConf
Description
The method reads system configuration data.
Syntax
object.GetConf(int key, int index)
Async Syntax
object.GetConfAsync(int key, int index)
Arguments

Configuration Key (see Axis Definitions) that specifies the configured feature.
key Assigns value of key argument in ACSPL+ GetConf command (see SPiiPlus Command
& Variable Reference Guide).

Specifies corresponding axis or buffer number. Assigns value of


index
index

Return Value
Double.
The method reads system configuration data.
Remarks
key specifies the feature number and index defines axis or buffer to which it should be applied. For
detailed Description of system configuration see SPiiPlus Command & Variable Reference Guide.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 94
SPiiPlus .NET Library Programmer's Guide
3. Methods

// Synchronous Get configuration of axis 0


//Reads system configuration data of axis 0
//with key 204
double configuration = Ch.GetConf(
(int)ConfigKey.ACSC_CONF_MFLAGS9_KEY,
(int)Axis.ACSC_AXIS_0);
// Asynchronous Get configuration of axis 0
int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetConfAsync(
(int)ConfigKey.ACSC_CONF_MFLAGS9_KEY,
(int)Axis.ACSC_AXIS_0);
configuration = (double)Ch.GetResult(wb, timeout);

3.11.3 GetVolatileMemoryUsage
Description
The function retrieves the volatile memory load in percentage.
Syntax
object.GetVolatileMemoryUsage()
Async Syntax
object.GetVolatileMemoryUsageAsync()
Arguments
None
Return Value
Double
Example

// Synchronous Get volatile memory usage


double volatileMemoryUsage = Ch.GetVolatileMemoryUsage();

// Asynchronous Get volatile memory usage


int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetVolatileMemoryUsageAsync();
double volatileMemoryUsage = (double)Ch.GetResult(wb, timeout);

3.11.4 GetVolatileMemoryTotal
Description
The function retrieves the amount of total volatile memory.
Syntax
object.GetVolatileMemoryTotal()
Async Syntax
object.GetVolatileMemoryTotalAsync()

Version 2.70 95
SPiiPlus .NET Library Programmer's Guide
3. Methods

Arguments
None
Return Value
Double
Example

// Synchronous Get total volatile memory


double volatileMemoryTotal = Ch.GetVolatileMemoryTotal();

// Asynchronous Get total volatile memory


int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetVolatileMemoryTotalAsync();
double volatileMemoryTotal = (double)Ch.GetResult(wb, timeout);

3.11.5 GetVolatileMemoryFree
Description
The function retrieves the amount of free volatile memory.
Syntax
object.GetVolatileMemoryFree()
Async Syntax
object.GetVolatileMemoryFreeAsync()
Arguments
None
Return Value
Double
Example

// Synchronous Get free volatile memory


double volatileMemoryFree = Ch.GetVolatileMemoryFree();

// Asynchronous Get free volatile memory


int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetVolatileMemoryFreeAsync();
double volatileMemoryFree = (double)Ch.GetResult(wb, timeout);

3.11.6 GetNonVolatileMemoryUsage
Description
The function retrieves the non-volatile memory load in percentage.
Syntax
object.GetNonVolatileMemoryUsage()
Async Syntax

Version 2.70 96
SPiiPlus .NET Library Programmer's Guide
3. Methods

object.GetNonVolatileMemoryUsageAsync()
Arguments
None
Return Value
Double
Example

// Synchronous Get non volatile memory usage


double nonVolatileMemoryUsage = Ch.GetNonVolatileMemoryUsage();

// Asynchronous Get non volatile memory usage


int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetNonVolatileMemoryUsageAsync();
double nonVolatileMemoryUsage = (double)Ch.GetResult(wb, timeout);

3.11.7 GetNonVolatileMemoryTotal
Description
The function retrieves the amount of total non-volatile memory.
Syntax
object.GetNonVolatileMemoryTotal()
Async Syntax
object.GetNonVolatileMemoryTotalAsync()
Arguments
None
Return Value
Double
Example

// Synchronous Get total non volatile memory


double nonVolatileMemoryTotal = Ch.GetNonVolatileMemoryTotal();

// Asynchronous Get total non volatile memory


int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetNonVolatileMemoryTotalAsync();
double nonVolatileMemoryTotal = (double)Ch.GetResult(wb, timeout);

3.11.8 GetNonVolatileMemoryFree
Description
The function retrieves the amount of free non-volatile memory.
Syntax
object.GetNonVolatileMemoryFree()

Version 2.70 97
SPiiPlus .NET Library Programmer's Guide
3. Methods

Async Syntax
object.GetNonVolatileMemoryFreeAsync()
Arguments
None
Return Value
Double
Example

// Synchronous Get free non volatile memory


double nonVolatileMemoryFree = Ch.GetNonVolatileMemoryFree();

// Asynchronous Get free non volatile memory


int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetNonVolatileMemoryFreeAsync();
double nonVolatileMemoryFree = (double)Ch.GetResult(wb, timeout);

3.12 Setting and Reading Motion Parameters Methods


The Setting and Reading Motion Parameters methods are:
Table 3-15. Setting and Reading Motion Parameters Methods

Method Description

SetVelocity Defines a value of motion velocity.

Defines a value of motion velocity having an immediate effect on


SetVelocityImm
any executed as well as impending motion.

GetVelocity Retrieves a value of motion velocity.

SetAcceleration Defines a value of motion acceleration.

Defines a value of motion acceleration having an immediate


SetAccelerationImm
effect on any executed as well as impending motion.

GetAcceleration Retrieves a value of motion acceleration.

SetDeceleration Defines a value of motion deceleration.

Defines a value of motion deceleration having an immediate


SetDecelerationImm
effect on any executed as well as impending motion.

GetDeceleration Retrieves a value of motion deceleration.

SetJerk Defines a value of motion jerk.

Version 2.70 98
SPiiPlus .NET Library Programmer's Guide
3. Methods

Method Description

Defines a value of motion jerk having an immediate effect on any


SetJerkImm
executed as well as impending motion.

GetJerk Retrieves a value of motion jerk.

SetKillDeceleration Defines a value of kill deceleration.

Defines a value of kill deceleration having an immediate effect on


SetKillDecelerationImm
any executed as well as impending motion.

GetKillDeceleration Retrieves a value of kill deceleration.

SetFPosition Assigns a current value of feedback position.

GetFPosition Retrieves a current value of motor feedback position.

SetRPosition Assigns a current value of reference position.

GetRPosition Retrieves a current value of reference position.

GetFVelocity Retrieves a current value of motor feedback velocity.

GetRVelocity Retrieves a current value of reference velocity.

3.12.1 SetVelocity
Description
The method defines a value of motion velocity.
Syntax
object.SetVelocity(Axis axis, double velocity)
Async Syntax
object.SetVelocityImmAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

The value specifies required motion velocity. The value will be used in the
velocity subsequent motions except for the master-slave motions and the motions
activated with the ACSC_AMF_VELOCITY flag.

Return Value
None.
Remarks

Version 2.70 99
SPiiPlus .NET Library Programmer's Guide
3. Methods

The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects the motions initiated after the method call. The method has no effect on any
motion that was started or planned before the method call. To change velocity of an executed or
planned motion, use the SetVelocityImm method.
The method has no effect on the master-slave motions and the motions activated with the ACSC_
AMF_VELOCITY flag.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Set velocity of axis 0


double velocity = 10000;
//Sets the velocity to 10000 to axis 0
Ch.SetVelocity(Axis.ACSC_AXIS_0, velocity);

// Asynchronous Set velocity of axis 0


ACSC_WAITBLOCK wb = Ch.SetVelocityAsync(Axis.ACSC_AXIS_0, velocity);

3.12.2 SetVelocityImm
Description
The method defines a value of motion velocity. Unlike SetVelocity, the method has immediate
effect on any executed or planned motion.
Syntax
object.SetVelocityImm(Axis axis, double velocity)
Async Syntax
object.SetVelocityImmAsync(Axis axis, double velocity)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

velocity The value specifies required motion velocity.

Return Value
None.
Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:

Version 2.70 100


SPiiPlus .NET Library Programmer's Guide
3. Methods

> The currently executed motion. The controller provides a smooth transition from the
instant current velocity to the specified new value.
> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call. The method has no effect on
the master-slave motions.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Set immediate velocity of axis 0


double velocity = 80000;
//Writes the specified value of velocity to the controller
Ch.SetVelocityImm(Axis.ACSC_AXIS_0, velocity);
// Asynchronous Set immediate velocity of axis 0
ACSC_WAITBLOCK wb Ch.SetVelocityImmAsync(Axis.ACSC_AXIS_0,velocity);

3.12.3 GetVelocity
Description
The method retrieves a value of motionvelocity.
Syntax
object.GetVelocity(Axis axis)
Async Syntax
object.GetVelocityAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Double.
The method retrieves the value of the motion velocity.
Remarks
The retrieved value is the value defined by a previous call of SetVelocity or the default value if the
method was not previously called.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Get velocity of axis 0


// Retrieves a value of motion velocity of the 0 axis

double velocity = Ch.GetVelocity(Axis.ACSC_AXIS_0);

// Asynchronous Get velocity of axis 0

Version 2.70 101


SPiiPlus .NET Library Programmer's Guide
3. Methods

int timeout = 2000;


ACSC_WAITBLOCK wb = Ch.GetVelocityAsync(Axis.ACSC_AXIS_0);
double velocity = (double)Ch.GetResult(wb, timeout);

3.12.4 SetAcceleration
Description
The method defines a value of motion acceleration.
Syntax
object.SetAcceleration(Axis axis, double acceleration)
Async Syntax
object. SetAccelerationImmAsync(Axis axis, doubleacceleration)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


axis
axis 1, etc. For the axis constants see Axis Definitions.

The value specifies required motion acceleration. The value will be used in
acceleration
the subsequent motions except the master-slave motions.

Return Value
None.
Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects the motions initiated after the method call. The method has no effect on any
motion that was started or planned before the method call. To change acceleration of an executed
or planned motion, use the SetAccelerationImm method.
The method has no effect on the master-slave motions.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Set acceleration of axis 0


double acceleration = 200000;
//Defines a value of motion acceleration to 200000
Ch.SetAcceleration(Axis.ACSC_AXIS_0, acceleration);
// Asynchronous Set acceleration of axis 0
ACSC_WAITBLOCK wb = Ch.SetAccelerationAsync(Axis.ACSC_AXIS_0,
acceleration);

Version 2.70 102


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.12.5 SetAccelerationImm
Description
The method defines a value of motion acceleration. Unlike SetAcceleration, the method has
immediate effect on any executed and planned motion.
Syntax
object.SetAccelerationImm(Axis axis, doubleacceleration)
Async Syntax
object. SetAccelerationImmAsync(Axis axis, doubleacceleration)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


axis
axis 1, etc. For the axis constants see Axis Definitions..

acceleration The value specifies required motion acceleration.

Return Value
None.
Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:
> The currently executed motion.
> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call. The method has no effect on
the master-slave motions.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Set immediate acceleration of axis 0


double acceleration = 300000;
//Writes the specified acceleration value to the controller
Ch.SetAccelerationImm(Axis.ACSC_AXIS_0, acceleration);
// Asynchronous Set immediate acceleration of axis 0
ACSC_WAITBLOCK wb = Ch.SetAccelerationImmAsync(
Axis.ACSC_AXIS_0, acceleration);

3.12.6 GetAcceleration
Description
The method retrieves a value of motion acceleration.
Syntax

Version 2.70 103


SPiiPlus .NET Library Programmer's Guide
3. Methods

object.GetAcceleration(Axis axis)
Async Syntax
object.GetAccelerationAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Double.
The method retrieves the value of the motion acceleration.
Remarks
The retrieved value is either the value defined by a previous call of the SetAcceleration method or
the default value if there was no previous call of SetAcceleration.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Get acceleration of axis 0


double acceleration = Ch.GetAcceleration(Axis.ACSC_AXIS_0);

// Asynchronous Get acceleration of axis 0


int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetAccelerationAsync(Axis.ACSC_AXIS_0);
double acceleration = (double)Ch.GetResult(wb, timeout);

3.12.7 SetDeceleration
Description
The method defines a value of motion deceleration.
Syntax
object.SetDeceleration(Axis a, double deceleration)
Async Syntax
object.SetDecelerationAsync(Axis axis, double deceleration)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


axis
axis 1, etc. For the axis constants see Axis Definitions.

The value specifies a required motion deceleration. The value will be used in
deceleration
the subsequent motions except the master-slave motions.

Return Value
None.

Version 2.70 104


SPiiPlus .NET Library Programmer's Guide
3. Methods

Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion Command.
The method affects the motions initiated after the method call. The method has no effect on any
motion that was started or planned before the method call. To change deceleration of an executed
or planned motion, use the SetDecelerationImm method.
The method has no effect on the master-slave motions.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Set deceleration of axis 0 double deceleration = 100000;


// Writes the specified deceleration value to the controller
Ch.SetDeceleration(Axis.ACSC_AXIS_0, deceleration);
// Asynchronous Set deceleration of axis 0
ACSC_WAITBLOCK wb = Ch.SetDecelerationAsync(Axis.ACSC_AXIS_0,
deceleration);
object pWait = 0;

3.12.8 SetDecelerationImm
Description
The method defines a value of motion deceleration. Unlike SetDeceleration, the method
immediately affects any executed or intended motion.
Syntax
object.SetDecelerationImm(Axis axis, double deceleration)
Async Syntax
object.SetDecelerationImmAsync(Axis axis, double deceleration)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


Axis
axis 1, etc. For the axis constants see Axis Definitions.

The value specifies a required motion deceleration. The value will be applied
Deceleration
to all motions whether in progress or to be started.

Return Value
None.
Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:

Version 2.70 105


SPiiPlus .NET Library Programmer's Guide
3. Methods

> The currently executed motion.


> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call. The method has no effect on
the master-slave motions.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous Set immediate deceleration of axis 0


double deceleration = 100000;
// Writes the specified deceleration value to the controller
Ch.SetDecelerationImm(Axis.ACSC_AXIS_0, deceleration);
// Asynchronous Set immediate deceleration of axis 0
ACSC_WAITBLOCK wb = Ch.SetDecelerationImmAsync(Axis.ACSC_AXIS_0,
deceleration);

3.12.9 GetDeceleration
Description
The method retrieves a value of motion deceleration.
Syntax
object.GetDeceleration(Axis axis)
Async Syntax
object.GetDecelerationAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Double.
The method retrieves the value of the motion deceleration.
Remarks
The retrieved value is either the value defined by a previous call of the SetDeceleration method or
the default value if SetDeceleration was not previously called.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous get deceleration of axis 0


double deceleration = Ch.GetDeceleration(Axis.ACSC_AXIS_0);

// Asynchronous get deceleration of axis 0


ACSC_WAITBLOCK wb = Ch.GetDecelerationAsync(Axis.ACSC_AXIS_0);
double deceleration = (double)Ch.GetResult(wb, 2000);

Version 2.70 106


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.12.10 SetJerk
Description
The method defines a value of motion jerk.
Syntax
object.SetJerk(Axis axis, double jerk)
Async Syntax
object.SetJerkAsync(Axis axis, double jerk)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

The value specifies a required motion jerk. The value will be used in the subsequent
jerk
motions except for the master-slave motions.

Return Value
None.
Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects the motions initiated after the method call. The method has no effect on any
motion that was started or planned before the method call. To change the jerk of an executed or
planned motion, use the SetJerkImm method.
The method has no effect on the master-slave motions.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous set jerk of axis 0


Ch.SetJerk(Axis.ACSC_AXIS_0, 1000000);

// Asynchronous set jerk of axis 0


ACSC_WAITBLOCK wb = Ch.SetJerkAsync(Axis.ACSC_AXIS_0, 1000000);

3.12.11 SetJerkImm
Description
The method defines a value of motion jerk. Unlike SetJerk, the method has an immediate effect on
any executed and pending motion.
Syntax
object.SetJerkImm(Axis axis, double jerk)
Async Syntax

Version 2.70 107


SPiiPlus .NET Library Programmer's Guide
3. Methods

object.SetJerkImmAsync(Axis axis, double jerk)


Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
Axis
For the axis constants see Axis Definitions.

Jerk The value specifies a required motion jerk.

Return Value
None.
Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:
> The currently executed motion.
> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call. The method has no effect on
the master-slave motions.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous set immediate jerk of axis 0


Ch.SetJerkImm(Axis.ACSC_AXIS_0, 1000000);

// Asynchronous set immediate jerk of axis 0


ACSC_WAITBLOCK wb = Ch.SetJerkImmAsync(Axis.ACSC_AXIS_0, 1000000);

3.12.12 GetJerk
Description
The method retrieves a value of motion jerk.
Syntax
object.GetJerk(Axis axis)
Async Syntax
object.GetJerkAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value

Version 2.70 108


SPiiPlus .NET Library Programmer's Guide
3. Methods

Double.
The method retrieves the value of the motion jerk.
Remarks
The retrieved value is a value defined by a previous call of SetJerk, or the default value if the
method was not called before.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous get jerk of axis 0


double jerk = Ch.GetJerk(Axis.ACSC_AXIS_0);

// Asynchronous get jerk of axis 0


ACSC_WAITBLOCK wb = Ch.GetJerkAsync(Axis.ACSC_AXIS_0);
double jerk = (double)Ch.GetResult(wb, 2000);

3.12.13 SetKillDeceleration
Description
The method defines a value of motion kill deceleration.
Syntax
object.SetKillDeceleration(Axis axis, double killDeceleration)
Async Syntax
object.SetKillDecelerationAsync(Axis Axis, double killDeceleration)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


axis
axis 1, etc. For the axis constants see Axis Definitions.

The value specifies a required motion kill deceleration. The value will be
killDeceleration
used in the subsequent motions.

Return Value
None.
Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion usesthe value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects the motions initiated after the method call. The method has no effect on any
motion that was started or planned before the method call.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 109


SPiiPlus .NET Library Programmer's Guide
3. Methods

// Synchronous set motion kill deceleration of axis 0


double killdeceleration = 100000;
// Writes the specified kill deceleration value to
//the controller
Ch.SetKillDeceleration(Axis.ACSC_AXIS_0, killdeceleration);
// Asynchronous set motion kill deceleration of axis 0
ACSC_WAITBLOCK wb = Ch.SetKillDecelerationAsync(
Axis.ACSC_AXIS_0, killdeceleration);

3.12.14 SetKillDecelerationImm
Description
The method defines a value of motion kill deceleration. Unlike SetKillDeceleration, the method has
an immediate effect on any executed and plannedmotion.
Syntax
object.SetKillDecelerationImm(Axis axis, double killDeceleration)
Async Syntax
object.SetKillDecelerationImmAsync(Axis axis, double killDeceleration)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


Axis
axis 1, etc. For the axis constants see Axis Definitions.

The value specifies a required motion kill deceleration. The value will be
KillDeceleration
used in the subsequent motions.

Return Value
None.
Remarks
The method writes the specified value to the controller. One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:
> The currently executed motion.
> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call. The method has no effect on
the master-slave motions.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 110


SPiiPlus .NET Library Programmer's Guide
3. Methods

// Synchronous get motion kill deceleration of axis 0


double killDeceleration =
Ch.GetKillDeceleration(Axis.ACSC_AXIS_0);
// Asynchronous get motion kill deceleration of axis 0
ACSC_WAITBLOCK wb =
Ch.GetKillDecelerationAsync(Axis.ACSC_AXIS_0);
killDeceleration = (double)Ch.GetResult(wb, 2000);

3.12.15 GetKillDeceleration
Description
The method retrieves a value of motion kill deceleration.
Syntax
object.GetKillDeceleration(Axis axis)
Async Syntax
object.GetKillDecelerationAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Double.
The method retrieves the value of the motion kill deceleration.
Remarks
The retrieved value is a value defined by a previous call of SetKillDeceleration, or the default value
if the method was not previously called.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous get motion kill deceleration of axis 0


double killDeceleration = Ch.GetKillDeceleration(Axis.ACSC_AXIS_0);
// Asynchronous get motion kill deceleration of axis 0
ACSC_WAITBLOCK wb = Ch.GetKillDecelerationAsync(Axis.ACSC_AXIS_0);
killDeceleration = (double)Ch.GetResult(wb, 2000);

3.12.16 SetFPosition
Description
The method assigns a current value of feedback position.
Syntax
object.SetFPosition(Axis axis, double fPosition)
Async Syntax

Version 2.70 111


SPiiPlus .NET Library Programmer's Guide
3. Methods

object.SetFPositionAsync(Axis axis, double fPosition)


Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

fPosition The value specifies the current value of feedback position.

Return Value
None.
Remarks
The method assigns a current value to the feedback position. No physical motion occurs. The motor
remains in the same position; only the internal controller offsets are adjusted so that the periodic
calculation of the feedback position will provide the required results.
For more information see the explanation of the SET command in the SPiiPlus ACSPL+
Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous set feedback position value of 0 to axis 0


Ch.SetFPosition(Axis.ACSC_AXIS_0, 0);

// Asynchronous set feedback position value of 0 to axis 0


ACSC_WAITBLOCK wb = Ch.SetFPositionAsync(Axis.ACSC_AXIS_0, 0);

3.12.17 GetFPosition
Description
The method retrieves the current value of the motor feedback position.
Syntax
object.GetFPosition(Axis axis)
Async Syntax
object.GetFPositionAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Double.
The method retrieves an instant value of the motor feedback position.
Remarks

Version 2.70 112


SPiiPlus .NET Library Programmer's Guide
3. Methods

The feedback position is a measured position of the motor transferred to user units. If the method
fails, the Error object is filled with the Error Description.
Example

// Synchronous get motor feedback position


double fPosition = Ch.GetFPosition(Axis.ACSC_AXIS_0);
// Asynchronous get motor feedback position
ACSC_WAITBLOCK wb = Ch.GetFPositionAsync(Axis.ACSC_AXIS_0);
fPosition = (double)Ch.GetResult(wb, 2000);

3.12.18 SetRPosition
Description
The method assigns a current value of reference position.
Syntax
object.SetRPosition(Axis axis, double rPosition)
Async Syntax
object.SetRPositionAsync(Axis axis, double rPosition)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

rPosition The value specifies the current value of reference position.

Return Value
None.
Remarks
The method assigns a current value to the reference position. No physical motion occurs. The
motor remains in the same position; only the internal controller offsets are adjusted so that the
periodic calculation of the reference position will provide the required results.
For more information see explanation of the SET command in the SPiiPlus ACSPL+ Programmer's
Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous set reference position value of 0 to axis 0


Ch.SetRPosition(Axis.ACSC_AXIS_0, 0);

// Asynchronous set reference position value of 0 to axis 0


ACSC_WAITBLOCK wb = Ch.SetRPositionAsync(Axis.ACSC_AXIS_0, 0);

3.12.19 GetRPosition
Description

Version 2.70 113


SPiiPlus .NET Library Programmer's Guide
3. Methods

The method retrieves an instant value of the motor reference position.


Syntax
object.GetRPosition(Axis axis)
Async Syntax
object.GetRPositionAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Double.
The method retrieves the current value of the motor reference position.
Remarks
The method retrieves the current value of the motor reference position. The reference position is
a value calculated by the controller as a reference for the motor.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous get instant value of motor reference position


double rPosition = Ch.GetRPosition(Axis.ACSC_AXIS_0);
// Asynchronous get instant value of motor reference position
ACSC_WAITBLOCK wb = Ch.GetRPositionAsync(Axis.ACSC_AXIS_0);
rPosition = (double)Ch.GetResult(wb, 2000);

3.12.20 GetFVelocity
Description
The method retrieves the instantaneous value of the motor feedback velocity. Unlike
GetVelocity, this method retrieves the actually measured velocity and not the required value.
Syntax
object.GetFVelocity(Axis axis)
Async Syntax
object.GetFVelocityAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Double.
Remarks

Version 2.70 114


SPiiPlus .NET Library Programmer's Guide
3. Methods

The feedback velocity is a measured velocity of the motor transferred to user units. If the method
fails, the Error object is filled with the Error Description.
Example

// Synchronous get instant value of motor feedback velocity


double fVelocity = Ch.GetFVelocity(Axis.ACSC_AXIS_0);
// Asynchronous get instant value of motor feedback velocity
ACSC_WAITBLOCK wb = Ch.GetFVelocity(Axis.ACSC_AXIS_0);
fVelocity = (double)Ch.GetResult(wb, 2000);

3.12.21 GetRVelocity
Description
The method retrieves an instant value of the motor referencevelocity.
Syntax
object.GetRVelocity(Axis axis)
Async Syntax
object.GetRVelocityAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Double.
The method retrieves the current value of the motor reference velocity.
Remarks
The reference velocity is a value calculated by the controller in the process of motion generation. If
the method fails, the Error object is filled with the Error Description.
Example

// Synchronous get instant value of motor reference velocity


double rVelocity = Ch.GetRVelocity(Axis.ACSC_AXIS_0);
// Asynchronous get instant value of motor reference velocity
ACSC_WAITBLOCK wb = Ch.GetRVelocity(Axis.ACSC_AXIS_0);
rVelocity = (double)Ch.GetResult(wb, 2000);

3.13 Axis/Motor Management Methods


The Axis/Motor Management methods are:

Version 2.70 115


SPiiPlus .NET Library Programmer's Guide
3. Methods

Table 3-16. Axis/Motor Management Methods

Method Description

CommutExt Commutates a motor.

Enable Activates an axis.

EnableM Activates several axes.

Disable Shuts off an axis.

DisableAll Shuts off all axes.

DisableExt Shuts off an axis and defines the disable reason.

DisableM Shuts off several axes.

Group Creates a coordinate system for a multi-axis motion.

Split Breaks down a previously created axis group.

SplitAll Breaks down all previously created axis groups.

3.13.1 CommutExt
DESCRIPTION
The method initiates motor commutation.
SYNTAX
object.CommutExt(Axis axis, float current, int settle, int slope)
ASYNC SYNTAX
ACSC_ WAITBLOCK object.CommutExtAsync(Axis axis, float current, int settle, int slope)
ARGUMENTS

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

current Desired excitation current in percentage 0-100, ACSC_NONE for default value.

Specifies the time it takes for auto commutation to settle, in milliseconds. ACSC_
settle
NONE for the default value of 500ms.

Specifies the time it takes for the current to rise to the desired value, ACSC_NONE
slope
for default value.

RETURN VALUE
None.
REMARKS

Version 2.70 116


SPiiPlus .NET Library Programmer's Guide
3. Methods

The method commutates a motor. After the commutation, the motor begins to follow the
reference and physical motion is available.
If the method fails, the Error object is populated with the Error Description.
EXAMPLE

int timeout = 5000;


// Commutate axis 0
Ch.CommutExt(Axis.ACSC_AXIS_0, -1, 750, 500);
//Wait till axis 0 is commutated during 5 sec
Ch.WaitMotorCommutated(Axis.ACSC_AXIS_0,1,timeout);

3.13.2 Enable
Description
The method activates an axis.
Syntax
object.Enable(Axis axis)
Async Syntax
object.EnableAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method activates an axis. After activation, the axis begins to follow the reference and physical
motion is available.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


// Enable axis 0
Ch.Enable(Axis.ACSC_AXIS_0);
//Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0,1,timeout);

3.13.3 EnableM
Description
The method activates severalmotors.
Syntax

Version 2.70 117


SPiiPlus .NET Library Programmer's Guide
3. Methods

object.EnableM(Axis[] axes)
Async Syntax
object.EnableMAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method activates several motors. After the activation, the motors begin to follow the
corresponding reference and physical motions for the specified motors are available.
If the method fails, the Error object is filled with the Error Description.
Example

// create axes array, terminate with Axis.ACSC_NONE


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,Axis.ACSC_NONE };
// Enable of axes 0 and 1
Ch.EnableM(axes);

3.13.4 Disable
Description
The method shuts off an axis.
Syntax
object.Disable(Axis axis)
Async Syntax
object.DisableAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
Axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method shuts off a motor. After shutting off the motor cannot follow the reference and
remains at idle.

Version 2.70 118


SPiiPlus .NET Library Programmer's Guide
3. Methods

If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


// Disable axis 0
Ch.Disable(Axis.ACSC_AXIS_0);
//Wait for motor 0 to disable for 5 sec.
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0,0,timeout);

3.13.5 DisableAll
Description
The method shuts off all axes.
Syntax
object.DisableAll()
Async Syntax
object.DisableAllAsync()
Arguments
None.
Return Value
None.
Remarks
The method shuts off all motors. After the shutting off none of motors can follow the
corresponding, reference and all motors remain idle.
If no motors are currently enabled, the method has no effect.
If the method fails, the Error object is filled with the Error Description.
Example

// Disable all motors


Ch.DisableAll();

3.13.6 DisableExt
Description
The method shuts off an axis and defines the disable reason.
Syntax
object.DisableExt(Axis axis, int reason)
Async Syntax
object.DisableExtAsync(Axis axis, int reason)
Arguments

Version 2.70 119


SPiiPlus .NET Library Programmer's Guide
3. Methods

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

Integer number that defines the reason of disabling the axis. The specified value
reason is stored in the MERR variable in the controller and so modifies the state of the
disabled motor.

Return Value
None.
Remarks
The method shuts off a motor. After shutting off the motor cannot follow the reference and
remains at idle.
If reason specifies one of the available motor termination codes, the state of the disabled motor
will be identical to the state of the motor disabled for the corresponding fault. This provides an
enhanced implementation of user-defined fault response.
If the second parameter specifies an arbitrary number, the motor state will be displayed as
“Kill/disable reason: <number> - customer code”. This provides the ability to separate different
DISABLE commands in the application.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


int myCode = 10;
// Disable axis 0 with internal customer code
Ch.DisableExt(Axis.ACSC_AXIS_0, myCode);
//Wait for motor 0 to disable for 5 sec.
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0,0,timeout);

3.13.7 DisableM
Description
The method shuts off several axes.
Syntax
object.DisableM(Axis[] axes)
Async Syntax
object.DisableMAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Version 2.70 120


SPiiPlus .NET Library Programmer's Guide
3. Methods

Return Value
None.
Remarks
The method shuts off several axes. After the shutting off, the axes cannot follow the
corresponding reference and remain idle.
If the method fails, the Error object is filled with the Error Description.
Example

// create axes array, terminate with Axis.ACSC_NONE


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_NONE };
// Disable of axes 0 and 1
Ch.DisableM(axes);

3.13.8 Group
Description
The method creates a coordinate system for a multi-axis motion.
Syntax
object.Group(Axis[] axes)
Async Syntax
object.GroupAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method creates a coordinate system for a multi-axis motion. The first element of the axes
array specifies the leading axis. The motion parameters of the leading axis become the default
motion parameters for the group.
An axis can belong toonly 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. To split the existing group, use
Split.To split all existing groups, use SplitAll.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 121


SPiiPlus .NET Library Programmer's Guide
3. Methods

// create axes array, terminate with Axis.ACSC_NONE


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_AXIS_2,
Axis.ACSC_NONE };
// Create group of axes 0, 1 and 2.
Ch.Group(axes);

3.13.9 Split
Description
The method breaks down a previously created axis group.
Syntax
object.Split(Axis[] axes)
Async Syntax
object.Split(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method breaks down an axis group created before by the Group method. axes must specify
the same axes as for the Group method that created the group. After the splitting up, the group no
longer exists.
If the method fails, the Error object is filled with the Error Description.
Example

// create axes array, terminate with Axis.ACSC_NONE


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_AXIS_2,
Axis.ACSC_NONE };
// Create group of axes 0, 1 and 2.
Ch.Group(axes);
// Split the group of axes 0, 1 and 2.
Ch.Split(axes);

3.13.10 SplitAll
Description
The method breaks down all axis groups created before.
Syntax

Version 2.70 122


SPiiPlus .NET Library Programmer's Guide
3. Methods

object.SplitAll()
Async Syntax
object.SplitAllAsync()
Arguments
None.
Return Value
None.
Remarks
The method breaks down all axis groups created before by the Group method.
The application may call this method to ensure that no axes are grouped. If no groups currently
exist, the method has no effect.
If the method fails, the Error object is filled with the Error Description.
Example

// create axes array, terminate with Axis.ACSC_NONE


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_AXIS_2,
Axis.ACSC_NONE };
// Create group of axes 0, 1 and 2.
Ch.Group(axes);
Ch.SplitAll(); // Split all groups created before

3.14 Motion Management Methods


The Motion Management methods are:
Table 3-17. Motion Management Methods

Method Description

Go Starts up a motion that is waiting in the specified motion queue.

Synchronously starts up several motions that are waiting in the specified motion
GoM
queues.

Halt Terminates a motion using the full deceleration profile.

HaltM Terminates several motions using the full deceleration profile.

Kill Terminates a motion using the reduced deceleration profile.

KillAll Terminates all currently executed motions.

KillM Terminates several motions using the reduced deceleration profile.

Version 2.70 123


SPiiPlus .NET Library Programmer's Guide
3. Methods

Method Description

Terminates a motion using reduced deceleration profile and defines the kill
KillExt
reason.

Terminates a motion immediately and provides a smooth transition to the next


Break
motion.

Terminates several motions immediately and provides a smooth transition to the


BreakM
next motions.

3.14.1 Go
Description
The method starts up a motion waiting in the specified motion queue.
Syntax
object.Go(Axis axis)
Async Syntax
object.GoAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
Axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
A motion that was set with the ACSC_AMF_WAIT flag does not start until the Go method is
executed.The motion waits in the appropriate motion queue.
Each axis has a separate motion queue. A single-axis motion waits in the motion queue of the
corresponding axis. A multi-axis motion waits in the motion queue of the leading axis. The leading
axis is an axis specified first in the motion command.
The Go method initiates the motion waiting in the motion queue of the specified axis. If no motion
waits in the motion queue, the method has no effect.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


// Enable axis 0
Ch.Enable(Axis.ACSC_AXIS_0);
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0,1,timeout);
// Wait till GO command executed on axis 0,target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_WAIT, Axis.ACSC_AXIS_0,10000);

Version 2.70 124


SPiiPlus .NET Library Programmer's Guide
3. Methods

// Motion Start
Ch.Go(Axis.ACSC_AXIS_0);
// Finish the motion, End of multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.14.2 GoM
Description
The method synchronously starts up several motions that are waiting in the specified motion
queues.
Syntax
object.GoM(Axis[] axes)
Async Syntax
object.GoMAsync(Axis[] axes)
Arguments

Array of axis constants: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


Axes axis 1, etc.. After the last axis, one additional element must be included that contains
–1 and marks the end of the array. For the axis constants see Axis Definitions.

Return Value
None.
Remarks
Axes motions that were set with the ACSC_AMF_WAIT flag do not start until the GoM method is
executed. The motions wait in the appropriate motion queue.
Each axis has a separate motion queue. A single-axis motion waits in the motion queue of the
corresponding axis. A multi-axis motion waits in the motion queue of the leading axis. The leading
axis is an axis specified first in the motion command.
The GoM method initiates the motions waiting in the motion queues of the specified axes. If no
motion waits in one or more motion queues, the corresponding axes are not affected.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 10000, 10000 };
Ch.EnableM(axes); // Enable axes 0 and 1

// Wait till axis 0 is enabled during 5 sec


Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);

Version 2.70 125


SPiiPlus .NET Library Programmer's Guide
3. Methods

// Wait till GO GUI executed on axes 0 and 1 target position


// of 10000,0000
Ch.ToPointM(MotionFlags.ACSC_AMF_WAIT, axes, points);
// Start the motion of 0 and 1
Ch.GoM(axes);
// Finish the motion, end of the multi-point motion
Ch.EndSequenceM(axes);

3.14.3 Halt
Description
The method terminates a motion using the full deceleration profile.
Syntax
object.Halt(Axis axis)
Async Syntax
object.HaltAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the method has no effect.
The terminated motion finishes using the full third-order deceleration profile and the motion
deceleration value.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axes 0
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Relative motion of axis 0,target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_0,
10000);
// Halt executed to axis 0
Ch.Halt(Axis.ACSC_AXIS_0);

Version 2.70 126


SPiiPlus .NET Library Programmer's Guide
3. Methods

// Finish the motion


// End of the motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.14.4 HaltM
Description
The method terminates several motions using the full decelerationprofile.
Syntax
object.HaltM(Axis[] axes)
Async Syntax
object.HaltMAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method terminates all executed motions that involve the specified axes. The terminated
motions can be either single-axis or multi-axis. All other motions waiting in the corresponding
motion queues are discarded and will not be executed.
If no executed motion involves a specified axis, the method has no effect on the corresponding
axis.
The terminated motions finish using the full third-order deceleration profile and the motion
deceleration values.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 10000, 10000 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);

Version 2.70 127


SPiiPlus .NET Library Programmer's Guide
3. Methods

// Wait till axis 1 is enabled during 5 sec


Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Relative motion of axes 0 and 1 with target position of
// 10000,10000
Ch.ToPointM(MotionFlags.ACSC_AMF_RELATIVE, axes, points);
// Halt executed on axes 0 and 1
Ch.HaltM(axes);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.14.5 Kill
Description
The method terminates a motion using reduced deceleration profile.
Syntax
object.Kill(Axis axis)
Async Syntax
object.KillAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the method has no effect.
The terminated motion finishes with the reduced second-order deceleration profile and the kill
deceleration value.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0);
// Enable axes 0
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Relative motion of axis 0,target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_0,

Version 2.70 128


SPiiPlus .NET Library Programmer's Guide
3. Methods

10000);
// Kill axis 0
Ch.Kill(Axis.ACSC_AXIS_0);
// Finish the motion
// End of the motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.14.6 KillAll
Description
The method terminates all currently executed motions.
Syntax
object.KillAll()
Async Syntax
object.KillAllAsync()
Arguments
None.
Return Value
None.
Remarks
The method terminates all currently executed motions. Any other motion waiting in any motion
queue is discarded and will not be executed.
If no motion is currently executed, the method has no effect.
The terminated motions finish with the reduced second-order deceleration profile and the kill
deceleration values.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 10000, 10000 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Relative motion of axes 0 and 1 with target position of
// 10000,10000
Ch.ToPointM(MotionFlags.ACSC_AMF_RELATIVE, axes, points);
// Kill axes 0 and 1

Version 2.70 129


SPiiPlus .NET Library Programmer's Guide
3. Methods

Ch.KillAll();
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.14.7 KillM
Description
The method terminates several motions using reduced deceleration profile.
Syntax
object.KillM(Axis[] axes)
Async Syntax
object.KillMAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method terminates all executed motions that involve the specified axes. The terminated
motions can be either single-axis or multi-axis. All other motions waiting in the corresponding
motion queues are discarded and will not be executed.
If no executed motion involves a specified axis, the method has no effect on the corresponding
axis.
The terminated motions finish with the reduced second-order deceleration profile and the kill
deceleration values.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 10000, 10000 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);

Version 2.70 130


SPiiPlus .NET Library Programmer's Guide
3. Methods

// Wait till axis 1 is enabled during 5 sec


Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Relative motion of axes 0 and 1 with target position of
// 10000,10000
Ch.ToPointM(MotionFlags.ACSC_AMF_RELATIVE, axes, points);
// Kill axes 0 and 1
Ch.KillM(axes);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.14.8 KillExt
Description
The method terminates a motion using reduced deceleration profile and defines the kill reason.
Syntax
object.KillExt(Axis axis, int reason)
Async Syntax
object.KillExtAsync(Axis axis, int reason)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

Integer number that defines the reason of disabling the axis. The specified value
reason is stored in the MERR variable in the controller and so modifies the state of the
disabled motor.

Return Value
None.
Remarks
The method terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the method has no effect.
The terminated motion finishes with the reduced second-order deceleration profile and the kill
deceleration value.
If reason specifies one of the available motor termination codes, the state of the killed motor will
be identical to the state of the motor killed for the corresponding fault. This provides an enhanced
implementation of user-defined fault response.
If the second parameter specifies an arbitrary number, the motor state will be displayed as
“Kill/disable reason: <number> - customer code”. This provides ability to separate different Kill
commands in the application.

Version 2.70 131


SPiiPlus .NET Library Programmer's Guide
3. Methods

If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


int myCode = 10;
Ch.Enable(Axis.ACSC_AXIS_0); // Enable axes 0
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Relative motion of axis 0,target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_0,
10000);
// Kill axis 0 with internal customer code
Ch.KillExt(Axis.ACSC_AXIS_0, myCode);
// Finish the motion
// End of the motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.14.9 Break
Description
Terminates a motion immediately and provides a smooth transition to the nextmotion.
Syntax
object.Break(Axis axis)
Async Syntax
object.BreakAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method terminates the executed motion that involves the specified axis only if the next
motion is waiting in the corresponding motion queue. The terminated motion can be either single-
axis or multi-axis.
If the motion queue contains no waiting motion, the break command is not executed immediately.
The current motion continues instead until the next motion is planned to the same motion queue.
Only then is the break command executed.
If no executed motion involves the specified axis, or the motion finishes before the next motion is
planned, the method has noeffect.

Version 2.70 132


SPiiPlus .NET Library Programmer's Guide
3. Methods

When executing the break command, the controller terminates the motion immediately without
any deceleration profile. The controller builds instead a smooth third-order transition profile to the
next motion.
Use caution when implementing the break command with a multi-axis motion, because the
controller provides a smooth transition profile of the vector velocity. In a single-axis motion, this
ensures a smooth axis velocity. However, in a multi-axis motion an axis velocitycan change abruptly
if the terminated and next motions are not tangent in the junction point. To avoid jerk, the
terminated and next motion must be tangent or nearly tangent in thejunction point.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axes 0
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Start up the motion of axis 0 to point 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_0,
10000);
// Executing of break to axis 0
Ch.Break(Axis.ACSC_AXIS_0);
// Change the end of the point to point 0 of the fly
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_0,
0);
// Finish the motion
// End of the motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.14.10 BreakM
Description
Terminates several motions immediately and provides a smooth transition to the next motions.
Syntax
object.BreakM(Axis[] axes)
Async Syntax
object.BreakMAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Version 2.70 133


SPiiPlus .NET Library Programmer's Guide
3. Methods

Return Value
None.
Remarks
The method terminates the executed motions that involve the specified axes. Only those motions
are terminated that have the next motion waiting in the corresponding motion queue. The
terminated motions can be either single-axis or multi-axis.
If a motion queue contains no waiting motion, the break command does not immediately affect
the corresponding axis. The current motion continues instead until the next motion is planned to
the same motion queue. Only then, the break command is executed.
If no executed motion involves the specified axis, or the corresponding motion finishes before the
next motion is planned, the method does not affect the axis.
When executing the break command, the controller terminates the motion immediately without
any deceleration profile. Instead, the controller builds a smooth third-order transition profile to the
next motion.
Use caution when implementing the break command with a multi-axis motion, because the
controller provides a smooth transition profile of the vector velocity. In a single-axis motion, this
ensures a smooth axis velocity, but in a multi-axis motion, an axis velocity can change abruptly if the
terminated and next motions are not tangent in the junction point. To avoid jerk, the terminated
and next motion must be tangent or nearly tangent in the junction point.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 10000, 10000 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Start up motion of axes 0 and 1 to point of 10000
Ch.ToPointM(MotionFlags.ACSC_AMF_RELATIVE, axes, points);
// Execute break to axes 0 and 1
Ch.BreakM(axes);
// Change the end point to -10000 on the fly
points[0] = -10000; points[1] = -10000;
Ch.ToPointM(MotionFlags.ACSC_AMF_RELATIVE, axes, points);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.15 Point-to-Point Motion Methods


The Point-to-Point Motion methods are:

Version 2.70 134


SPiiPlus .NET Library Programmer's Guide
3. Methods

Table 3-18. Point-to-Point Motion Methods

Method Description

ToPoint Initiates a single-axis motion to the specified point.

ToPointM Initiates a multi-axis motion to the specified point.

Initiates a single-axis motion to the specified point using the specified


ExtToPoint
velocity or end velocity.

Initiates a multi-axis motion to the specified point using the specified


ExtToPointM
velocity or end velocity.

3.15.1 ToPoint
Description
The method initiates a single-axis motion to the specified point.
Syntax
object.ToPoint(MotionFlags flags, Axis axis, double point)
Async Syntax
object.ToPointAsync(MotionFlags flags, Axis axis, double point)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but do not start it until the
flags Go method is executed.
ACSC_AMF_RELATIVE: the Point value is relative to the end point of the previous
motion. If the flag is not specified, the Point specifies an absolute coordinate.

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

point Coordinate of the target point.

Return Value
None.
Remarks
The method initiates a single-axis point-to-point motion.
The motion is executed using the required motion velocity and finishes with zero end velocity. The
required motion velocity is the velocity specified by the previous call of the SetVelocity method or
the default velocity if the method was not called.
To execute multi-axis point-to-point motion, use ToPointM. To execute motion with other motion
velocity or non-zero end velocity, use ExtToPoint or ExtToPointM.

Version 2.70 135


SPiiPlus .NET Library Programmer's Guide
3. Methods

The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end.
To wait for the motion end, use WaitMotionEnd method.
The motion builds the velocity profile using the required values of velocity, acceleration,
deceleration, and jerk of the specified axis.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axes 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Relative motion of axis 0 to target point of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_0,
10000);
// Wait till motion ends
Ch.WaitMotionEnd(Axis.ACSC_AXIS_0, timeout * 2);
// Finish the motion
// End of the motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.15.2 ToPointM
Description
The method initiates a multi-axis motion to the specified point.
Syntax
object.ToPointM(MotionFlags flags, Axis[] axes, double[] point)
Async Syntax
object.ToPointMAsync(MotionFlags flags, Axis[] axes, double[] point)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but do not start it until the GoM
method is executed.

flags ACSC_AMF_RELATIVE: the Point value is relative to the end point of the previous
motion. If the flag is not specified, the Point specifies an absolute coordinate.
ACSC_AMF_MAXIMUM: not to use the motion parameters from the leading axis but
to calculate the maximum allowed motion velocity, acceleration, deceleration, and
jerk of the involved axes.

Version 2.70 136


SPiiPlus .NET Library Programmer's Guide
3. Methods

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Array of the target coordinates. The number and order of values must correspond
point to the axes array. The point must specify a value for each element of axes except
the last –1 element.

Return Value
None.
Remarks
The method initiates a multi-axis point-to-point motion.
The motion is executed using the required motion velocity and finishes with zero end velocity. The
required motion velocity is the velocity specified by the previous call of the SetVelocity method, or
the default velocity if the method was not called.
To execute single-axis point-to-point motion, use ToPoint. To execute motion with other motion
velocity or non-zero end velocity, use ExtToPoint or ExtToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end. To wait for the motion end, use
WaitMotionEnd method.
The motion builds the velocity profile using the required values of velocity, acceleration,
deceleration, and jerk of the leading axis. The leading axis is the first axis in the Axes array.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 10000, 10000 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Immediately start the motion of the axes X,Y to the
// absolute target points
Ch.ToPointM(MotionFlags.ACSC_NONE, axes, points);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

Version 2.70 137


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.15.3 ExtToPoint
Description
The method initiates a single-axis motion to the specified point using the specified velocity or end
velocity.
Syntax
object.ExtToPoint(MotionFlags flags, Axis axis, double point, double velocity, double endVelocity)
Async Syntax
object.ExtToPointAsync(MotionFlags flags, Axis axis, double point, double Velocity, double
EndVelocity)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don't start it until the method Go is
executed.
ACSC_AMF_RELATIVE: the Point value is relative to the end point of the
previous motion. If the flag is not specified, the Point specifies an absolute
flags
coordinate.
ACSC_AMF_VELOCITY: the motion will use velocity specified by the Velocity
argument instead of the default velocity.
ACSC_AMF_ENDVELOCITY: the motion will come to the end point with the
velocity specified by the EndVelocity argument.

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis


axis
1, etc. For the axis constants see Axis Definitions.

point Coordinate of the target point.

Motion velocity. The argument is used only if the


velocity
ACSC_AMF_VELOCITY flag is specified.

Velocity in the target point. The argument is used only if the ACSC_AMF_
endVelocity ENDVELOCITY flag is specified. Otherwise, the motion finishes with zero
velocity.

Return Value
None.
Remarks
The method initiates a single-axis point-to-point motion.
If the ACSC_AMF_VELOCITY flag is specified, the motion is executed using the velocity specified by
velocity. Otherwise, the required motion velocity is used. The required motion velocity is the
velocity specified by the previous call of SetVelocity, or the default velocity if the method was not
called.

Version 2.70 138


SPiiPlus .NET Library Programmer's Guide
3. Methods

If the ACSC_AMF_ENDVELOCITY flag is specified, the motion velocity at the final point is specified by
the endVelocity. Otherwise, the motion velocity at the final point is zero.
To execute a multi-axis point-to-point motion with the specified velocity or end velocity, use
ExtAddPointM. To execute motion with default motion velocity and zero end velocity, use ToPoint
or ToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end. To wait for the motion end, use
WaitMotionEnd.
The motion builds the velocity profile using the required values of acceleration,deceleration and
jerk of the specified axis.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Parameters :
// Ch.ACSC_AMF_VELOCITY Or 'Ch.ACSC_AMF_ENDVELOCITY –
// Start up the motion with specified velocity '5000
// Come to the end point with specified 'velocity 1000
// Ch.ACSC_AXIS_0 - axis 0
// 10000 - target point
// 5000 - motion velocity
// 1000 - velocity in the target point
Ch.ExtToPoint(
MotionFlags.ACSC_AMF_VELOCITY |
MotionFlags.ACSC_AMF_ENDVELOCITY, Axis.ACSC_AXIS_0,
10000, 5000, 1000);
// Wait motion motion during 20 sec
Ch.WaitMotionEnd(Axis.ACSC_AXIS_0, timeout * 4);
// Finish the motion
// End of the multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.15.4 ExtToPointM
Description
The method initiates a multi-axis motion to the specified point using the specified velocity or end
velocity.
Syntax
object.ExtToPointM(MotionFlags flags, Axis[] axes, double[] point, double velocity, double
endVelocity)
Async Syntax

Version 2.70 139


SPiiPlus .NET Library Programmer's Guide
3. Methods

object.ExtToPointMAsync(MotionFlags flags, Axis[] axes, double[] point, double velocity, double


endVelocity)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don't start it until the method GoM is
executed.
ACSC_AMF_RELATIVE: the Point value is relative to the end point of the
previous motion. If the flag is not specified, the Point specifies an absolute
flags
coordinate.
ACSC_AMF_VELOCITY: the motion will use velocity specified by the Velocity
argument instead of the default velocity.
ACSC_AMF_ENDVELOCITY: the motion will come to the end point with the
velocity specified by the EndVelocity argument.

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_
0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis,
axes one additional element must be included that contains –1 and marks the end
of the array.
For the axis constants see Axis Definitions.

Array of the target coordinates. The number and order of values must
point correspond to the axes array. The point must specify a value for each
element of axes except the last –1 element.

Motion velocity. The argument is used only if the


velocity
ACSC_AMF_VELOCITY flag is specified.

Velocity in the target point. The argument is used only if the ACSC_AMF_
endVelocity ENDVELOCITY flag is specified. Otherwise, the motion finishes with zero
velocity.

Return Value
None.
Remarks
The method initiates a multi-axis point-to-point motion.
If the ACSC_AMF_VELOCITY flag is specified, the motion is executed using the velocity specified by
velocity. Otherwise, the required motion velocity is used. The required motion velocity is the
velocity specified by the previous call of SetVelocity, or the default velocity if the method was not
called.
If the ACSC_AMF_ENDVELOCITY flag is specified, the motion velocity at the final point is specified by
the endVelocity. Otherwise, the motion velocity at the final point is zero.

Version 2.70 140


SPiiPlus .NET Library Programmer's Guide
3. Methods

To execute a single-axis point-to-point motion with the specified velocity or end velocity, use
ExtToPoint. To execute a motion with default motion velocity and zero end velocity, use ToPoint or
ToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end. To wait for the motion end, use the
WaitMotionEnd method.
The motion builds the velocity profile using the required values of acceleration, deceleration and
jerk of the leading axis. The leading axis is the first axis in the axes array.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 1000, 2000 };
Ch.EnableM(axes); // Enable axis 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Parameters :
// Ch.ACSC_AMF_VELOCITY Or 'Ch.ACSC_AMF_ENDVELOCITY
// Start up the motion with specified velocity '5000
// Come to the end point with specified 'velocity 1000
// axes - axis 0 and 1
// points - target points
// 5000 - motion velocity
// 1000 - velocity in the target point
Ch.ExtToPointM(
MotionFlags.ACSC_AMF_VELOCITY |
MotionFlags.ACSC_AMF_ENDVELOCITY,
axes, points, 5000, 1000);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.16 Track Motion Control Method


The Track Motion Control method is:
Table 3-19. Track Motion Control Method

Method Description

Track The method initiates a single-axis track motion.

Version 2.70 141


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.16.1 Track
Description
The method initiates a single-axis track motion.
Syntax
object.Track(MotionFlags flags, Axis axis)
Async Syntax
object.TrackAsync(MotionFlags flags, Axis axis)
Arguments

Bit-mapped parameter that can include one or more of the following flag: ACSC_
flags
AMF_WAIT: plan the motion but do not start it until the Go method is executed.

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method initiates a single-axis track motion. After the motion is initialized, PTP motion will be
generated with every change in the TPOS value.
The controller response indicates that the command was accepted and the motion was planned
successfully.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Start up immediately the motion of the axis 0
Ch.Track(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_0);
// Target position to 5000
Ch.Transaction("TPOS0 = 5000");

3.17 Jog Methods


The Jog methods are:
Table 3-20. Jog Methods

Method Description

Jog Initiates a single-axis jog motion.

Version 2.70 142


SPiiPlus .NET Library Programmer's Guide
3. Methods

Method Description

JogM Initiates a multi-axis jog motion.

3.17.1 Jog
Description
The method initiates a single-axis jog motion.
Syntax
object.Jog(MotionFlags flags, Axis axis, double velocity)
Async Syntax
object.JogAsync(MotionFlags flags, Axis axis, double velocity)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don't start it until the method Go is
flags executed.
ACSC_AMF_VELOCITY: the motion will use velocity specified by the Velocity
argument instead of the default velocity.

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

If the ACSC_AMF_VELOCITY flag is specified, the velocity profile is built using the
value of velocity. The sign of velocity defines the direction of the motion.

velocity If the ACSC_AMF_VELOCITY flag is not specified, only the sign of velocity is used in
order to specify the direction of motion. In this case, the constants
GlobalDirection.ACSC_POSITIVE_DIRECTION or GlobalDirection.ACSC_NEGATIVE_
DIRECTION can be used.

Return Value
None.
Remarks
The method initiates a single-axis jog. To execute multi-axis jog, use JogM.
The jog motion is a motion with constant velocity and no defined ending point. The jog motion
continues until the next motion is planned, or the motion is killed for any reason.
The motion builds the velocity profile using the default values of acceleration, deceleration and jerk
of the specified axis. If the ACSC_AMF_VELOCITY flag is not specified, the default value of velocity is
used as well. In this case, only the sign of velocity is used in order to specify the direction of motion.
The positive velocity defines a positive direction, the negative velocity defines the negative
direction.

Version 2.70 143


SPiiPlus .NET Library Programmer's Guide
3. Methods

If the ACSC_AMF_VELOCITY flag is specified, the value of velocity is used instead of the default
velocity. The sign of velocity defines the direction of the motion.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. No waiting for the motion end is provided.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Initiates a single-axis jog motion to axis 0 to
// positive direction with
// the specified velocity 10000
Ch.Jog(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_0,
(double)GlobalDirection.ACSC_NEGATIVE_DIRECTION);

3.17.2 JogM
Description
The method initiates a multi-axis jog motion.
Syntax
object.JogM(MotionFlags flags, Axis[] axes, GlobalDirection[] direction, double velocity)
Async Syntax
object.JogMAsync(MotionFlags flags, Axis[] axes, GlobalDirection[] direction, double velocity)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don't start it until the method GoM is
flags executed.
ACSC_AMF_VELOCITY: the motion will use velocity specified by the Velocity
argument instead of the default velocity.

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Version 2.70 144


SPiiPlus .NET Library Programmer's Guide
3. Methods

Array of directions - The number and order of values must correspond to the
axes array. The direction array must specify direction for each element of axes
except the last –1 element. The value ACSC_POSITIVE_DIRECTION in the direction
direction
array specifies the correspondent axis to move in positive direction, the value
ACSC_NEGATIVE_DIRECTION specifies the correspondent axis to move in the
negative direction.

If the ACSC_AMF_VELOCITY flag is specified, the velocity profile is built using the
value of velocity.
velocity
If the ACSC_AMF_VELOCITY flag is not specified, velocity is not used.

Return Value
None.
Remarks
The method initiates a multi-axis jog motion. To execute single-axis jog motion, use Jog.
The jog motion is a motion with constant velocity and no defined ending point. The jog motion
continues until the next motion is planned, or the motion is killed for anyreason.
The motion builds the vector velocity profile using the default values of velocity, acceleration,
deceleration and jerk of the axis group. If the ACSC_AMF_VELOCITY flag is not specified, the default
value of velocity is used as well. If the ACSC_AMF_VELOCITY flag is specified, the value of velocity is
used instead of the default velocity.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method cannot wait or validate the end of the motion. To wait for the motion
end, use WaitMotionEnd.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
GlobalDirection[] directions = {
GlobalDirection.ACSC_POSITIVE_DIRECTION,
GlobalDirection.ACSC_POSITIVE_DIRECTION };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Start up immediately the jog motion of axes X,Y to
// positive directions
// with the specified velocity 5000

Version 2.70 145


SPiiPlus .NET Library Programmer's Guide
3. Methods

Ch.JogM(MotionFlags.ACSC_NONE, axes, directions, 5000);


// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.18 Slaved Motion Methods


The Slaved Motion methods are:
Table 3-21. Slaved Motion Methods

Method Description

SetMaster Initiates calculation of a master value for an axis.

Slave Initiates a master-slave motion.

SlaveStalled Initiates master-slave motion with limited following area.

3.18.1 SetMaster
Description
The method initiates calculating of master value for an axis.
Syntax
object.SetMaster(Axis axis, stringformula)
Async
Syntax
object.SetMasterAsync(Axis axis, stringformula)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

formula ASCII string that specifies a rule for calculating master value.

Return Value
None.
Remarks
The method initiates calculating of master value for an axis.
The master value for each axis is presented in the controller as one element of the MPOS array.
Once the SetMaster method is called, the controller is calculates the master value forthe specified
axis each controller cycle.

Version 2.70 146


SPiiPlus .NET Library Programmer's Guide
3. Methods

The SetMaster method can be called again for the same axis at any time. At that moment, the
controller discards the previous formula and accepts the newly specified formula for the master
calculation.
The method waits for the controller response.
The controller response indicates that the command was accepted and the controller starts
calculating the master value according to the formula.
The formula string can specify any valid ACSPL+ expression that uses any ACSPL+ or user global
variables as itsoperands.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


// Master value is calculated as feedback position of the
// axis 1 with scale factor equal 2
string mFormula = "2 * FPOS(1)";
Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
// Enable axes
Ch.EnableM(axes);
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Set master formula "FPOS(0)= 2 * FPOS(1)"
Ch.SetMaster(Axis.ACSC_AXIS_0, mFormula);
//Set axis 0 to slave
Ch.Slave(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_0);
// Relative motion with target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_1,
10000);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.18.2 Slave
Description
The method initiates a master-slave motion.
Syntax
object.Slave(MotionFlasg flags, Axis axis)
Async Syntax
object.SlaveAsync(MotionFlags flags, Axis axis)
Arguments

flags Bit-mapped parameter that can include one or more of the following flags:

Version 2.70 147


SPiiPlus .NET Library Programmer's Guide
3. Methods

ACSC_AMF_WAIT: plan the motion but don’t start it until the method Go is executed.
ACSC_AMF_POSITIONLOCK: the motion will use position lock. If the flag is not
specified, velocity lock is used (see Remarks).

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The method initiates a single-axis master-slave motion with an unlimited area of following. If the
area of following must be limited, use SlaveStalled.
The master-slave motion continues until the motion is killed or the motion fails for any reason. The
method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully.
The master value for the specified axis must be defined before by the call to SetMaster method.
The SetMaster method can be called again in order to change the formula of master calculation. If
at this moment the master-slave motion is in progress, the slave can come out from synchronism.
The controller then regains synchronism, probably with a different value of offset between the
master and slave.
If the ACSC_AMF_POSITIONLOCK flag is not specified, the method activates a velocity- lock mode of
slaved motion. When synchronized, the APOS axis reference follows the MPOS with a constant
offset:
APOS = MPOS + C
The value of C is latched at the moment when the motion comes to synchronism, and then remains
unchanged as long as the motion is synchronous. If at the moment of motion start the master
velocity is zero, the motion starts synchronously and C is equal to the difference between initial
values of APOS and MPOS.
If the ACSC_AMF_POSITIONLOCK flag is specified, the method activates a position-lock mode of
slaved motion. When synchronized, the APOS axis reference strictly follows the MPOS:
APOS = MPOS
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


// Master value is calculated as feedback position
// of theaxis 1 with scale factor equal 2
string mFormula = "2 * FPOS(1)";
Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
// Enable axes

Version 2.70 148


SPiiPlus .NET Library Programmer's Guide
3. Methods

Ch.EnableM(axes);
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Set master formula "FPOS(0)= 2 * FPOS(1)"
Ch.SetMaster(Axis.ACSC_AXIS_0, mFormula);
//Set axis 0 to slave
Ch.Slave(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_0);
// Relative motion with target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_1,
10000);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.18.3 SlaveStalled
Description
The method initiates master-slave motion within predefined limits.
Syntax
object.SlaveStalled(MotionFlasg flags, Axis axis, double left, double right)
Async Syntax
object.SlaveStalledAsync(MotionFlags flags, Axis axis, double left, double right)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the method Go is executed.
flags
ACSC_AMF_POSITIONLOCK: the motion will use position lock. If the flag is not
specified, velocity lock is used (see Remarks).

Axis constant of slaved axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to


axis
the axis 1, etc. For the axis constants see Axis Definitions.

left Left (negative) limit of the axis.

right Right (positive) limit of the axis.

Return Value
None.
Remarks
The method initiates single-axis master-slave motion within predefined limits. Use Slave to initiate
unlimited motion. For sophisticated forms of master-slave motion, use slaved variants of
segmented and spline motions.
The method waits for the controller response.

Version 2.70 149


SPiiPlus .NET Library Programmer's Guide
3. Methods

The controller response indicates that the command was accepted and the motion was planned
successfully.
The master-slave motion continues until the Kill command is executed, or the motion fails for any
reason.
The master value for the specified axis must be defined before by the call to SetMaster method.
The SetMaster method can be called again in order to change the formula of master calculation. If
at this moment the master-slave motion is in progress, the slave can come out from synchronism.
The controller then regains synchronism, probably with adifferent value of offset between the
master and slave.
If the ACSC_AMF_POSITIONLOCK flag is not specified, the method activates a velocity- lock mode of
slaved motion. When synchronized, the APOS axis reference follows the MPOS with a constant
offset:
APOS = MPOS + C
The value of C is latched at the moment when the motion comes to synchronism, and then remains
unchanged as long as the motion is synchronous. If at the moment of motion start the master
velocity is zero, the motion starts synchronously and C is equal to thedifference between initial
values of APOS and MPOS.
If the ACSC_AMF_POSITIONLOCK flag is specified, the method activates a position-lock mode of
slaved motion. When synchronized, the APOS axis reference strictly follows the MPOS:
APOS = MPOS
The left and right values define the allowed area of changing the APOS value. The MPOS value is
not limited and can exceed the limits. In this case, the motion comes out from synchronism, and the
APOS value remains (stalls) in one of the limits until the change of MPOS allows following again.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


// Master value is calculated as feedback position
// of the axis 1 with scale factor equal 2
string mFormula = "2 * FPOS(1)";
Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
// Enable axes
Ch.EnableM(axes);
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait till axis 1 is enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Set master formula "FPOS(0)= 2 * FPOS(1)"
Ch.SetMaster(Axis.ACSC_AXIS_0, mFormula);
// Left (negative) limit of the following area, right
// (positive)limit of the following area
Ch.SlaveStalled(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_0,
-5000, 5000);

Version 2.70 150


SPiiPlus .NET Library Programmer's Guide
3. Methods

// Relative motion with target position of 10000


Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, Axis.ACSC_AXIS_1,
10000);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.19 Multi-Point Motion Methods


The Multi-Point Motion methods are:
Table 3-22. Multi-Point Motion Methods

Method Description

MultiPoint Initiates a single-axis multi-point motion.

MultiPointM Initiates a multi-axis multi-point motion.

3.19.1 MultiPoint
Description
The method initiates a single-axis multi-point motion.
Syntax
object.MultiPoint(MotionFlags flags, Axis axis, double dwell)
Async Syntax
object.MultiPointAsync(MotionFlags flags, Axis axis, double dwell)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the method Go is executed.
ACSC_AMF_RELATIVE: the coordinates of each point are relative. The first point is
relative to the instant position when the motion starts; the second point is relative
to the first, etc. If the flag is not specified, the coordinates of each point are
flags
absolute.
ACSC_AMF_VELOCITY: the motion uses the velocity specified with each point instead
of the default velocity.
ACSC_AMF_CYCLIC: the motion uses the point sequence as a cyclic array. After
positioning to the last point it does positioning to the first point and continues.

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

dwell Dwell in each point in milliseconds.

Version 2.70 151


SPiiPlus .NET Library Programmer's Guide
3. Methods

Return Value
None.
Remarks
The method initiates a single-axis multi-point motion. To execute multi-axis multi-point motion, use
MultiPointM.
The motion executes sequential positioning to each of the specified points, optionally with dwell in
each point.
The method itself does not specify any point, so that the created motion starts only after the first
point is specified. The points of motion are specified by using the AddPoint or ExtAddPoint
methods that follow this method.
The motion finishes when the EndSequence method is executed. If the EndSequence call 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 motion queue will occur until the method EndSequence
executes.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method cannot wait or validate the end of the motion. To wait for the motion
end, use the WaitMotionEnd.
During positioning to each point, a velocity profile is built using the default values of acceleration,
deceleration, and jerk of the specified axis. If the ACSC_AMF_VELOCITY flag is not specified, the
default value of velocity is used as well. If the ACSC_AMF_VELOCITY flag is specified, the value of
velocity specified in subsequent ExtAddPoint methods is used.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
//Create multi-point motion of axis 0 with default velocity
// with dwell 1 ms
Ch.MultiPoint(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_0, 1);
// Add some points
for (int index = 0; index < 5; index++)
{
Ch.AddPoint(Axis.ACSC_AXIS_0, 100.0 * index);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.19.2 MultiPointM
Description

Version 2.70 152


SPiiPlus .NET Library Programmer's Guide
3. Methods

The method initiates a multi-axis multi-point motion.


Syntax
object.MultiPointM(MotionFlags flags, Axis[] axes, double dwell)
Async Syntax
object.MultiPointMAsync(MotionFlags flags, Axis[] axes, double dwell)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the method GoM is
executed.
ACSC_AMF_RELATIVE: the coordinates of each point are relative. The first point is
relative to the instant position when the motion starts; the second point is relative
flags to the first, etc. If the flag is not specified, the coordinates of each point are
absolute.
ACSC_AMF_VELOCITY: the motion uses the velocity specified with each point instead
of the default velocity.
ACSC_AMF_CYCLIC: the motion uses the point sequence as a cyclic array. After
positioning to the last point it does positioning to the first point and continues.

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

dwell Dwell in each point in milliseconds.

Return Value
None.
Remarks
The method initiates a multi-axis multi-point motion. To execute single-axis multi-point motion, use
MultiPoint.
The motion executes sequential positioning to each of the specified points, optionally with dwell in
each point.
The method 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 using AddPointM or ExtAddPointM, methods that
follow this method.
The motion finishes when the EndSequenceM method is executed. If the call of EndSequenceM 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 motion queue will occur until the method EndSequenceM
executes.
The method waits for the controller response.

Version 2.70 153


SPiiPlus .NET Library Programmer's Guide
3. Methods

The controller response indicates that the command was accepted and the motion was planned
successfully. The method cannot wait or validate the end of the motion. To wait for the motion
end, use the WaitMotionEnd method.
During positioning to each point, a vector velocity profile is built using the default values of velocity,
acceleration, deceleration, and jerk of the axis group. If the AFM_VELOCITY flag is not specified, the
default value of velocity is used as well. If the AFM_VELOCITY flag is specified, the value of velocity
specified in subsequent ExtAddPointM methods isused.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 0, 0 };
Ch.EnableM(axes); // Enable axis 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Create multi-point motion of axis 0 and 1 with default
// velocity without
// dwell in the points
Ch.MultiPointM(MotionFlags.ACSC_NONE, axes, 0);
// Add some points
for (int index = 0; index < 5; index++)
{
points[0] = 100 * index;
points[1] = 100 * index;
Ch.AddPointM(axes, points);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.20 Arbitrary Path Motion Methods


The Arbitrary Path Motion methods are:
Table 3-23. Arbitrary Path Motion Methods

Mehtod Description

Initiates a single-axis spline motion. The motion follows an arbitrary path defined
Spline
by a set of points.

Initiates a multi-axis spline motion. The motion follows an arbitrary path defined
SplineM
by a set of points.

Version 2.70 154


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.20.1 Spline
Description
The method initiates a single-axis spline motion. The motion follows an arbitrary path defined by a
set of points.
Syntax
object.Spline(MotionFlags flags, Axis axis, [double period])
Async Syntax
object.SplineAsync(MotionFlags flags, Axis axis, [double period])
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the method Go is
executed.
ACSC_AMF_RELATIVE: the coordinates of each point are relative. The first point is
relative to the instant position when the motion starts; the second point is relative
to the first, etc. If the flag is not specified, the coordinates of each point are
absolute.
flags
ACSC_AMF_VARTIME: the time interval between adjacent points is non-uniform
and is specified along with each added point. If the flag is not specified, the
interval is uniform and is specified in the Period argument.
ACSC_AMF_CYCLIC: use the point sequence as a cyclic array: after the last point
come to the first point and continue.
ACSC_AMF_CUBIC: use a cubic interpolation between the specified points (third-
order spline).

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


Axis
etc. For the axis constants see Axis Definitions.

Time interval between adjacent points. The parameter is used only if the
period
ACSC_AMF_VARTIME flag is not specified.

Return Value
None.
Remarks
The method initiates a single-axis spline motion. To execute multi-axis spline motion, use SplineM.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method cannot wait or validate the end of the motion. To wait for the motion
end, use the WaitMotionEnd method.
The motion does not use the default values of velocity, acceleration, deceleration, and jerk. The
points and the time intervals between the points completely define the motion profile.

Version 2.70 155


SPiiPlus .NET Library Programmer's Guide
3. Methods

Points for arbitrary path motion are defined by the consequent calls of AddPoint or ExtAddPoint
methods. The EndSequence method terminates the point sequence. After execution of the
EndSequence method, no AddPoint or ExtAddPoint methods for this motion are allowed.
If flag is not specified, linear interpolation is used (first-order spline).
Time intervals between the points are uniform, or non-uniform as defined by the ACSC_AMF_
VARTIME flag. If ACSC_AMF_VARTIME is not specified, the controller builds PV spline motion.
If ACSC_AMF_VARTIME is specified, the controller builds PVT spline motion. The trajectory of the
motion follows through the defined points. Each point presents the instant desired position at a
specific moment.
This motion does not use a motion profile generation. The time intervals between the points are
typically short, so that the array of the points implicitly specifies the desired velocity in each point.
If the time interval does not coincide with the controller cycle, the controller provides interpolation
of the points according to the ACSC_AMF_CUBIC flag.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


double[] points = { 0, 0 };
Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Create the arbitrary path motion to axis 0, use a cubic
// interpolation between the specified points with uniform
// interval 500 ms
Ch.Spline(MotionFlags.ACSC_AMF_CUBIC, Axis.ACSC_AXIS_0, 500);
// Add some points
for (int index = 0; index < 5; index++)
{
points[0] = 100 * index;
points[1] = 20000 * index;
Ch.AddPVPoint(Axis.ACSC_AXIS_0, points[0], points[1]);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.20.2 SplineM
Description
The method initiates a multi-axis spline motion. The motion follows an arbitrary path defined by a
set of points.
Syntax
object.SplineM(MotionFlags flags, Axis[] axes, [double period])
Async Syntax
object.SplineMAsync(MotionFlags flags, Axis[] axes, [double period])

Version 2.70 156


SPiiPlus .NET Library Programmer's Guide
3. Methods

Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the method GoM is
executed.
ACSC_AMF_RELATIVE: the coordinates of each point are relative. The first point is
relative to the instant position when the motion starts; the second point is relative
to the first, etc. If the flag is not specified, the coordinates of each point are
absolute.
flags
ACSC_AMF_VARTIME: the time interval between adjacent points is non-uniform
and is specified along with each added point. If the flag is not specified, the
interval is uniform and is specified in the Period argument.
ACSC_AMF_CYCLIC: use the point sequence as a cyclic array: after the last point
come to the first point and continue.
ACSC_AMF_CUBIC: use a cubic interpolation between the specified points (third-
order spline).

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants Axis Definitions.

Time interval between adjacent points. The parameter is used only if the
period
ACSC_AMF_VARTIME flag is not specified.

Return Value
None.
Remarks
The method initiates a multi-axis spline motion. To execute a single-axis spline motion, use Spline.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method cannot wait or validate the end of the motion. To wait for the motion
end, use the WaitMotionEnd method.
The motion does not use the default values of velocity, acceleration, deceleration, and jerk. The
points and the time intervals between the points define the motion profile completely.
Points for arbitrary path motion are defined by the consequent calls of the AddPVpointM or
ExtAddPointM methods. The EndSequenceM method terminates the point sequence. After
execution of the EndSequenceM method, no AddPointM or ExtAddPointM methods for this motion
are allowed.

Version 2.70 157


SPiiPlus .NET Library Programmer's Guide
3. Methods

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 ACSC_AMF_VARTIME flag.
This motion does not use motion profile generation. Typically, the time intervals between the
points are short, so that the array of the points implicitly specifies the desired velocity in each point.
If the time interval does not coincide with the controller cycle, the controller provides interpolation
of the points according to the ACSC_AMF_CUBIC flag.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 0, 0 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Create the arbitrary path motion to axes 0 and 1 with
// uniform interval 10 ms use a cubic interpolation
// between the specified points
Ch.SplineM(MotionFlags.ACSC_AMF_CUBIC, axes, 10);
// Add some points
for (int index = 0; index < 5; index++)
{
points[0] = 100 * index;
points[1] = 200 * index;
Ch.AddPVPointM(axes, points, points);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.21 PVT Methods


Table 3-24. PVT Methods

Method Description

AddPVPoint Adds a point to a single-axis multi-point or spline motion.

AddPVPointM Adds a point to a multi-axis multi-point or spline motion.

AddPVTPoint Adds a point to a single-axis multi-point or spline motion.

AddPVTPointM Adds a point to a multi-axis multi-point or spline motion.

Version 2.70 158


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.21.1 AddPVPoint
Description
The method adds a point to a single-axis PV spline motion and specifies velocity.
Syntax
object.AddPVPoint(Axis axis, double point, double velocity)
Async Syntax
object.AddPVPointAsync(Axis axis, double point, double velocity)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

point Coordinate of the added point.

velocity Desired velocity at the point

Return Value
None.
Remarks
Before this method can be used, initiate PV spline motion by calling Spline with the appropriate
flags.
The method adds a point to a single-axis PV spline motion with a uniform time and specified
velocity at that point
To add a point to a multi-axis PV motion, use AddPVTPointM and ExtAddPointM.
To add a point to a PVT motion with non-uniform time interval, use the AddPVTPoint and
AddPVTPointM methods. The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, call this method
periodically until the method returns a non-zero value.
If the method fails, the Error object is filled with the Error Description.
Example

// Create PV motion with uniform time interval with uniform


// interval 500 ms
int timeout = 5000;
double[] points = { 0, 0 };
Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
Ch.Spline(MotionFlags.ACSC_AMF_CUBIC, Axis.ACSC_AXIS_0, 500);
// Add some points
for (int index = 0; index < 5; index++)

Version 2.70 159


SPiiPlus .NET Library Programmer's Guide
3. Methods

{
// Position and velocity for each point
points[0] = 100 * index;
points[1] = 20000 * index;
Ch.AddPVPoint(Axis.ACSC_AXIS_0, points[0], points[1]);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

3.21.2 AddPVPointM
Description
The method adds a point to a multiple-axis PV spline motion and specifies velocity.
Syntax
object.AddPVPointM(Axis[] axes, double[] point, double[] velocity)
Async Syntax
object.AddPVPointMAsync(Axis[] axes, double[] point, double[] velocity)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Array of the coordinates of added point. The number and order of values must
point correspond to the axes array. point must specify a value for each element of axes
except the last –1 element.

Array of the velocities of added point. The number and order of values must
velocity correspond to the axes array. The velocity must specify a value for each element
of axes except the last –1 element.

Return Value
None.
Remarks
Before this method can be used, PVT spline motion must be initiated by calling SplineM with the
appropriate flags.
The method adds a point to a multiple-axis PV spline motion with a uniform time and specified
velocity at that point.
To add a point to a single-axis PV motion, use AddPVPoint. To add a point to a PVT motion with non-
uniform time interval, use the AddPVTPoint and AddPVTPointM methods.
The method waits for the controller response.

Version 2.70 160


SPiiPlus .NET Library Programmer's Guide
3. Methods

The controller response indicates that the Commandwas accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns non-zero value.
All axes specified in the Axes array must be specified before calling the MultiPointM or the SplineM
method. The number and order of the axes in the Axes array must correspond exactly to the
number and order of the axes of MultiPointM or the SplineM methods.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 0, 0 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Create PV motion with uniform time interval with uniform
// interval 1000 ms
Ch.SplineM(MotionFlags.ACSC_AMF_CUBIC, axes, 1000);
// Add some points
for (int index = 0; index < 5; index++)
{
// Position and velocity for each point
points[0] = 100 * index;
points[1] = 200 * index;
Ch.AddPVPointM(axes, points, points);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.21.3 AddPVTPoint
Description
The method adds a point to a single-axis PVT spline motion and specifies velocity and motion time.
Syntax
object.AddPVTPoint(Axis axis, double point, double velocity, [double timeInterval])
Async Syntax
object.AddPVTPointAsync(Axis axis, double point, double velocity, [double timeInterval])
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


axis
axis 1, etc. For the axis constants see Axis Definitions.

Version 2.70 161


SPiiPlus .NET Library Programmer's Guide
3. Methods

point Coordinate of the added point.

velocity Desired velocity at the point

If the motion was activated by the Spline method with the ACSC_AMF_
timeInterval VARTIME flag, this parameter defines the time interval between the previous
point and the present one.

Return Value
None.
Remarks
Before this method can be used, PV spline motion must be initiated by calling Spline with the
appropriate flags.
The method adds a point to a single-axis PVT spline motion with a non-uniform time and specified
velocity at that point.
To add a point to a multi-axis PVT motion, use AddPVPointM. To add a point to a PV motion with
uniform time interval, use the AddPVPoint and AddPVPointM methods.
The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns non-zero value.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


double[] points = { 0, 0 };
Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// PVT motion and uniform interval is not used
Ch.Spline(MotionFlags.ACSC_AMF_CUBIC |
MotionFlags.ACSC_AMF_VARTIME, Axis.ACSC_AXIS_0, 0);
// Add some points
for (int index = 0; index < 5; index++)
{
points[0] = 100 * index;
points[1] = 200 * index;
// Position and velocity and time interval of 500 ms for
// each point
Ch.AddPVTPoint(Axis.ACSC_AXIS_0, points[0], points[1],
500);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

Version 2.70 162


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.21.4 AddPVTPointM
Description
The method adds a point to a multiple-axis PVT spline motion and specifies velocity and motion
time.
Syntax
object.AddPVTPointM(Axis[] axes, double[] point, double[] velocity, [double timeInterval])
Async Syntax
object.AddPVTPointMAsync(Axis[] axes, double[] point, double[] velocity, [double timeInterval])
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_
0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis,
axes one additional element must be included that contains –1 and marks the end
of the array.
For the axis constants see Axis Definitions.

Array of the coordinates of added point. The number and order of values
point must correspond to the axes array. The point must specify a value for each
element of axes except the last –1 element.

Array of the velocities of added point. The number and order of values must
velocity correspond to the axes array. The velocity must specify a value for each
element of axes except the last –1 element.

If the motion was activated by the Spline method with the ACSC_AMF_
timeInterval VARTIME flag, this parameter defines the time interval between the previous
point and the present one.

Return Value
None.
Remarks
Before this method can be used, PVT spline motion must be initiated by calling SplineM with the
appropriate flags.
The method adds a point to a multiple-axis PVT spline motion with a non-uniform time and
specified velocity at that point.
To add a point to a single-axis PVT motion, use AddPVPoint. To add a point to a PV motion with a
uniform time interval, use the AddPVPoint and AddPVPointM methods.
The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns non-zero value.
If the method fails, the Error object is filled with the Error Description.

Version 2.70 163


SPiiPlus .NET Library Programmer's Guide
3. Methods

Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 0, 0 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// PVT motion and uniform interval is not used
Ch.SplineM(MotionFlags.ACSC_AMF_CUBIC |
MotionFlags.ACSC_AMF_VARTIME, axes, 0);
// Add some points
for (int index = 0; index < 5; index++)
{
points[0] = 100 * index;
points[1] = 200 * index;
Ch.AddPVTPointM(axes, points, points, 1000);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.22 Segmented Motion Methods


The Segmented Motion methods are:
Table 3-25. Segmented Motion Methods

Method Description

SegmentedMotion Initiates a multi-axis segmented motion.

ExtendedSegmentedMotion Initiates a multi-axis extended segmented motion.

SegmentLine Adds a linear segment to a segmented motion.

Adds an arc segment to a segmented motion and specifies


ExtendedSegmentArc1 the coordinates of center point, coordinates of the final
point, and the direction of rotation.

Adds an arc segment to a segmented motion and specifies


ExtendedSegmentArc2
the coordinates of center point and rotation angle.

Provides a smooth transition between two segments of


Stopper
segmented motion.

Projection Sets a projection matrix for a segmented motion.

Version 2.70 164


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.22.1 SegmentedMotion
Description
The method initiates a multi-axis segmented motion.
Syntax
object.Segment(MotionFlags flags, Axis[] axes, double[] point)
Async Syntax
object.SegmentAsync(MotionFlags flags, Axis[] axes, double[] point)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the method GoM is
executed.
ACSC_AMF_VELOCITY: the motion will use velocity specified for each segment
instead of the default velocity.
ACSC_AMF_CYCLIC: the motion uses the segment sequence as a cyclic array: after
the last segment, move along the first segment etc.
flags
ACSC_AMF_VELOCITYLOCK: slaved motion: the motion advances in accordance to the
master value of the leading axis.
ACSC_AMF_POSITIONLOCK: slaved motion, strictly conformed to master.
ACSC_AMF_EXTRAPOLATED: if a master value travels beyond the specified path, the
last or the first segment is extrapolated.
ACSC_AMF_STALLED: if a master value travels beyond the specified path, the motion
stalls at the last or first point.

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Array of the coordinates of the initial point on the plane. The number and order of
values must correspond to the axes array. The point must specify a value for each
point element of axes except the last
–1 element.

Return Value
None.
Remarks
The method initiates a multi-axis segmented motion.

Version 2.70 165


SPiiPlus .NET Library Programmer's Guide
3. Methods

Segmented motion moves axes along a continuous path. The path is defined as a sequence of
linear and arc segments on the plane. Although segmented motion follows a flat path, it can
involve any number of axes, because the motion plane can be connected to the axes at any
projection transformation. To use such transformation, use the Projection method.
The method itself does not specify any segment, so the created motion starts only after the first
segment is specified. The segments of motion are specified by using SegmentLine, SegmentArc1,
or SegmentArc2 methods that follow this method.
The motion finishes when the ExtAddPointM method is executed. If the call of
EndSequenceM is omitted, the motion will stop at the last segment of the sequence and wait for
the next segment. No transition to the next motion in the motion queue will occur until the
method EndSequenceM is executed.
The flags ACSC_AMF_EXTRAPOLATED and ACSC_AMF_STALLED are relevant only for slaved motion
and must be used with ACSC_AMF_VELOCITYLOCK or ACSC_AMF_POSITIONLOCK flags.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait and does not validate the end of the motion. To wait for
the motion end, use the WaitMotionEnd method.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 1000, 1000 };
double[] center = { 1000, 0 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Create segmented motion,coordinates of the initial point
// are(1000, 1000)
Ch.Segment(MotionFlags.ACSC_NONE, axes, points);
// Describe circle with center (1000,0), final point
// (1000,-1000) loclwise rotation
Ch.Arc1(axes, center, points,
RotationDirection.ACSC_CLOCKWISE);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.22.2 ExtendedSegmentedMotion
Description

Version 2.70 166


SPiiPlus .NET Library Programmer's Guide
3. Methods

The method initiates a multi-axis extended segmented motion. Extended segmented motion
provides new features:
> Corner detection
> Detection of segments, where required velocity violates axis velocity/accelerationlimits
> Velocity limitation at corners and problematic segments
> Building up velocity profile using multi-segment look-ahead algorithm
Syntax
object.ExtendedSegmentedMotion(MotionFlags flags, Axis[] axes, double[] point, double velocity,
double endVelocity, double junctionVelocity, double angle, double starvationMargin, string
segments);
Async Syntax
object.ExtendedSegmentedMotionAsync(MotionFlags flags, Axis[] axes, double[] point, double
velocity, double endVelocity, double junctionVelocity, double angle, double starvationMargin, string
segments);
Arguments

ACSC_AMF_VELOCITY: The motion will use velocity specified for each


segment instead of the default velocity
ACSC_AMF_ENDVELOCITY: This flag requires additional parameter that
specified end velocity. The controller decelerates to the specified
velocity in the end of segment. The specified value should be less than
the required velocity; otherwise, the parameter is ignored. This flag
affects only one segment. This flag also disables corner detection and
processing at the end of segment. If this flag is not specified,
deceleration is not required. However, in special case the deceleration
might occur due to corner processing or other velocity control
conditions.
ACSC_AMF_MAXIMUM: Use maximum velocity under axis limits. With this
flags suffix, no required velocity should be specified. The required velocity is
calculated for each segment individually on the base of segment
geometry and axis velocities (VEL values) of the involved axes.
ACSC_AMF_JUNCTIONVELOCITY: Decelerate to corner. This flag requires
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 the parameter is ignored. If ACSC_AMF_
JUNCTIONVELOCTY flag is not specified while the ACSC_AMF_ANGLE flag
is specified, a zero value of corner velocity is assumed. If ACSC_AMF_
JUNCTIONVELOCITY and ACSC_AMF_ANGLE flags are not specified, the
controller provides automatic calculation as described in Automatic
Corner Processingof the ACSPL+ Programmer’s Guide.

Version 2.70 167


SPiiPlus .NET Library Programmer's Guide
3. Methods

ACSC_AMF_ANGLE: Do not treat junction as a corner, if junction angle is


less than or equal to the specified value in radians. This flag requires
additional parameter that specifies negligible angle in radians. If ACSC_
AMF_ANGLE flag is not specified while ACSC_AMF_JUNCTIONVELOCITY
flag is specified, the controller accepts default value of 0.01 radians that
is about 0.57 degrees. If none of the ACSC_AMF_JUNCTIONVELOCTY and
ACSC_AMF_ANGLE flags are specified, the controller provides automatic
calculation as described in Automatic corner processing.
ACSC_AMF_WAIT

Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the
axes last axis, one additional element must be included that contains –1 and
marks the end of the array.
For the axis constants see Axis Definitions.

Array of the coordinates of the initial point on the plane. The number
and order of values must correspond to the axes array. The point must
point specify a value for each element of axes except the last
–1 element.

If the ACSC_AMF_VELOCITY flag has been specified, this argument


velocity specifies a motion velocity for the current segment.
Set this argument to Api.ACSC_NONE if not used.

If the ACSC_AMF_ENDVELOCITY flag has been specified, this argument


endVelocity defines the required velocity at the end of the current segment. Set this
argument to Api.ACSC_NONE if not used.

If the ACSC_AMF_JUNCTIONVELOCITY flag has been specified, this


junctionVelocity argument defines the required velocity at the junction.
Set this argument to Api.ACSC_NONE if not used.

If the ACSC_AMF_ANGLE flag has been specified, the junction will be


angle treated as a corner if actual junction angle is more than defined. Set this
argument to Api.ACSC_NONE if not used.

Starvation margin in milliseconds. The controller sets the


AST.#NEWSEGM bit to StarvationMargin milliseconds before the
starvation condition occurs (see SPiiPlus Command& Variable Reference
starvationMargin Guide for details on AST).
Set this argument to Api.ACSC_NONE if not used. By default, if this
argument is not specified, the starvation margin is 500 milliseconds.

Pointer to a buffer that contains the name of a one-dimensional user-


segments
defined array used to store added segments.

Version 2.70 168


SPiiPlus .NET Library Programmer's Guide
3. Methods

Set this argument to NULL if not used. By default, if this argument is not
specified, the controller allocates an internal buffer for storing 50
segments only. The argument allows the user application to reallocate
the buffer for storing a larger number of segments. The larger number
of segmentsmay be required if the application needs to add many very
small segments in advanced.
For most applications, the internal buffer size is enough and does not
need to be enlarged. This buffer is for the controller’s internal use only
and should not be used by the user application.
The buffer size calculation rule: each segment requires about 600 bytes,
so if necessary to allocate the buffer for 200 segments, it should be at
least 600
* 200 = 120,000 bytes. The following declaration defines a 120,000 bytes
buffer:
real buf(15000)
See the XARRSIZE explanation in the SPiiPlus Command & Variable
Reference Guide for details on how to declare a buffer with more than
100,000 elements.

Return Value
None.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 1000, 1000 };
double[] center = { 1000, 0 };
Ch.SetFPosition(Axis.ACSC_AXIS_0, 1000);
Ch.SetFPosition(Axis.ACSC_AXIS_1, 1000);
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
Ch.ExtendedSegmentedMotion(MotionFlags.ACSC_NONE, axes,
points, Api.ACSC_NONE, Api.ACSC_NONE, Api.ACSC_NONE,
Api.ACSC_NONE, Api.ACSC_NONE, null);
points[0] = 1000;
points[1] = -1000;
Ch.Arc1(axes, center, points,
RotationDirection.ACSC_CLOCKWISE);
Ch.EndSequenceM(axes);

Version 2.70 169


SPiiPlus .NET Library Programmer's Guide
3. Methods

3.22.3 SegmentLine
Description
The method adds a linear segment to segmented motion that starts at the current point and ends
at the destination point.
Syntax
object.SegmentLine(MotionFlags flags, Axis[] axes, double[] point, double velocity, double
endVelocity, string values, string variables, int index, string masks)
Async Syntax
object.SegmentLineAsync(MotionFlags flags, Axis[] axes, double[] point, double velocity, double
endVelocity, string values, string variables, int index, string masks)
Arguments

ACSC_AMF_VELOCITY: The motion will use the velocity specified for each
segment instead of the default velocity.
ACSC_AMF_ENDVELOCITY: This flag requires an additional parameter that
specifies the end velocity. The controller decelerates to the specified velocity
at the end of segment. The specified value should be less than the required
velocity; otherwise, the parameter is ignored. This flag affects only one
flags segment. This flag also disables corner detection and processing at the end
of segment. If this flag is not specified, deceleration is not required. However,
in special cases, the deceleration might occur due to corner processing or
other velocity control conditions.
ACSC_AMF_USERVARIABLES: Synchronizes user variables with segment
execution. This flag requires additional parameters that specify values, user
variable and mask.

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_
0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis,
axes one additional element must be included that contains –1 and marks the end
of the array.
For the axis constants see Axis Definitions.

Array of the coordinates of the initial point on the plane. The number and
order of values must correspond to the axes array. The point must specify a
point value for each element of axes except the last
–1 element.

If the ACSC_AMF_VELOCITY flag has been specified, this argument specifies a


velocity motion velocity for current segment.
Set this argument to Api.ACSC_NONE if not used

Version 2.70 170


SPiiPlus .NET Library Programmer's Guide
3. Methods

If the ACSC_AMF_ENDVELOCITY flag has been specified, this argument defines


endVelocity required velocity at the end of the current segment. Set this argument to
Api.ACSC_NONE if not used.

Pointer to the null-terminated character string that contains the name of a


one-dimensional user-defined array of integer or real type with a size of 10
elements maximum.
values If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the user-defined array, which will be written with values data at the
beginning of the current segment execution.
Set this argument to NULL if not used.

Pointer to the null-terminated character string that contains the name of a


one-dimensional user-defined array of the same type and size as values
array.
variables If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the user-defined array, which will be written with values data at the
beginning of the current segmentexecution.
Set this argument to NULL if not used.

If the ACSC_AMF_USERVARIABLES flag is specified, this argument defines the


first element (starting from zero) of variables array, which Values data will be
index written to.
Set this argument to Api.ACSC_NONE if not used.

Pointerto a bufferthat contains the name of aone-dimensional user defined


array of integer type and size as values array.
If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the masks that are applied to values before the values are written to
masks the Variables array at the beginning of the current segment execution. The
masks are only applied for integer values:
Variables(n) = values(n) AND mask(n)
If values is a real array, this argument should be NULL. Set this argument to
NULL if not used.

Return Value
None.
Remarks
The function adds a linear segment that starts in the current point and ends in thedestination point
to segmented motion.
All axes specified in the axes array must be specified before the call of the SegmentedMotion or
ExtendedSegmentedMotion methods. The number and order of the axes in the axes array must

Version 2.70 171


SPiiPlus .NET Library Programmer's Guide
3. Methods

correspond exactly to the number and order of the axes of the SegmentedMotion or
ExtendedSegmentedMotion method.
The point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can call
this function periodically until the function returns a non-zero value.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 1000, 1000 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.SegmentedMotion(MotionFlags.ACSC_AMF_VELOCITY, axes,
points);
points[0] = -1000;
points[1] = -1000;
Ch.SegmentLine(MotionFlags.ACSC_NONE, axes, points,
Api.ACSC_NONE, Api.ACSC_NONE, null, null,
Api.ACSC_NONE, null);
Ch.EndSequenceM(axes);

3.22.4 ExtendedSegmentArc1

This function replaces the SegmentArc1 which is now obsolete.

Description
The method adds an arc segment to a segmented motion and specifies the coordinates of the
center point, the coordinates of the final point and the direction of rotation.
Syntax

object.ExtendedSegmentArc1(MotionFlags flags, Axis[] axes, double[] center,


double[] finalPoint, RotationDirection rotation, double velocity,
double endVelocity, double time, string values, string variables,
int index, string masks)

Async Syntax

object.ACSC_WAITBLOCK ExtendedSegmentArc1Async(MotionFlags flags, Axis[]


axes, double[] center, double[] finalPoint, RotationDirection rotation,
double velocity, double endVelocity, double time, string values,
string variables, int index, string masks)

Version 2.70 172


SPiiPlus .NET Library Programmer's Guide
3. Methods

Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_VELOCITY: The motion will use velocity specified for each segment
instead of the default velocity.
ACSC_AMF_ENDVELOCITY: This flag requires additional parameter that
specifies end velocity. The controller decelerates to the specified velocity in
the end of segment. The specified value should be less than the required
flags velocity; otherwise the parameter is ignored. This flag affects only one
segment. This flag also disables corner detection and processing at the endof
segment. If this flag is not specified, deceleration is not required. However, in
special case the deceleration might occur due to corner processingor other
velocity control conditions.
ACSC_AMF_USERVARIABLES: Synchronize user variables with segment
execution. This flag requires additional parameters that specify values, user
variable and mask.

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_
0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis,
axes one additional element must be included that contains –1 and marks the end
of the array.
For the axis constants see Axis Definitions.

Array of the center coordinates. The number and order of values must
center correspond to the axes array. The center must specify a value for each
element of the axes except the last –1 element.

Array of the final point coordinates. The number and order of values must
finalPoint correspond to the axes array. The finalPoint must specify a value for each
element of axes except the last –1 element.

This parameter defines the direction of rotation.


If rotation is set to ACSC_COUNTERCLOCKWISE, then the rotation is
rotation
counterclockwise.
If rotation is set to ACSC_CLOCKWISE, then rotation is clockwise.

If the ACSC_AMF_VELOCITY flag has been specified, this argument specifies a


velocity motion velocity for current segment.
Set this argument to Api.ACSC_NONE if not used.

If the ACSC_AMF_ENDVELOCITY flag has been specified, this argument defines


endVelocity required velocity at the end of the current segment. Set this argument to
Api.ACSC_NONE if not used.

Version 2.70 173


SPiiPlus .NET Library Programmer's Guide
3. Methods

If ACSC_AMF_VARTIME flag has been specified, this argument defines the


segment processing time in milliseconds, for the current segment only and
time has no effect on subsequent segments.
Set this argument to ACSC_NONE if not used.

Pointer to the null-terminated character string that contains the name of a


one-dimensional user-defined array of integer or real type with a size of 10
elements maximum.
values If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the user-defined array, which will be written with values data at the
beginning of the current segmentexecution.
Set this argument to NULL if not used.

Pointer to the null-terminated character string that contains the name of a


one-dimensional user-defined array of the same type and size as Values
array.
variables If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the user-defined array, which will be written with Values data at the
beginning of the current segmentexecution.
Set this argument to NULL if not used.

If the ACSC_AMF_USERVARIABLES flag is specified, this argument defines the


first element (starting from zero) of variables array, which values data will be
index written to.
Set this argument to Api.ACSC_NONE if not used.

Pointerto a bufferthat contains the name of aone-dimensional user defined


array of integer type and size as values array.
If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the masks that are applied to values before the values are written to
masks the variables array at the beginning of the current segment execution. The
masks are only applied for integer values:
Variables(n) = values(n) AND mask(n)
If values is a real array, this argument should be NULL. Set this argument to
NULL if not used.

Return Value
None.
Remarks
All axes specified in the axes array must be specified before the call of the SegmentedMotion
ExtendedSegmentedMotion methods. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the SegmentedMotion or
ExtendedSegmentedMotion method.

Version 2.70 174


SPiiPlus .NET Library Programmer's Guide
3. Methods

The method waits for the controller response.


The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can call
this method periodically until the method returns non-zero value.
If the method fails, the Error object is filled with the Error Description.

3.22.5 ExtendedSegmentArc2

This function replaces the SegmentArc2Ext which is now obsolete.

Description
The method adds an arc segment to a segmented motion and specifies the coordinates of the
center point and the rotation angle.
Syntax

object.ExtendedSegmentArc2(MotionFlags flags, Axis[] axes, double[] center,


double angle, double[] finalPoint, double velocity, double endVelocity,
double time, string values, string variables, int index, string masks)

Syntax

object.ACSC_WAITBLOCK ExtendedSegmentArc1Async(MotionFlags flags, Axis[]


axes, double[] center, double angle, double[] finalPoint, double velocity,
double endVelocity, double time, string values, string variables,
int index, string masks)

Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_VELOCITY: The motion will use velocity specified for each segment
instead of the default velocity.
ACSC_AMF_ENDVELOCITY: This flag requires additional parameter that
specifies end velocity. The controller decelerates to the specified velocity in
the end of segment. The specified value should be less than the required
velocity; otherwise the parameter is ignored. This flag affects only one
flags segment.
This flag also disables corner detection and processing at the endof segment.
If this flag is not specified, deceleration is not required. However, in special
case the deceleration might occur due to corner processingor other velocity
control conditions.
ACSC_AMF_USERVARIABLES: Synchronize user variables with segment
execution. This flag requires additional parameters that specify values, user
variable and mask.

Version 2.70 175


SPiiPlus .NET Library Programmer's Guide
3. Methods

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_
0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis,
axes one additional element must be included that contains –1 and marks the end
of the array.
For the axis constants see Axis Definitions.

Array of the center coordinates. The number and order of values must
center correspond to the axes array. The center must specify a value for each
element of the axes except the last –1 element.

Rotation angle in radians. Positive angle for counterclockwise rotation,


angle
negative for clockwise rotation.

Array of the final point coordinates. The number and order of values must
finalPoint correspond to the axes array. The finalPoint must specify a value for each
element of axes except the last –1 element.

If the ACSC_AMF_VELOCITY flag has been specified, this argument specifies a


velocity motion velocity for current segment.
Set this argument to Api.ACSC_NONE if not used.

If the ACSC_AMF_ENDVELOCITY flag has been specified, this argument defines


endVelocity required velocity at the end of the current segment. Set this argument to
Api.ACSC_NONE if not used.

If ACSC_AMF_VARTIME flag has been specified, this argument defines the


segment processing time in milliseconds, for the current segment only and
time has no effect on subsequent segments.
Set this argument to ACSC_NONE if not used.

Pointer to the null-terminated character string that contains the name of a


one-dimensional user-defined array of integer or real type with a size of 10
elements maximum.
values If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the user-defined array, which will be written with values data at the
beginning of the current segmentexecution.
Set this argument to NULL if not used.

Pointer to the null-terminated character string that contains the name of a


one-dimensional user-defined array of the same type and size as values
array.
variables If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the user-defined array, which will be written with values data at the
beginning of the current segmentexecution.
Set this argument to NULL if not used.

Version 2.70 176


SPiiPlus .NET Library Programmer's Guide
3. Methods

If the ACSC_AMF_USERVARIABLES flag is specified, this argument defines the


first element (starting from zero) of variables array, which values data will be
index written to.
Set this argument to Api.ACSC_NONE if not used.

Pointerto a bufferthat contains the name of aone-dimensional user defined


array of integer type and size as Values array.
If the ACSC_AMF_USERVARIABLES flag has been specified, this argument
defines the masks that are applied to values before the values are written to
masks the variables array at the beginning of the current segment execution. The
masks are only applied for integer values:
Variables(n) = values(n) AND mask(n)
If values is a real array, this argument should be NULL. Set this argument to
Api.ACSC_NONE if not used.

Return Value
None.
Remarks
The method adds an arc segment to the segmented motion and specifies the coordinates of the
center point and the rotation angle.
All axes specified in the axes array must be specified before the call of the SegmentedMotion
ExtendedSegmentedMotion methods. The number and order of the axes in the axes array must
correspond exactly to the number and order of the axes of the SegmentedMotion or
ExtendedSegmentedMotion method.
The method waits for the controller response.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can call
this method periodically until the method returns a non-zero value.
If the method fails, the Error object is filled with the Error Description.
Example

bool success = true;


Axis[] Axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_AXIS_2,
Axis.ACSC_AXIS_3, Axis.ACSC_NONE };
string res1, res2;

Ch.EnableMAsync(Axes);
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, 5000);
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, 5000);
Ch.SetFPositionAsync(Axes[0], 1000);
Ch.SetFPositionAsync(Axes[1], 1000);
Ch.SetFPositionAsync(Axes[2], 500);
Ch.SetFPositionAsync(Axes[3], 500);

Version 2.70 177


SPiiPlus .NET Library Programmer's Guide
3. Methods

double[] Point1 = { 1000, 1000, 500, 500 };


Ch.ExtendedSegmentedMotion(MotionFlags.ACSC_NONE, Axes, Point1,
Api.ACSC_NONE, Api.ACSC_NONE, Api.ACSC_NONE, Api.ACSC_NONE,
Api.ACSC_NONE, null);

double[] center = { 1000, 0 };


double[] FinalPoint = { 1000, -1000, 500, -500 };
Ch.ExtendedSegmentArc1(MotionFlags.ACSC_NONE, Axes, center, FinalPoint,
RotationDirection.ACSC_CLOCKWISE, Api.ACSC_NONE, Api.ACSC_NONE,
Api.ACSC_NONE, null, null, Api.ACSC_NONE, null);

Point1[0] = -1000; Point1[1] = -1000; Point1[2] = -500; Point1[3] = -500;

Ch.Line(Axes, Point1);

center[0] = -1000; center[1] = 0;


double[] FinalPoint2 = { -500, 500 };
Ch.ExtendedSegmentArc2(MotionFlags.ACSC_NONE, Axes, center, -3.141529,
FinalPoint2, Api.ACSC_NONE, Api.ACSC_NONE, Api.ACSC_NONE, null, null,
Api.ACSC_NONE, null);

Point1[0] = 1000; Point1[1] = 1000; Point1[2] = 500; Point1[3] = 500;

Ch.Line(Axes, Point1);

Ch.EndSequenceMAsync(Axes);

Ch.WaitMotionEnd(Axis.ACSC_AXIS_0, 20000);
Ch.WaitMotionEnd(Axis.ACSC_AXIS_1, 20000);
Ch.WaitMotionEnd(Axis.ACSC_AXIS_2, 20000);
Ch.WaitMotionEnd(Axis.ACSC_AXIS_3, 20000);

3.22.6 Stopper
Description
The method provides a smooth transition between two segments of segmentedmotion.
Syntax
object.Stopper(Axis[] axes)
Async Syntax
object.StopperAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Version 2.70 178


SPiiPlus .NET Library Programmer's Guide
3. Methods

Return Value
None.
Remarks
The controller builds the motion so that the vector velocity follows a smooth velocity diagram. The
segments define the projection of the vector velocity to axis velocities. If all segments are
connected smoothly, axis velocity is also smooth. However, if the user defined a path withan
inflection point, axis velocity has a jump in this point. The jump can cause a motion failure due to
the acceleration limit.
The method is used to avoid velocity jump in the inflection points. If the method is specified
between two segments, the controller provides smooth deceleration to zero in the end of first
segment and smooth acceleration to specified velocity in the beginning of second segment.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 1000, 1000 };
// Create segmented motion,coordinates of the initial point
// are(1000, 1000)
Ch.EnableM(axes);
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
Ch.Segment(MotionFlags.ACSC_NONE, axes, points);
// Add line segment with final point (1000,-1000),vector
// velocity 25000
points[0] = 1000;
points[1] = -1000;
Ch.ExtLine(axes, points, 25000);
Ch.Stopper(axes);
// Add line segment with final point (-1000,-1000),vector
// velocity 25000
points[0] = -1000;
points[1] = -1000;
Ch.ExtLine(axes, points, 25000);
Ch.Stopper(axes);
// Add line segment with final point (-1000,1000),vector
// velocity 25000
points[0] = -1000;
points[1] = 1000;
Ch.ExtLine(axes, points, 25000);
Ch.Stopper(axes);
// Add line segment with final point (1000,1000), vector
// velocity 25000
points[0] = 1000;

Version 2.70 179


SPiiPlus .NET Library Programmer's Guide
3. Methods

points[1] = 1000;
Ch.ExtLine(axes, points, 25000);
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

3.22.7 Projection
Description
The method sets a projection matrix for segmented motion.
Syntax
object.Projection(Axis[] axes, stringmatrix)
Async Syntax
object.ProjectionAsync(Axis[] axes, stringmatrix)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Pointer to the null-terminated string containing the name of the matrix that
matrix
provides the specified projection.

Return Value
None.
Remarks
The method sets a projection matrix for segmented motion.
The projection matrix connects the plane coordinates and the axis values in the axis group. The
projection can provide any transformation as rotation or scaling. The number of the matrix rows
must be equal to the number of the specified axes. The number of the matrix columns must equal
two.
The matrix must be declared before as a global variable by an ACSPL+ program or by the
DeclareVariable method and must be initialized by an ACSPL+ program or by the method. For more
information about projection, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,Axis.ACSC_NONE };


double[] points = {10000,10000};
double[] center = {1000,0}; double[,] matrix = new double[3,2]; matrix

Version 2.70 180


SPiiPlus .NET Library Programmer's Guide
3. Methods

[0,0] = 1;
matrix[0,1] = 0;
matrix[1,0] = 0;
matrix[1,1] = 1.41421;
matrix[2,0] = 0;
matrix[2,1] = 1.41421;
// Declare the matrix that will contain the projection Ch.DeclareVariable
(AcspVariableType.ACSC_REAL_TYPE,”ProjectionMatrix( 3)(2)”);
// Initialize the projection matrix Ch.WriteVariable
(matrix,”ProjectionMatrix”,ProgramBuffer.ACSC_NONE); Ch.EnableM(axes);
// Create a group of the involved axes Ch.Group(axes);
// Create segmented motion,coordinates of the initial point are
(10000,10000)
Ch.Segment(MotionFlags.ACSC_NONE,axes,points);
// Incline the working plance XY by 45 degrees.
Axes = new Axis[] { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
Ch.Projection(axes,”ProjectionMatrix”);
// Describe circle with center (1000, 0) clockwise rotation.
// Althoutgh the circle was defined,really on the plane XY we will get
the// Ellipse stretched along the Y axis
axes = new Axis[] { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,Axis.ACSC_NONE
};
Ch.Arc2(axes, center, -2 * 3.141529);
Ch.EndSequenceM(axes);

Version 2.70 181


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4. Blended Segmented Motion Functions


The Blended Segmented Motion Functions are:

Function Description

BlendedSegmentMotion The function initiates a multi-axis blended segmented motion

The function adds a linear segment that starts at the current


BlendedLine
point and ends at the destination point of segmented motion.

The function adds to the motion path an arc segment that starts
BlendedArc1 at the current point and ends at the destination point with the
specified center point.

The function adds an arc segment to a segmented motion and


BlendedArc2 specifies the coordinates of the center point and the rotation
angle.

4.0.1 BlendedSegmentMotion
Description
The function initiates a multi-axis blended segmented motion.
Syntax
object.BlendedSegmentMotion(MotionFlags flags, Axis[] axes, , double[] Position, double
SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ACSC_
WAITBLOCK wait)
Arguments

Bit-mapped parameter that can include one or more of the following


flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the method
GoM is executed.
ACSC_AMF_VELOCITY: the motion will use velocity specified for each
segment instead of the default velocity.
ACSC_AMF_CYCLIC: the motion uses the segment sequence as a cyclic
flags array: after the last segment, move along the first segment etc.
ACSC_AMF_VELOCITYLOCK: slaved motion: the motion advances in
accordance to the master value of the leading axis.
ACSC_AMF_POSITIONLOCK: slaved motion, strictly conformed to master.
ACSC_AMF_EXTRAPOLATED: if a master value travels beyond the
specified path, the last or the first segment is extrapolated.
ACSC_AMF_STALLED: if a master value travels beyond the specified
path, the motion stalls at the last or first point.

Version 2.70 182


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the
axes last axis, one additional element must be included that contains –1 and
marks the end of the array.
For the axis constants see Axis Definitions.

Array of the starting coordinates. The number and order of values must
Position correspond to the Axes array. The Center must specify a value for each
element of the Axes except the last –1 element.

SegmentTime This parameter will set the default initial segment time in milliseconds.

AccelerationTime This parameter will set the default Acceleration time in milliseconds.

JerkTime This parameter will set the default Jerk time in milliseconds.

If ACSC_AMF_DWELLTIME is set, this parameter will set the initial dwell


time between segments in milliseconds. If this argument is specified,
DwellTime no blending will be done for all segments of the motion. That means
that the motion will be stopped at the end of each segment for the
specified DwellTime milliseconds.

wait Wait block returned by Async method.

Return Value
None.
Remarks
Blended segmented motion is a type of segmented motion that doesn’t provide look-ahead
capabilities, unlike Extended segmented motion. Both type of motions are intended for processing
a complex multi-axis trajectory and smoothing corners between segments, but do it in different
ways. The Extended segmented motion (XSEG) allows achieving highest throughput within the
defined axis limitations and the defined accuracy. The blended segmented motion (BSEG) allows
passing along the trajectory with the defined timing constrains. The function itself does not specify
any movement, so the created motion starts only after the first segment is specified.
The segments of motion are specified by using BlendedLine, BlendedArc1, BlendedArc2functions
that follow this function.
The motion finishes when the EndSequenceM function is executed. If the call to EndSequenceM is
omitted, the motion will stop at the last segment of the sequence and wait for the next segment.
No transition to the next motion in the motion queue will occur until the function EndSequenceM is
executed.
The function can wait for the controller response or can return immediately as specified by the
Wait argument. The controller response indicates that the command was accepted and the motion
was planned successfully. The function does not wait and does not validate the end of the motion.
To wait for the motion end, use the acsc_WaitMotionEnd function.

Version 2.70 183


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example

Axis[] Axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_NONE };

double[] Point = { 1000, 1000 };


Ch.BlendedSegmentMotion(MotionFlags.ACSC_NONE, Axes,
Point,//Starting point of motion
1000, // Segment time
500, // Segment Acceleration time
200, // Segment jerk time
0, //Segment Dwell time
null);// Waiting call

double[] Center = { 1000, 0 };


double[] FinalPoint = { 1000, -1000 };
Ch.BlendedArc1(MotionFlags.ACSC_NONE, Axes, Center, FinalPoint,
RotationDirection.ACSC_CLOCKWISE,
1000, // Segment time
200, // Segment Acceleration time
300, // Segment jerk time
0); //Segment Dwell time

Ch.EndSequenceM(Axes);

4.0.2 BlendedLine
Description
The function adds a linear segment that starts at the current point and ends at the destination
point of segmented motion.
Syntax
int object.BlendedLine(MotionFlags flags, Axis[] axes, double[] point,double SegmentTime,double
AccelerationTime, double JerkTime, double DwellTime
Async Syntax
ACSC_WAITBLOCK object.BlendedLine(MotionFlags flags, Axis[] axes, double[] point, double
SegmentTime,double AccelerationTime, double JerkTime, double DwellTime)
Arguments

Bit-mapped argument that can include one or more of the following


flags:
ACSC_AMF_BSEGTIME: This flag requires an additional parameter that
flags
defines the required segment time in milliseconds.
ACSC_AMF_BSEGACC: This flag requires an additional parameter that
defines the required segment acceleration time in milliseconds.

Version 2.70 184


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_AMF_BSEGJERK: This flag requires an additional parameter that


defines the required jerk time in milliseconds.
ACSC_AMF_DWELLTIME: This flag requires an additional parameter that
specifies the dwell time, in milliseconds, at the final point of the
segment.

Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the
axes last axis, one additional element must be included that contains –1 and
marks the end of the array.
For the axis constants see Axis Definitions.

Array of the final point coordinates. The number and order of values
Point must correspond to the Axes array. The Point must specify a value for
each element of Axes except the last –1 element.

If ACSC_AMF_BSEGTIME is set, this parameter will set the segment time,


SegmentTime in milliseconds, for the current and all following segments – until the
parameter is redefined.

If ACSC_AMF_BSEGACC is set, this parameter will set the Acceleration


AccelerationTime time, in milliseconds, for the current and all following segments – until
the parameter is redefined.

If ACSC_AMF_BSEGJERK is set, this parameter will set the default Jerk


JerkTime time, in milliseconds, for the current and all following segments – until
the parameter is redefined.

If ACSC_AMF_DWELLTIME is set, this parameter will set the initial dwell


time between segments in milliseconds. If this argument is specified,
DwellTime no blending will be done for all segments of the motion. That means
that the motion will be stopped at the end of each segment for the
specified DwellTime milliseconds.

Return Value
None from synchronous version, ACSC_WAITBLOCK from async version.
Remarks
The function adds a linear segment that starts at the current point and ends at the destination
point to segmented motion.
All axes specified in the Axes array must be specified in a previous call to the
BlendedSegmentMotionfunction. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the call to the BlendedSegmentMotion
function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.

Version 2.70 185


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

The function can wait for the controller response or can return immediately as specified by the
Wait argument.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In that case, you can call
this function periodically until the function returns a non-zero value.
Example

Axis[] Axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_NONE };

double[] Point = { 1000, 1000 };


Ch.BlendedSegmentMotion(MotionFlags.ACSC_NONE, Axes,
Point,//Starting point of motion
1000, // Segment time
500, // Segment Acceleration time
200, // Segment jerk time
0, //Segment Dwell time
null);// Waiting call

double[] Center = { 1000, 0 };


double[] FinalPoint = { -1000, -1000 };
Ch.BlendedLine(MotionFlags.ACSC_NONE, Axes,
FinalPoint, 1000, 200, 300, 0);

Ch.EndSequenceM(Axes);

4.0.3 BlendedArc1
Description
The function adds to the motion path an arc segment that starts at the current point and ends at
the destination point with the specified center point.
Syntax
Int object.BlendedArc1(MotionFlags flags, Axis[] axes, double[] center, double[] FinalPoint, int
Rotation, double SegmentTime, double JerkTime, double DwellTime);
Async Syntax
ACSC_WAITBLOCK object.AsyncBlendedArc1(MotionFlags flags, Axis[] axes, double[] center, double[]
FinalPoint, int Rotation, double SegmentTime, double JerkTime, double DwellTime);
Arguments

Bit-mapped argument that can include one or more of the following


flags:
ACSC_AMF_BSEGTIME: This flag requires an additional parameter that
flags
defines the required segment time in milliseconds.
ACSC_AMF_BSEGACC: This flag requires an additional parameter that
defines the required segment acceleration time in milliseconds.

Version 2.70 186


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_AMF_BSEGJERK: This flag requires an additional parameter that


defines the required jerk time in milliseconds.
ACSC_AMF_DWELLTIME: This flag requires an additional parameter that
specifies the dwell time, in milliseconds, at the final point of the
segment.

Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the
axes last axis, one additional element must be included that contains –1 and
marks the end of the array.
For the axis constants see Axis Definitions.

Array of the center coordinates. The number and order of values must
Center correspond to the Axes array. The Center must specify a value for each
element of the Axes except the last–1 element.

Array of the final point coordinates. The number and order of values
FinalPoint must correspond to the Axes array. The FinalPoint must specify a value
for each element of Axes except the last –1 element.

This argument defines the direction of rotation. If Rotation is set to


Rotation ACSC_ COUNTERCLOCKWISE, then the rotation is counterclockwise. If
Rotation is set to ACSC_CLOCKWISE, then rotation is clockwise.

If ACSC_AMF_BSEGTIME is set, this parameter will set the segment time,


SegmentTime in milliseconds, for the current and all following segments – until the
parameter is redefined.

If ACSC_AMF_BSEGACC is set, this parameter will set the Acceleration


AccelerationTime time, in milliseconds, for the current and all following segments – until
the parameter is redefined.

If ACSC_AMF_BSEGJERK is set, this parameter will set the default Jerk


JerkTime time, in milliseconds, for the current and all following segments – until
the parameter is redefined.

If ACSC_AMF_DWELLTIME is set, this parameter will set the dwell time


between segments in milliseconds. If this argument is specified, no
DwellTime blending will be done for all segments of the motion. That means that
the motion will be stopped at the end of each segment for the
specified DwellTime milliseconds.

Return Value
None from synchronous version, ACSC_WAITBLOCK from async version.
Remarks

Version 2.70 187


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

All axes specified in the Axes array must be specified before the call of the
BlendedSegmentMotionfunction. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the BlendedSegmentMotion function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
ACSC_AMF_VELOCITY and ACSC_AMF_VARTIME are mutually exclusive, meaning they cannot be
used together.
The function can wait for the controller response or can return immediately as specified by the
WAIT argument. The controller response indicates that the command was accepted and the
segment is added to the motion buffer. The segment can be rejected if the motion buffer is full. In
that case, you can call this function periodically until the function returns a non-zero value.
Example

Axis[] Axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_NONE };

double[] Point = { 1000, 1000 };


Ch.BlendedSegmentMotion(MotionFlags.ACSC_NONE, Axes,
Point,//Starting point of motion
1000, // Segment time
500, // Segment Acceleration time
200, // Segment jerk time
0, //Segment Dwell time
null);// Waiting call

double[] Center = { 1000, 0 };


double[] FinalPoint = { 1000, -1000 };
Ch.BlendedArc1(MotionFlags.ACSC_NONE, Axes, Center,
FinalPoint, RotationDirection.ACSC_CLOCKWISE,
1000, // Segment time
200, // Segment Acceleration time
300, // Segment jerk time
0); //Segment Dwell time

Ch.EndSequenceM(Axes);

4.0.4 BlendedArc2
Description
The function adds an arc segment to a segmented motion and specifies the coordinates of the
center point and the rotation angle.
Syntax
Int BlendedArc2 (int Flags, int* Axes, double* Center, double Angle, double SegmentTime, double
AccelerationTime, double JerkTime, double DwellTime);
Async Syntax
ACSC_WAITBLOCK acsc_BlendedArc2 (int Flags, int* Axes, double* Center, double Angle, double
SegmentTime, double AccelerationTime, double JerkTime, double DwellTime);

Version 2.70 188


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Arguments

Bit-mapped argument that can include one or more of the following


flags:
ACSC_AMF_BSEGTIME: This flag requires an additional parameter that
defines the required segment time in milliseconds.
ACSC_AMF_BSEGACC: This flag requires an additional parameter that
flags defines the required segment acceleration time in milliseconds.
ACSC_AMF_BSEGJERK: This flag requires an additional parameter that
defines the required jerk time in milliseconds.
ACSC_AMF_DWELLTIME: This flag requires an additional parameter that
specifies the dwell time, in milliseconds, at the final point of the
segment.

Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the
axes last axis, one additional element must be included that contains –1 and
marks the end of the array.
For the axis constants see Axis Definitions.

Array of the center coordinates. The number and order of values must
Center correspond to the Axes array. The Center must specify a value for each
element of the Axes except the last–1 element.

Rotation angle in radians. Positive angle for counterclockwise rotation,


Angle
negative for clockwise rotation.

If ACSC_AMF_BSEGTIME is set, this parameter will set the segment time,


SegmentTime in milliseconds, for the current and all following segments – until the
parameter is redefined.

If ACSC_AMF_BSEGACC is set, this parameter will set the acceleration


AccelerationTime time, in milliseconds, for the current and all following segments – until
the parameter is redefined.

If ACSC_AMF_BSEGJERK is set, this parameter will set the default Jerk


JerkTime time, in milliseconds, for the current and all following segments – until
the parameter is redefined.

If ACSC_AMF_DWELLTIME is set, this parameter will set the dwell time


between segments in milliseconds. If this argument is specified, no
DwellTime blending will be done for all segments of the motion. That means that
the motion will be stopped at the end of each segment for the
specified DwellTime milliseconds.

Return Value
None from synchronous version, ACSC_WAITBLOCK from async version.

Version 2.70 189


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Remarks
All axes specified in the Axes array must be specified before the call of the
BlendedSegmentMotionfunction. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the BlendedSegmentMotion function.
The Center argument specifies the coordinates of the center point. The coordinates are absolute in
the plane.
The function can wait for the controller response or can return immediately as specified by the
WAIT argument. The controller response indicates that the command was accepted and the
segment is added to the motion buffer. The segment can be rejected if the motion buffer is full. In
that case, you can call this function periodically until the function returns a non-zero value.
Example

Axis[] Axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_NONE };

double[] Point = { 1000, 1000 };


Ch.BlendedSegmentMotion(MotionFlags.ACSC_NONE, Axes,
Point,//Starting point of motion
1000, // Segment time
500, // Segment Acceleration time
200, // Segment jerk time
0, //Segment Dwell time
null);// Waiting call

double[] Center = { 1000, 0 };

Ch.BlendedArc2(MotionFlags.ACSC_NONE, Axes, Center,


-3.141529, //Angle
1000, 200, 300, 100);

Ch.EndSequenceM(Axes);

4.1 Points and Segments Manipulation Methods


The Points and Segments Manipulation methods are:
Table 3-26. Points and Segments Manipulation Methods

Method Description

AddPoint Adds a point to a single-axis multi-point or spline motion.

AddPointM Adds a point to a multi-axis multi-point or spline motion.

Adds a point to a single-axis multi-point or spline motion and specifies a


ExtAddPoint
specific velocity or motion time.

Adds a point to a multi-axis multi-point or spline motion and specifies a


ExtAddPointM
specific velocity or motion time.

Version 2.70 190


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Method Description

Informs the controller that no more points will be specified for the
EndSequence
current single-axis motion.

Informs the controller that no more points or segments will be specified


EndSequenceM
for the current multi-axis motion.

4.1.1 AddPoint
Description
The method adds a point to a single axis multi-point or spline motion.
Syntax
object.AddPoint(Axis axis, double point)
Async Syntax
object.AddPointAsync(Axis axis, double point)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

point Coordinate of the added point.

Return Value
None.
Remarks
The method adds a point to a single-axis multi-point or spline motion. To add a point to a multi- axis
motion, use AddPVPointM. To add a point with a specified non-default velocity ortime interval use
ExtAddPoint or ExtAddPointM.
The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns a non-zero value.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


double[] points = { 0, 0 };
Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Create multi-point motion with default velocity and
// dwell 1 ms

Version 2.70 191


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Ch.MultiPoint(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_0, 1);


for (int index = 0; index < 5; index++)
{
Ch.AddPoint(Axis.ACSC_AXIS_0, 100 * index);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

4.1.2 AddPointM
Description
The method adds a point to a multi-axis multi-point or spline motion.
Syntax
object.AddPointM(Axis[] axes, double[] point)
Async Syntax
object.AddPointMAsync(Axis[] axes, double[] point)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Array of the coordinates of added point. The number and order of values must
point correspond to the axes array. point must specify a value for each element of axes
except the last –1 element.

Return Value
None.
Remarks
The method adds a point to a multi-axis multi-point or spline motion. To add a point to a single- axis
motion, use AddPoint. To add a point with a specified non-default velocity or time interval use
ExtAddPoint or ExtAddPointM.
The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns non-zero value.
All axes specified in the axes array must be specified before the call of the MultiPointM or SplineM
method. The number and order of the axes in the axes array must correspond exactly to the
number and order of the axes of MultiPointM or SplineM methods.
If the method fails, the Error object is filled with the Error Description.

Version 2.70 192


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_NONE };
double[] points = { 0, 0 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Create multi-point motion with default velocity without dwell
Ch.MultiPointM(MotionFlags.ACSC_NONE, axes, 0);
// Add some points
for (int index = 0; index < 5; index++)
{
// Position and velocity for each point
points[0] = 100 * index;
points[1] = 200 * index;
Ch.AddPointM(axes, points);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

4.1.3 ExtAddPoint
Description
The method adds a point to a single-axis multi-point or spline motion and specifies a specific
velocity or motion time.
Syntax
object.ExtAddPoint(Axis axis, double point, double rate)
Async Syntax
object.ExtAddPointAsync(Axis axis, double point, double rate)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

point Coordinate of the added point.

If the motion was activated by the MultiPoint method with the ACSC_AMF_VELOCITY
flag, this parameter defines the motion velocity.
rate If the motion was activated by the Spline method with the ACSC_AMF_VARTIME flag,
this parameter defines the time interval between the previous point and the
present one.

Return Value

Version 2.70 193


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

None.
Remarks
The method adds a point to a single-axis multi-point motion with specific velocity or to single- axis
spline motion with a non-uniform time.
To add a point to a multi-axis motion, use ExtAddPointM. To add a point to a motion with default
velocity or uniform time interval, the AddPoint and AddPointM methods aremore convenient.
The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns a non-zero value.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Create multi-point motion, use the velocity specified
// with each point with dwell 1 ms
Ch.MultiPoint(MotionFlags.ACSC_AMF_VELOCITY, Axis.ACSC_AXIS_0,1);
for (int index = 0; index < 5; index++)
{
Ch.ExtAddPoint(Axis.ACSC_AXIS_0, 100 * index, 5000);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

4.1.4 ExtAddPointM
Description
The method adds a point to a multi-axis multi-point or spline motion and specifies aspecific velocity
or motion time.
Syntax
object.ExtAddPointM(Axis[] axes, double[] point, double rate)
Async Syntax
object.ExtAddPointMAsync(Axis[] axes, double[] point, double rate)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Version 2.70 194


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Array of the coordinates of added point. The number and order of values must
point correspond to the axes array. The point must specify a value for each element of
axes except the last –1 element.

If the motion was activated by the MultiPoint method with the ACSC_AMF_VELOCITY
flag, this parameter defines as motion velocity.
rate If the motion was activated by the Spline method with the ACSC_AMF_VARTIME flag,
this parameter defines as time interval between the previous point and the present
one.

Return Value
None.
Remarks
The method adds a point to a multi-axis multi-point or spline motion. To add a point to a single- axis
motion, use ExtAddPoint. To add a point with to a motion with default velocity or uniform time
interval the ExtAddPoint and ExtAddPointM methods are more convenient.
The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns a non-zero value.
All axes specified in the axes array must be specified before calling the MultiPointM or SplineM
methods. The number and order of the axes in the axes array must correspond exactly to the
number and order of the axes of MultiPointM or SplineM methods.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 0, 0 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Create multi-point motion with default velocity without
// dwell
Ch.MultiPointM(MotionFlags.ACSC_AMF_VELOCITY, axes, 0);
// Add some points
for (int index = 0; index < 5; index++)
{
// Position and velocity for each point
points[0] = 100 * index;
points[1] = 100 * index;

Version 2.70 195


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Ch.ExtAddPointM(axes, points, 5000);


}
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

4.1.5 EndSequence
Description
The method informs the controller that no more points will be specified for the current single- axis
motion.
Syntax
object.EndSequence(Axis axis)
Async Syntax
object.EndSequenceAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The motion finishes when the EndSequence method is executed. If the call of EndSequence 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 motion queue will occur until the EndSequence method
executes.The method waits for the controller response.This method applies to the single-axis
multi-point or spline (arbitrary path) motions. If the method fails, the Error object is filled with the
Error Description.
Example

int timeout = 5000;


Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Create multi-point motion with default velocity and dwell
// 1 ms
Ch.MultiPoint(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_0, 1);
for (int index = 0; index < 5; index++)
{
Ch.AddPoint(Axis.ACSC_AXIS_0, 100 * index);
}
// Finish the motion

Version 2.70 196


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

// End of the multi-point motion


Ch.EndSequence(Axis.ACSC_AXIS_0);

4.1.6 EndSequenceM
Description
The method informs the controller that no more points or segments will be specified for the
current multi-axis motion.
Syntax
object.EndSequence(Axis[] axes)
Async Syntax
object.EndSequenceAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
The motion finishes when the EndSequenceM method is executed. If the call of EndSequenceM is
omitted, the motion will stop at the last point or segment of the sequence and wait for the next
point. No transition to the next motion in the motion queue will occur until the EndSequenceM
method executes.
The method waits for the controller response.
This method applies to the multi-axis multi-point, spline (arbitrary path) and segmented motions. If
the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1,
Axis.ACSC_NONE };
double[] points = { 0, 0 };
Ch.EnableM(axes); // Enable axes 0 and 1
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0, 1, timeout);
// Wait axis 1 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_1, 1, timeout);
// Create multi-point motion with default velocity without
// dwell

Version 2.70 197


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Ch.MultiPointM(MotionFlags.ACSC_NONE, axes, 0);


// Add some points
for (int index = 0; index < 5; index++)
{
// Position and velocity for each point
points[0] = 100 * index;
points[1] = 100 * index;
Ch.AddPointM(axes, points);
}
// Finish the motion
// End of the multi-point motion
Ch.EndSequenceM(axes);

4.2 Data Collection Methods


The Data Collection methods are:
Table 3-27. Data Collection Methods

Method Description

DataCollectionExt Initiates data collection.

StopCollect Terminates data collection.

4.2.1 DataCollectionExt
Description
The method initiates data collection.
Syntax
object.DataCollectionExt(DataCollectionFlags flags, [Axis axis,] string array, int nSample, double
period, string vars)
Async Syntax
object.DataCollectionExtAsync(DataCollectionFlags flags, [Axis axis,] string array, int nSample,
double period, string vars)
Arguments

Bit-mapped parameter that can include one or more of the following flags:
ACSC_DCF_SYNC – Start data collection synchronously to a motion.
ACSC_DCF_ WAIT – Create the synchronous data collection, but do not start until
the Go method is called. This flag can only be used with the ACSC_DCF_SYNC flag.
flags
ACSC_DCF_TEMPORAL – Temporal data collection. The sampling period is
calculated automatically according to the collection time.
ACSC_DCF_CYCLIC – Cyclic data collection uses the collection array as a cyclic
buffer and continues infinitely. When the array is full, each new sample
overwrites the oldest sample in the array.

Version 2.70 198


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Axis constant of the axis to which the data collection must be synchronized:
ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc. For the
axis axis constants see Axis Definitions.
This argument is required only for axis data collection (ACSC_DCF_SYNC flag).

Name of the array that stores the collected samples.


array The array must be declared as a global variable by an ACSPL+ program or by the
DeclareVariable method.

nSample Number of samples to be collected.

Sampling period in milliseconds.


period If the ACSC_DCF_TEMPORAL flag is specified, this parameter defines a minimum
period.

The string contains chained names of the variables, separated by ‘\r’(13)


character. The values of these variables will be collected in the array. If variable
vars
name specifies an array, the name must be supplemented with indexes in order
to specify one element of the array.

Return Value
None.
Remarks
Data collection started by this method without the ACSC_DCF_SYNC flag is called system data
collection.
Data collection started with the ACSC_DCF_SYNC flag, is called axis data collection.
Data collection started with ACSC_DCF_CYCLIC flag, 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 calling the StopCollect method.
The array that stores the samples can be one or two-dimensional. A one-dimensional array is
allowed only if the variable list contains one variable name.
The number of the array rows must be equal to or more than the number of variables inthe
variable list. The number of the array columns must be equal to or more than the number of
samples specified by the nSample argument.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous call example


Ch.DataCollectionExt(DataCollectionFlags.ACSC_DCF_WAIT,

Version 2.70 199


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Axis.ACSC_AXIS_0, "MyArrayForDC", 100, 100,


"FPOS(0)\rFVEL(0)\rFACC(0)");
// Asynchronous call example
ACSC_WAITBLOCK wb =
Ch.DataCollectionExtAsync(DataCollectionFlags.ACSC_DCF_WAIT,
Axis.ACSC_AXIS_0, "MyArrayForDC", 100, 100,
"FPOS(0)\rFVEL(0)\rFACC(0)");
Object o = Ch.GetResult(wb, 2000);

4.2.2 StopCollect
Description
The method terminates data collection.
Syntax
object.StopCollect()
Async Syntax
object.StopCollectAsync()
Arguments
None.
Return Value
None.
Remarks
The usual system data collection finishes when the required number of samples is collected or the
StopCollect method is executed. The application can wait for data collection end withthe
WaitCollectEndExt method.
The temporal data collection runs until the StopCollect method is executed.
The method terminates the data collection prematurely. The application can determine the
number of actually collected samples from the S_DCN variable and the actual sampling period from
the S_DCP variable.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


string ArrayName = “DCA(2)(1000)”; // Matrix with dimensions 2x1000
// Positions of axes 0 and 1 will be collected
string vars = “FPOS(0) & Chr$(13)& FPOS(1)”
Ch.Enable(Axis.ACSC_AXIS_0); // Enable axis 0
// Wait axis 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0,1,timeout);
Ch.ExtToPoint(MotionFlags.ACSC_AMF_VELOCITY | MotionFlags.ACSC_AMF_
ENDVELOCITY, Axis.ACSC_AXIS_0,10000,5000,1000);
// Array to collect
Ch.DeclareVariable(AcspVariableType.ACSC_REAL_TYPE,ArrayName);

Version 2.70 200


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Ch.CollectB(DataCollectionFlags.ACSC_NONE, ArrayName,1000,1,vars);
// Stop Collect Ch.StopCollect();
// Finish the motion
// End of the multi-point motion
Ch.EndSequence(Axis.ACSC_AXIS_0);

4.3 Status Report Methods


The Status Report methods are:
Table 3-28. Status Report Methods

Method Description

GetMotorState Retrieves the current motor state.

GetAxisState Retrieves the current axis state.

GetIndexState Retrieves the current state of the index and mark variables.

ResetIndexState Resets the specified bit of the index/mark state.

GetProgramState Retrieves the current state of the program buffer.

4.3.1 GetMotorState
Description
The method retrieves the current motor state.
Syntax
object.GetMotorState(Axis axis)
Async Syntax
object.GetMotorStateAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Remarks
The retrieved value can include one or more of the following flags:
ACSC_MST_ENABLE - a motor is enabled
ACSC_MST_INPOS - a motor has reached a target position
ACSC_MST_MOVE - a motor is moving
ACSC_MST_ACC - a motor is accelerating
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 201


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

// Synchronous get motor state


MotorStates state = Ch.GetMotorState(Axis.ACSC_AXIS_0);

// Asynchronous get motor state


ACSC_WAITBLOCK wb = Ch.GetMotorStateAsync(Axis.ACSC_AXIS_0);
MotorStates state1 = (MotorStates)Ch.GetResult(wb, 2000);

4.3.2 GetAxisState
Description
The method retrieves the current axis state.
Syntax
object.GetAxisState(Axis axis)
Async Syntax
object.GetAxisStateAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
AxisStates
Remarks
The Return Value can comprise one or more flags. For Example, ACSC_AST_LEAD (leading axis),
ACSC_AST_DC (data collection in progress for the axis), etc. For the complete list of flags, see Axis
State Flags.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous get axis state


AxisStates state = Ch.GetAxisState(Axis.ACSC_AXIS_0);

// Asynchronous get axis state


ACSC_WAITBLOCK wb = Ch.GetAxisStateAsync(Axis.ACSC_AXIS_0);
AxisStates state1 = (AxisStates)Ch.GetResult(wb, 2000);

4.3.3 GetIndexState
Description
The method retrieves the current set of bits that indicate the index and mark state.
Syntax
object.GetIndexState(Axis axis)

Version 2.70 202


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Async Syntax
object.GetIndexStateAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
IndexStates
Remarks
The Return Value can include one or more of the following flags:
ACSC_IST_IND – a primary encoder index of the specified axis is latched
ACSC_IST_IND2 – a secondary encoder index of the specified axis is latched
ACSC_IST_MARK – a MARK1 signal has been generated and position of the specified axis was
latched
ACSC_IST_MARK2 – a MARK2 signal has been generated and position of the specified axis was
latched
The controller processes index/mark signals as follows:
When an index/mark signal is encountered for the first time, the controller latches feedback
positions and raises the corresponding bit. As long as a bit is raised, the controller does not latch
feedback position even if the signal occurs again. Toresume latching logic, the application must call
ResetIndexState to explicitly reset the corresponding bit.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous get index state


IndexStates state = Ch.GetIndexState(Axis.ACSC_AXIS_0);

// Asynchronous get index state


ACSC_WAITBLOCK wb = Ch.GetIndexStateAsync(Axis.ACSC_AXIS_0);
IndexStates state1 = (IndexStates)Ch.GetResult(wb, 2000);

4.3.4 ResetIndexState
Description
The method resets the specified bit of the index/mark state.
Syntax
object.ResetIndexState(Axis axis, IndexStates mask)
Async Syntax
object.ResetIndexStateAsync(Axis axis, IndexStates mask)
Arguments

Version 2.70 203


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

The parameter contains bit to be cleared. Only one of the following flags can be
specified:
ACSC_IST_IND – a primary encoder index of the specified axis is latched
ACSC_IST_IND2 – a secondary encoder index of the specified axis is latched
mask
ACSC_IST_MARK – a MARK1 signal has been generated and position of the specified
axis was latched
ACSC_IST_MARK2 – a MARK2 signal has been generated and position of the
specified axis was latched

Return Value
None.
Remarks
The method resets the specified bit of the index/mark state. mask contains a bit that must be
cleared, i.e., the method resets only that bit of the index/mark state, which corresponds to non-
zero bit of mask. To get the current index/mark state, use the GetIndexState method.
If the method fails, the Error object is filled with the Error Description.
Example

// Resets the specified bit of the index/mark state


Ch.ResetIndexState(Axis.ACSC_AXIS_0, IndexStates.ACSC_IST_IND);
Ch.ResetIndexState(Axis.ACSC_AXIS_0, IndexStates.ACSC_IST_IND2);
Ch.ResetIndexState(Axis.ACSC_AXIS_0, IndexStates.ACSC_IST_MARK);
Ch.ResetIndexState(Axis.ACSC_AXIS_0, IndexStates.ACSC_IST_MARK2);
IndexStates state = Ch.GetIndexState(Axis.ACSC_AXIS_0);

4.3.5 GetProgramState
Description
The method retrieves the current state of the program buffer.
Syntax
object.GetProgramState(ProgramBuffer buffer)
Async Syntax
object.GetProgramStateAsync(ProgramBuffer buffer)
Arguments

buffer Number of the buffer in which the program resides.

Return Value
ProgramStates

Version 2.70 204


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Remarks
The retrieved value can include one or more of the following flags:
ACSC_PST_COMPILED – a program in the specified buffer is compiled
ACSC_PST_RUN – a program in the specified buffer is running
ACSC_PST_AUTO – an auto routine in the specified buffer is running
ACSC_PST_DEBUG – a program in the specified buffer is executed in debug mode, i.e. breakpoints
are active
ACSC_PST_SUSPEND – a program in the specified buffer is suspended after the step execution or
due to breakpoint in debug mode
If the method fails, the Error object is filled with the Error Description.
Example

// Appends 2 lines to buffer 0


Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_0, "!Empty buffer");
Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_0, "stop");
//Run buffer 0
Ch.RunBuffer(ProgramBuffer.ACSC_BUFFER_0, null);
// Retrieves the current state of the program buffer
ProgramStates pstate = Ch.GetProgramState(
ProgramBuffer.ACSC_BUFFER_0);

4.4 Inputs/Outputs Access Methods


The Inputs/Outputs Access methodsare:
Table 3-29. Inputs/Outputs Access Methods

Method Description

GetInput Retrieves the current state of the specified digital input.

GetInputPort Retrieves the current state of the specified digital input port.

GetOutput Retrieves the current state of the specified digital output.

GetOutputPort Retrieves the current state of the specified digital output port.

SetOutput Sets the specified digital output to the specified value.

SetOutputPort Sets the specified digital output port to the specified value.

GetAnalogInputNT Retrieves the current value of the specified analog input.

GetAnalogOutputNT Retrieves the current value of the specified analog output.

SetAnalogOutputNT Writes the specified value to the specified analog output.

Version 2.70 205


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Method Description

GetExtInput Retrieves the current state of the specified extended input.

GetExtInputPort Retrieves the current state of the specified extended input port.

GetExtOutput Retrieves the current state of the specified extended output.

GetExtOutputPort Retrieves the current state of the specified extended output port.

SetExtOutput Sets the specified extended output to the specified value.

SetExtOutputPort Sets the specified extended output port to the specified value.

4.4.1 GetInput
Description
The method retrieves the current state of the specified digital input.
Syntax
object.GetInput(int port, int bit)
Async Syntax
object.GetInputAsync(int port, int bit)
Arguments

port Number of the input port.

bit Number of the specific bit.

Return Value
Int32.
The method retrieves the current state of the specified digital input.
Remarks
To get values of all inputs of the specific port, use the GetInputPort method.
Digital inputs are represented in the controller variable IN. For more information about digital
inputs, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 2000;


// Synchronous call example
// The method reads input 0 of port 0 (IN(0).0)
int port = Ch.GetInput(0, 0);
// Asynchronous call example

Version 2.70 206


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_WAITBLOCK wb = Ch.GetInputAsync(0, 0);


int port1 = (int)Ch.GetResult(wb, timeout);

4.4.2 GetInputPort
Description
The method retrieves the current state of the specified digital input port.
Syntax
object.GetInputPort(int port)
Async Syntax
object.GetInputPortAsync(int port)
Arguments

port Number of the input port.

Return Value
Int32.
Remarks
To get the value of the specific input of the specific port, use the GetInput method.
Digital inputs are represented in the controller variable IN. For more information about digital
inputs, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

int[] port = new int[16];


// The method reads input port 0 to 15 ( IN(0) to IN(15) )
for (int index = 0; index < port.Length; index++)
{
port[index] = Ch.GetInputPort(index);
}

4.4.3 GetOutput
Description
The method retrieves the current state of the specified digital output.
Syntax
object.GetOutput(int port, int bit)
Async Syntax
object.GetOutputAsync(int port, int bit)
Arguments

Version 2.70 207


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

port Number of the output port.

bit Number of the specific bit.

Return Value
Int32.
Remarks
To get values of all outputs of the specific port, use GetExtOutputPort.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous call example


// The method reads output 0 of port 0 ( OUT(0).0 )
int port = Ch.GetOutput(0, 0);
// Asynchronous call example
int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetOutputAsync(0, 0);
int port1 = (int)Ch.GetResult(wb, timeout);

4.4.4 GetOutputPort
Description
The method retrieves the current state (0 or 1) of the specified digital output port.
Syntax
object.GetOutputPort(int port)
Async Syntax
object.GetOutputPortAsync(int port)
Arguments

port Number of the output port.

Return Value
Int32.
Remarks
To get the value of the specific output of the specific port, use GetOutput.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 208


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

int[] port = new int[16];


// The method reads output port 0 to 15 ( OUT(0) to OUT(15) )
for (int index = 0; index < port.Length; index++)
{
port[index] = Ch.GetOutputPort(index);
}

4.4.5 SetOutput
Description
The method sets the specified digital output to the specified value.
Syntax
object.SetOutput(int port, int bit, int value)
Async Syntax
object.SetOutputAsync(int port, int bit, int value)
Arguments

port Number of the output port.

bit Number of the specific bit.

The value to be writes to the specified output. Any non-zero value is interpreted as
value
1.

Return Value
None.
Remarks
The method sets the specified digital output to the specified value. To set values of all outputs of a
specific port, use the SetOutputPort method.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous call example


// The method sets output 0 of port 0 to 1
// ACSPL+ equivalent: OUT(0).0 = 1
Ch.SetOutput(0, 0, 1);

4.4.6 SetOutputPort
Description
The method sets the specified digital output port to the specified value.
Syntax

Version 2.70 209


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

object.SetOutputPort(int port, int value)


Async Syntax
object.SetOutputPortAsync(int port, int value)
Arguments

port Number of the digital output port.

value The value to be writen to the specified port.

Return Value
None.
Remarks
The method sets the specified digital output port to the specified value. To set the value of the
specific output of the specific port, use the SetOutput method.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// The method sets outputs 0 to 15 to 100


for (int index = 0; index < 16; index++)
Ch.SetOutputPort(index, 100);

4.4.7 GetAnalogInputNT
Description
The function retrieves the current value of the specified analog input.
Syntax
object.GetAnalogInputNT(int port)
Async Syntax
object.GetAnalogInputNTAsync(int port)
Arguments

Index of analog input port - a number between 0 and up to the maximum number of
port
analog input signals minus one.

Return Value
Double.
Variable that receives the current value of a specific analog input. Units: in scaling, by percent, of
the signal and ranges from -100 to +100 of the maximum level.
Remarks

Version 2.70 210


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

The function retrieves the current value of specified analoginput.


Analog inputs are represented in the controller variable AIN. For more information about analog
inputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous call example


double value = Ch.GetAnalogInputNT(0);
// Asynchronous call example
int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetAnalogInputNTAsync(0);
double value1 = (double)Ch.GetResult(wb, timeout);

4.4.8 GetAnalogOutputNT
Description
The function retrieves the current value of the specified analog output.
Syntax
object.GetAnalogOutputNT(int port)
Async Syntax
object.GetAnalogOutputNTAsync(int port)
Arguments

Index of analog output port - a number between 0 and up to the maximum number
port
of analog output signals minus one.

Return Value
Double.
Variable that receives the current value of a specific analog output. Units: in scaling, by percent, of
the signal and ranges from -100 to +100 of the maximum level.
Remarks
The method retrieves the current value of the specified analog output. To write a value to the
specific analog outputs use the SetAnalogOutputNTmethod.
Analog outputs are represented in the controller variable AOUT. For more information about
analog outputs, see SPiiPlus ACSPL+ Programmer's Guide.
Example

// Synchronous call example


double value = Ch.GetAnalogOutputNT(0);
// Asynchronous call example
int timeout = 2000;

Version 2.70 211


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_WAITBLOCK wb = Ch.GetAnalogOutputNTAsync(0);
double value1 =(double)Ch.GetResult(wb, timeout);

4.4.9 SetAnalogOutputNT
Description
The function writes the specified value to the specified analog output.
Syntax
object.SetAnalogOutputNT(int port, double value)
Async Syntax
object.SetAnalogOutputNTAsync(int port, double value)
Arguments

Index of analog output port - a number between 0 and up to the maximum number
port
of analog output signals minus one.

The value to be written to the specified analog output. Units: in scaling, by percent,
value
of the signal and ranges from -100 to +100 of the maximum level.

Return Value
None.
Remarks
The function writes the specified value to the specified analog outputs. To get a value of the
specific analog output, use the GetAnalogOutputNT method.
Analog outputs are represented in the controller variable AOUT. For more information about
analog outputs, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// The method writes the value 100 to the analog outputs of port outputs
// 0 to 15
for (int index = 0; index < 16; index++)
{
Ch.SetAnalogOutputNT(index,100);
}

4.4.10 GetExtInput
Description
The method retrieves the current state of the specified extendedinput.
Syntax
object.GetExtInput(int port, int bit)

Version 2.70 212


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Async Syntax
object.GetExtInputAsync(int port, int bit)
Arguments

port Number of the extended input port.

bit Number of the specific bit.

Return Value
Int32.
The method retrieves the current state (0 or 1) of the extended input specified by port and bit.
Remarks
To get that states for all the inputs of the specific extended port, use the GetExtInputPort method.
Extended inputs are represented in the controller variable EXTIN. For more information about
extended inputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous call example


// The method reads extended input 0 of port 0 ( EXTIN(0).0 )
int port = Ch.GetExtInput(0, 0);

// Asynchronous call example


int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetExtInput(0,0);
int port1 = (int)Ch.GetResult(wb, timeout);

4.4.11 GetExtInputPort
Description
The method retrieves the current state of the specified extended input port.
Syntax
object.GetExtInputPort(int port)
Async Syntax
object.GetExtInputPortAsync(int port)
Arguments

port Number of the extended input port.

Return Value
Int32.
Remarks

Version 2.70 213


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

To get the value of a specific input of the specific extended port, use the GetExtInput method.
Extended inputs are represented in the controller variable EXTIN. For more information about
extended inputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

int[] port = new int[16];


// The method reads input extended input port 0 to 15
// ( EXTIN(0) to EXTIN(15) )
for (int index = 0; index < port.Length; index++)
{
port[index] = Ch.GetExtInputPort(index);
}

4.4.12 GetExtOutput
Description
The method retrieves the current state of the specified extended output.
Syntax
object.GetExtOutput(int port, int bit)
Async Syntax
object.GetExtOutputAsync(int port, int bit)
Arguments

port Number of the extended output port.

bit Number of the specific bit.

Return Value
Int32.
The method retrieves the current state (0 or 1) of the specified extended output.
Remarks
To get values of all outputs of the specific extended port, use the GetExtOutputPort method.
Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Synchronous call example


// The method reads extended output 0 of port 0 ( EXTOUT(0).0 )

int port = Ch.GetExtOutput(0,0);

Version 2.70 214


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4.4.13 GetExtOutputPort
Description
The method retrieves the current state of the specified extended output port.
Syntax
object.GetExtOutputPort(int port)
Async Syntax
object.GetExtOutputPortAsync(int port)
Arguments

port Number of the extended output port.

Return Value
Int32.
The method retrieves the current state (0 or 1) of the specified extended output port.
Remarks
To get the value of the specific output of the specific extended port, use the GetExtOutput
method.
Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

int[] port = new int[16];


// The method reads input extended output port 0 to 15
// ( EXTOUT(0) to EXTOUT(15) )
for (int index = 0; index < port.Length; index++)
{
port[index] = Ch.GetExtOutputPort(index);
}

4.4.14 SetExtOutput
Description
The method sets the specified extended output to the specified value.
Syntax
object.SetExtOutput(int port, int bit, int value)
Async Syntax
object.SetExtOutputAsync(int port, int bit, int value)
Arguments

Version 2.70 215


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

port Number of the extended output port.

bit Number of the specific bit.

The value to be written to the specified output. Any non-zero value is interpreted
value
as 1.

Return Value
None.
Remarks
The method sets the specified extended output to the specified value. To set values of all outputs
of the specific extended port, use the SetExtOutputPort method.
Extended outputs are represented in the controller EXTOUT variable. For more information about
extended outputs, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// The method sets output 0 of extended port 0 to 1


// ACSPL+ equivalent: EXTOUT(0).0 = 1

Ch.SetExtOutput(0,0,1);

4.4.15 SetExtOutputPort
Description
The method sets the specified extended output port to the specified value.
Syntax
object.SetExtOutputPort(int port, int value)
Async Syntax
object.SetExtOutputPortAsync(int port, int value)
Arguments

port Number of the extended output port.

value The value to be written to the specified output port.

Return Value
None.
Remarks
The method sets the specified extended output port to the specified value. To set the value of the
specific output of the specific extended port, use the SetExtOutput method.

Version 2.70 216


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see the SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// The method sets outputs of extended port 0 to 15 to 100


for (int index = 0; index < 16; index++)
{
Ch.SetExtOutputPort(index, 100);
}

4.5 Safety Control Methods


The Safety Control methods are:
Table 3-30. Safety Control Methods

Method Description

GetFault Retrieves the set of bits that indicate the motor or system faults.

Sets the mask that enables/disables the examination and


SetFaultMask
processing of the controller faults.

Retrieves the mask that defines which controller faults are


GetFaultMask
examined and processed.

EnableFault Enables the specified axis or system fault.

DisableFault Disables the specified axis or system fault.

Sets the mask that defines for which axis or system faults the
SetResponseMask
controller provides default response.

Retrieves the mask that defines for which axis or system faults the
GetResponseMask
controller provides default response.

EnableResponse Enables the default response to the specified axis or system fault.

DisableResponse Disables the default response to the specified axis or system fault.

GetSafetyInput Retrieves the current state of the specified safety input.

GetSafetyInputPort Retrieves the current state of the specified safety input port.

Retrieves the set of bits that define inversion for the specified
GetSafetyInputPortInv
safety input port.

Version 2.70 217


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Method Description

Sets the set of bits that define inversion for the specified safety
SetSafetyInputPortInv
input port.

The method clears the current faults and results of previous faults
FaultClear
stored in the MERR variable.

The method clears the current faults and results of previous faults
FaultClearM
stored in the MERR variable for multiple axis.

4.5.1 GetFault
Description
The method retrieves the set of bits that indicate the motor or system faults.
Syntax
object.GetFault(Axis axis)
Async Syntax
object.GetFaultAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
SafetyControlMasks.
The method retrieves the set of bits that indicate motor or system faults.
Remarks
The motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, or Driver Alarm.
The system faults are not related to any specific motor. For Example: Emergency Stop or Memory
Fault.
The parameter fault receives the set of bits that indicates the controller faults. To recognize the
specific fault, properties ACSC_SAFETY_*** can be used. See Safety Control Masks for a detailed
description of these properties.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer's Guide. If
the method fails, the Error object is filled with the Error Description.
Example

// Retrieves the set of bits that indicate the motor or


system

Version 2.70 218


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

// faults
SafetyControlMasks fault = Ch.GetFault(Axis.ACSC_AXIS_0);

4.5.2 SetFaultMask
Description
The method sets the mask that enables or disables the examination and processing of the
controller faults.

Certain controller faults provide protection against potential serious bodily injury and
damage to the equipment. Be aware of the implications before disabling any alarm,
limit, or error.

Syntax
object.SetFaultMask(Axis axis, SafetyControlMasks mask)
Async Syntax
object.SetFaultMaskAsync(Axis axis, SafetyControlMasks mask)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

The mask to be set:


If a bit of the mask is zero, the corresponding fault is disabled.

mask To set/reset a specified bit, use ACSC_SAFETY_*** properties. See Safety Control
Masks for a detailed Description of these properties.
If the mask is ACSC_ALL, then all the faults for the specified axis are enabled. If the
mask is ACSC_NONE, then all the faults for the specified axis are disabled.

Return Value
None.
Remarks
The method sets the mask that enables/disables the examination and processing ofthe controller
faults. The two types of controller faults are motor faults and system faults.
The motor faults are related to a specific motor, the power amplifier or the Servo processor. For
example: Position Error, Encoder Error or Driver Alarm.
The system faults are not related to any specific motor. For example: Emergency Stop or Memory
Fault.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer's Guide. If
the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 219


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

// Enable all faults of axis 0


Ch.SetFaultMask(Axis.ACSC_AXIS_0, SafetyControlMasks.ACSC_ALL);

4.5.3 GetFaultMask
Description
The method retrieves the mask that defines which controller faults are examined and processed.
Syntax
object.GetFaultMask(Axis axis)
Async Syntax
object.GetFaultMaskAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
SafetyControlMasks.
The method retrieves the mask that defines which controller faults are examined and processed.
Remarks
If a bit of the mask is zero, the corresponding fault is disabled.
Use the ACSC_SAFETY_*** properties to examine a specific bit. See Safety Control Masks for a
detailed description of these properties.
Controller faults are of two types: motor faults and system faults.
The motor faults are related to a specific motor, the power amplifier or the Servo processor. For
example: Position Error, Encoder Error or Driver Alarm.
The system faults are not related to any specific motor, for example: Emergency Stop or Memory
Fault.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer's Guide. If
the method fails, the Error object is filled with the Error Description.
Example

// Retrieves the mask that defines which controller Faults are examined
// and processed of axis 0
SafetyControlMasks mask= Ch.GetFaultMask(Axis.ACSC_AXIS_0);

4.5.4 EnableFault
Description>
The method enables the specified axis or system fault.
Syntax

Version 2.70 220


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

object.EnableFault(Axis axis, SafetyControlMasks fault)


Async Syntax
object.EnableFaultAsync(Axis axis, SafetyControlMasks fault)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

The fault to be enabled. Only one fault can be enabled at atime.


fault To specify the fault, one of the properties ACSC_SAFETY_*** can be used. See Safety
Control Masks for a detailed description of these properties.

Return Value
None.
Remarks
The method enables the examination and processing of the specified motor or system fault by
setting the specified bit of the fault mask to one.
The motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, and Driver Alarm.
The system faults are not related to any specific motor. For example: Emergency Stop, Memory
Fault. For more information about the controller faults, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Enable fault Right Limit of axis 0


Ch.EnableFault(Axis.ACSC_AXIS_0,SafetyControlMasks.ACSC_SAFETY_RL);

4.5.5 DisableFault
Description
The method disables the specified axis or system fault.

Certain controller faults provide protection against potential serious bodily injury and
damage to equipment. Be aware of the implications before disabling any alarm, limit,
or error.

Syntax
object.DisableFault(Axis axis, SafetyControlMasks fault)
Async Syntax
object.DisableFaultAsync(Axis axis, SafetyControlMasks fault)
Arguments

Version 2.70 221


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

The fault to be disabled. Only one fault can be enabled at a time.


fault To specify the fault, one of the properties ACSC_SAFETY_*** can be used. See Safety
Control Masks for a detailed description of these properties.

Return Value
None.
Remarks
The method disables the examination and processing of the specified motor or system fault by
setting the specified bit of the fault mask to zero.
The motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, and Driver Alarm.
The system faults are not related to any specific motor, for example: Emergency Stop, Memory
Fault. For more information about the controller faults, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Disable fault Software Right Limit in axis 0


Ch.DisableFault(Axis.ACSC_AXIS_0,SafetyControlMasks.ACSC_SAFETy_RL);

4.5.6 SetResponseMask
Description
The method retrieves the mask that defines the motor or the system faults for which the
controller provides the default response.

Certain controller faults provide protection against potential serious bodily injury and
damage to the equipment. Be aware of the implications before disabling any alarm,
limit, or error.

Syntax
object.SetResponseMask(Axis axis, SafetyControlMasks mask)
Async Syntax
object.SetResponseMaskAsync(Axis axis, SafetyControlMasks mask)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

mask The mask to be set:

Version 2.70 222


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

If a bit of the mask is zero, the corresponding fault is disabled.


To set/reset a specified bit, use ACSC_SAFETY_*** properties. See Safety Control
Masks for a detailed description of these properties.
If the mask is ACSC_ALL, then all the faults for the specified axis are enabled.If the
mask is ACSC_NONE, then all the faults for the specified axis are disabled.

Return Value
None.
Remarks
The method retrieves the mask that defines the motor or the system faults for which the
controller provides the default response.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see the SPiiPlus ACSPL+
Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Enable all default responses


Ch.SetResponseMask(Axis.ACSC_AXIS_0,
SafetyControlMasks.ACSC_SAFETY_AL);

4.5.7 GetResponseMask
Description
The method retrieves the mask that defines the motor or the system faults for which the
controller provides the defaultresponse.
Syntax
object.GetResponseMask(Axis axis)
Async Syntax
object.GetResponseMaskAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
SafetyControlMasks.
Remarks
The method retrieves the mask that determines whether the controller will respond to a motor or
system fault with the fault's default response.

Version 2.70 223


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

For more information about the controller faults and default, responses see the SPiiPlus ACSPL+
Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Retrieves the mask of axis 0

SafetyControlMasks mask = Ch.GetResponseMask(Axis.ACSC_AXIS_0);

4.5.8 EnableResponse
Description
The method enables the response to the specified axis or systemfault.
Syntax
object.EnableResponse(Axis axis, SafetyControlMasks response)
Async Syntax
object.EnableResponseAsync(Axis axis, SafetyControlMasks response)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

The default response to be enabled. Only one default response can be enabled
at a time.
response
To specify the default response, one of the properties ACSC_SAFETY_*** can be
used. See Safety Control Masks for a detailed description of these properties.

Return Value
None.
Remarks
The method enables the default response to the specified axis or system fault by setting the
specified bit of the response mask to one.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see SPiiPlus ACSPL+ Programmer's
Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Enable the default response to the Position Error fault of axis 0

Ch.EnableResponse(Axis.ACSC_AXIS_0,SafetyControlMasks.ACSC_SAFETY_PE);

Version 2.70 224


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4.5.9 DisableResponse
Description
The method disables the default response to the specified axis or system fault.

Certain controller faults provide protection against potential serious bodily injury and
damage to equipment. Be aware of the implications before disabling any alarm, limit,
or error.

Syntax
object.DisableResponse(Axis axis, SafetyControlMasks response)
Async Syntax
object.DisableResponseAsync(Axis axis, SafetyControlMasks response)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

The default response to be disabled. Only one default response can be enabled
at a time.
response
To specify the default response, one of the properties ACSC_SAFETY_*** can be
used. See Safety Control Masks for a detailed description of these properties.

Return Value
None.
Remarks
The method disables the default response to the specified motor or system fault by setting the
specified bit of the response mask to zero.
The default response is a controller-predefined action for the corresponding fault. Formore
information about the controller faults and default responses, see SPiiPlus ACSPL+ Programmer's
Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// Disable the default response to the Right Limit fault

Ch.DisableResponse(Axis.ACSC_AXIS_0,SafetyControlMasks.ACSC_SAFETY_RL);

4.5.10 GetSafetyInput
Description
The method retrieves the current state of the specified safety input.
Syntax

Version 2.70 225


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

object.GetSafetyInput(Axis axis, SafetyControlMasks input)


Async Syntax
object.GetSafetyInputAsync(Axis axis, SafetyControlMasks input)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

The specific safety input.


The safety input can be one or any combination of the following: ACSC_SAFETY_RL
ACSC_SAFETY_LL
ACSC_SAFETY_NETWORK
input
ACSC_SAFETY_HOT
ACSC_SAFETY_DRIVE
ACSC_SAFETY_ES
See Safety Control Masks for a detailed description of these properties.

Return Value
SafetyControlMasks.
The method retrieves the current state of the specified safety input.
Remarks
To get values of all safety inputs of the specific axis, use GetSafetyInputPort.
Safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more information
about safety inputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// The method reads Emergency Stop system safety input


// Reads Right Limit Safety input of axis 0
SafetyControlMasks sinput = Ch.GetSafetyInput(
Axis.ACSC_AXIS_0, SafetyControlMasks.ACSC_SAFETY_RL);

4.5.11 GetSafetyInputPort
Description
The method retrieves the current state of the specified safety input port.
Syntax
object.GetSafetyInputPort(Axis axis)
Async Syntax
object.GetSafetyInputPortAsync(Axis axis)

Version 2.70 226


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
SafetyControlMasks.
The method retrieves the current state of the specified safety input port.
To recognize a specific motor safety input, only one of the following properties can be used:
> ACSC_SAFETY_RL
> ACSC_SAFETY_LL
> ACSC_SAFETY_NETWORK
> ACSC_SAFETY_HOT
> ACSC_SAFETY_DRIVE
To recognize a specific system safety input, only the ACSC_SAFETY_ES property can be used.
See Safety Control Masks for a detailed description of these properties.
Remarks
To get the state of the specific safety input of a specific axis, use GetSafetyInput.
Safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more information
about safety inputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// The method reads safety input port of the axis 0

SafetyControlMasks sinput = Ch.GetSafetyInputPort(Axis.ACSC_AXIS_0);

4.5.12 GetSafetyInputPortInv
Description
The method retrieves the set of bits that define inversion for the specified safety input port.
Syntax
object.GetSafetyInputPortInv(Axis axis)
Async Syntax
object.GetSafetyInputPortInvAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value

Version 2.70 227


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

SafetyControlMasks.
The method retrieves the set of bits that define inversion for the specified safety input port. To
recognize a specific bit, use the following properties:
> ACSC_SAFETY_RL
> ACSC_SAFETY_LL
> ACSC_SAFETY_NETWORK
> ACSC_SAFETY_HOT
> ACSC_SAFETY_DRIVE
Use the ACSC_SAFETY_ES property to recognize an inversion for the specific system safety input
port.
See Safety Control Masks for a detailed description of these properties.
Remarks
To set the specific inversion for the specific safety input port, use GetSafetyInputPortInv.
If a bit of the retrieved set is zero, the corresponding signal is not inverted and therefore high
voltage is considered an active state. If a bit is raised, the signal is inverted and low voltage is
considered an active state.
Inversions of safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more
information about safety inputs, see SPiiPlus ACSPL+ Programmer's Guide.
Example

// The method retrieves the set of bits that define inversion


// for the safety input port of the axis 0
SafetyControlMasks sinput = Ch.GetSafetyInputPortInv(Axis.ACSC_AXIS_0);

4.5.13 SetSafetyInputPortInv
Description
The method sets the set of bits that define inversion for the specified safety input port.
Syntax
object.SetSafetyInputPortInv(Axis axis, SafetyControlMasks value)
Async Syntax
object.SetSafetyInputPortInvAsync(Axis axis, SafetyControlMasks value)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

The specific inversion.


value To set a specific bit, use the following properties:
ACSC_SAFETY_RL

Version 2.70 228


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_SAFETY_LL
ACSC_SAFETY_NETWORK
ACSC_SAFETY_HOT
ACSC_SAFETY_DRIVE.
To set an inversion for the specific system safety input port, use only the ACSC_
SAFETY_ES property.
See Safety Control Masks for a detailed description of these properties.

Return Value
None.
Remarks
The method sets the bits that define inversion for the specified safety input port. To retrieve an
inversion for the specific safety input port, use the GetSafetyInputPortInv method.
If a bit of the set is zero, the corresponding signal will not be inverted and therefore high voltage is
considered an active state. If a bit is raised, the signal will be inverted and low voltage is considered
an active state.
The inversions of safety inputs are represented in the controller variables SAFIN and S_SAFIN. For
more information about safety inputs, see SPiiPlus ACSPL+ Programmer's Guide.
If the method fails, the Error object is filled with the Error Description.
Example

// The method sets the inversion for safety input port of the axis 0
Ch.SetSafetyInputPortInv(Axis.ACSC_AXIS_0,(SafetyControlMasks)100);

4.5.14 FaultClear
Description
The method clears the current faults and the result of the previous fault stored in the MERR
variable.
Syntax
object.FaultClear(Axis axis)
Async Syntax
object.FaultClearAsync(Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions

Return Value
None.

Version 2.70 229


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Remarks
The method clears the current faults of the specified axis and the result of the previous fault
stored in the MERR variable.
If the method fails, the Error object is filled with the Error Description.
Example

// Clears the current faults and the results of the previous


faults
// stored in the MERR variable of axis 0
Ch.FaultClear(Axis.ACSC_AXIS_0);

4.5.15 FaultClearM
Description
The method clears the current faults and results of previous faults stored in the MERR variable for
multiple axis.
Syntax
object.FaultClearM(Axis[] axes)
Async Syntax
object.FaultClearMAsync(Axis[] axes)
Arguments

Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to the 0axis, ACSC_AXIS_1 to the 1axis, etc. After the last axis, one
axes additional element must be included that contains –1 and marks the end of the
array.
For the axis constants see Axis Definitions.

Return Value
None.
Remarks
If the reason for the fault is still active, the controller will set the fault immediately after this
command is performed. If cleared fault is Encoder Error, the feedback position is reset to zero.
If the method fails, the Error object is filled with the Error Description.
Example

Axis[] axes = { Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_NONE };


// Clears the current faults and results of the previous faults
//stored in the MERR variable of axes 0 and 1

Ch.FaultClearM(axes);

Version 2.70 230


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4.6 Wait-for-Condition Methods


The Wait-for-Condition methods are:
Table 3-31. Wait-for-Condition Methods

Method Description

WaitMotionEnd Waits for the end of a motion.

WaitLogicalMotionEnd Waits for the logical end of a motion.

WaitCollectEndExt Waits for the end of data collection.

WaitProgramEnd Waits for the program termination in the specified buffer.

WaitMotorCommutated Waits for the specified state of the specified motor.

WaitMotorEnabled Waits for the specified state of the specified motor.

WaitInput Waits for the specified state of the specified digital input.

4.6.1 WaitMotionEnd
Description
The method waits for the end of a motion.
Syntax
object.WaitMotionEnd (Axis axis, int timeout)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

Maximum waiting time in milliseconds.


timeout
If timeout is INFINITE, the method's time-out interval never elapses.

Return Value
None.
Remarks
The method does not return while the specified axis is involved in a motion, the motor has not
settled in the final position and the specified time-out interval has not elapsed.
The method differs from the WaitLogicalMotionEnd method. Examining the same motion, the
WaitMotionEnd method will return latter. The WaitLogicalMotionEnd method returns when the
generation of the motion finishes. On the other hand, the WaitMotionEnd method returns when
the generation of the motion finishes and the motor has settled in the final position.
If the method fails, the Error object is filled with the Error Description.

Version 2.70 231


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Example

int timeout = 10000;

// Wait for the end of motion of axis 0 during 10 sec


Ch.WaitMotionEnd(Axis.ACSC_AXIS_0,timeout);

4.6.2 WaitLogicalMotionEnd
Description
The method waits for the logical end of a motion.
Syntax
object.WaitLogicalMotionEnd (Axis axis, int timeout)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

Maximum waiting time in milliseconds.


If timeout is INFINITE, the method's time-out interval never elapses.
timeout
-1 - INFINITE or
0xFFFFFFFF - INFINITE

Return Value
None.
Remarks
The method does not return while the specified axis is involved in a motion and the specified time-
out interval has not elapsed.
The method differs from the WaitMotionEnd method. Examining the same motion, the
WaitMotionEnd method will return later. The WaitLogicalMotionEnd method returns when the
generation of the motion finishes. On the other hand, the WaitMotionEnd method returns when
the generation of the motion finishes and the motor has settled in the final position.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 10000;

// Wait for the logical end of motion of axis 0 during 10 sec


Ch.WaitLogicalMotionEnd(Axis.ACSC_AXIS_0,timeout);

4.6.3 WaitCollectEndExt
DESCRIPTION
The method waits for the end of data collection.

Version 2.70 232


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

SYNTAX
object.WaitCollectEndExt(int timeout)
ARGUMENTS

Maximum waiting time in milliseconds.


timeout
If timeout is INFINITE, the method's time-out interval never elapses.

Axis constant of the axis to which the data collection must be synchronized:
axis ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc. For the
axis constants see Axis Definitions.

RETURN VALUE
None.
REMARKS
The method does not return while the system data collection is in progress and the specified time-
out interval has not elapsed. The method verifies the S_ST.#DC system flag.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 10000;


// Wait data collection ends for 10 sec
Ch.WaitCollectEndExt(timeout);

4.6.4 WaitProgramEnd
Description
The method waits for the program termination in the specified buffer.
Syntax
object.WaitProgramEnd(ProgramBuffer buffer, int timeout)
Arguments

buffer Buffer number, from 0 to 9.

Maximum waiting time in milliseconds.


timeout
If timeout is INFINITE, the method's time-out interval never elapses.

Return Value
None.
Remarks
The method does not return while the ACSPL+ program in the specified buffer is in progress and
the specified time-out interval has not elapsed.
If the method fails, the Error object is filled with the Error Description.

Version 2.70 233


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Example

int timeout = 1000;


for (int index = 0; index < 8; index++)
{
// Append a line to all buffers
Ch.AppendBuffer((ProgramBuffer)index, "WAIT 500;");
Ch.AppendBuffer((ProgramBuffer)index, "STOP");
// Run all buffers
Ch.RunBuffer((ProgramBuffer)index,null);
// Wait program ends during 1 sec
Ch.WaitProgramEnd((ProgramBuffer)index, timeout);
}

4.6.5 WaitMotorCommutated
Description
The method waits for the specified state of the specified motor.
Syntax
object.WaitMotorCommutated(Axis axis, int state, int timeout)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

state 1 - The method waits for the motor to be commutated.

Maximum waiting time in milliseconds.


timeout
If timeout is INFINITE, the method's time-out interval never elapses.

Return Value
None.
Remarks
The method does not returnwhile the specified motor is not in the desired state and the specified
time- out interval has not elapsed. The method examines the MFLAGS.#BRUSHOK flag.
If the method fails, the Error object is populated with the Error Description
Example

int timeout = 5000;


// Commut axis 0
Ch.Commut(Axis.ACSC_AXIS_0);
// Wait motor 0 commutated during 5 sec
Ch.WaitMotorCommutated(Axis.ACSC_AXIS_0,1,timeout);

Version 2.70 234


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4.6.6 WaitMotorEnabled
Description
The method waits until the specified motor is commutated.
Syntax
object.WaitMotorEnabled (Axis axis, int state, int timeout)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

1 – the method waits for the motor to be enabled, 0 – the method waits for the
state
motor to be disabled.

Maximum waiting time in milliseconds.


timeout
If timeout is INFINITE, the method's time-out interval never elapses.

Return Value
None.
Remarks
The method does not returnwhile the specified motor is not in the desired state and the specified
time- out interval has not elapsed. The method examines the MST.#ENABLED motor flag.
If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


// Enable axis 0
Ch.Enable(Axis.ACSC_AXIS_0);
// Wait motor 0 enabled during 5 sec
Ch.WaitMotorEnabled(Axis.ACSC_AXIS_0,1,timeout);

4.6.7 WaitInput
Description
The method waits for the specified state of digital input.
Syntax
object.WaitInput (int port, int bit, int state, int timeout)
Arguments

port Number of input port: 0 corresponds to IN0, 1 – to IN1, etc.

bit Selects one bit from the port, from 0 to 31.

state Specifies a desired state of the input, 0 or 1.

Version 2.70 235


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Maximum waiting time in milliseconds.


timeout
If timeout is INFINITE, the method's time-out interval never elapses.

Return Value
None.
Remarks

The basic configuration of the SPiiPlus PCI model provides only 16 inputs. Therefore,
Port must be 0, and Bit can be specified only from 0 to 15.

If the method fails, the Error object is filled with the Error Description.
Example

int timeout = 5000;


// Wait for IN0.0 = 1 during 5 sec
// Parameters: 0 – IN0
// 0 – IN0.0
// 1 – wait for IN0.0 = 1
// timeout – during 5 sec

Ch.WaitInput(0, 0, 1, timeout);

4.7 Event and Interrupt Handling Methods


The Event and Interrupt Handling methods are:
Table 3-32. Event and Interrupt Handling Methods

Method Description

EnableEvent Enables event generation for the specified interrupt condition.

DisableEvent Disables event generation for the specified interrupt condition.

SetInterruptMask Sets the mask for the specified interrupt.

GetInterruptMask Retrieves the mask for the specified interrupt.

4.7.1 EnableEvent
Description
The method enables event generation for the specified interrupt condition.
Syntax
object.EnableEvent(Interrupts flags)
Arguments

Version 2.70 236


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Specifies one of the interrupts such as ACSC_INTR_PEG, ACSC_INTR_MARK1 etc. For


flags
the full list of the interrupts, see Interrupt Types.

Return Value
None.
Remarks
The library generates an event when the specified Interrupt occurs. SPiiPlus NET Library has events
for all types of interrupts:
PEG (AxisMasks Param), MARK1 (AxisMasks Param) etc. For full list of SPiiPlus NETLibrary events see
Events.
The bit-mapped event parameter Param identifies which axis/buffer/input the interrupt was
generated for. See Callback Interrupt Masks for a detailed description of the Param argument for
each interrupt.
One event can be associated with each controller interrupt. All events are handled in the main
application thread, therefore the application execution is stopped until the event is handled.
To disable a specific event, call the EnableEvent method with the flags argument equal to the
specified interrupt type.

Before the PEG interrupts can be detected, the AssignPins method must be called.

If the method fails, the Error object is filled with the Error Description.
Example

// Enable event ACSC_INTR_ACSPL_PROGRAM


Ch.EnableEvent(Interrupts.ACSC_INTR_ACSPL_PROGRAM);
// Enable event ACSC_INTR_PROGRAM_END
Ch.EnableEvent(Interrupts.ACSC_INTR_PROGRAM_END);
// Delete all lines in buffer 5
Ch.Transaction("#5D1,100000");
// Appends a line to buffer 5
Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_5, "interrupt stop");
// Execute buffer 5
// Ch.Transaction("#5X");

4.7.2 DisableEvent
Description
The method disables event generation for the specified interrupt condition.
Syntax
object.DisableEvent (Interrupts flags)
Arguments

Version 2.70 237


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Specifies one of the interrupts such as ACSC_INTR_PEG, ACSC_INTR_MARK1 etc. For


flags
the full list of the interrupts, see Interrupt Types.

Return Value
None.
Remarks
The method disables event generation that was enabled with method EnableEvent
If the method fails, the Error object is filled with the Error Description.
Example

// Disable event PROGRAM_END


Ch.DisableEvent(Interrupts.ACSC_INTR_PROGRAM_END);

4.7.3 SetInterruptMask
Description
The method sets the mask for specified interrupt.
Syntax
object.SetInterruptMask(Interrupts interrupt, Uint32 mask)
Arguments

Specifies one of the following interrupts:


ACSC_INTR_ACSPL_PROGRAM – an ACSPL+ program has generated the interrupt
by INTERRUPT command
ACSC_INTR_ACSPL_PROGRAM_EX – an ACSPL+ program has generated the
interrupt by INTERRUPTEX command
ACSC_INTR_COMM_CHANNEL_CLOSED - a communication channel has been
closed.
ACSC_INTR_COMMAND – a line of ACSPL+ commnds has been executed in a
dynamic buffer
interrupt ACSC_INTR_EMERGENCY - an EMERGENCY STOP signal has been generated.
ACSC_INTR_ETHERCAT_ERROR - an EtherCAT error occurred.
ACSC_INTR_LOGICAL_MOTION_END – a logical motion has finished
ACSC_INTR_MOTION_FAILURE – a motion has been interrupted due to a fault
ACSC_INTR_MOTION_PHASE_CHANGE – motion profile changes the phase
ACSC_INTR_MOTION_START – motion starts
ACSC_INTR_MOTOR_FAILURE – a motor has been disabled due to a fault
ACSC_INTR_NEWSEGM - an AST.#NEWSEGM bit is high.
ACSC_INTR_PHYSICAL_MOTION_END – a physical motion has finished

Version 2.70 238


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_INTR_PROGRAM_END – an ACSPL+ program has finished


ACSC_INTR_SOFTWARE_ESTOP - the EStop button was clicked.
ACSC_INTR_SYSTEM_ERROR - a system error occurred.
ACSC_INTR_TRIGGER – AST.#TRIGGER bit goes high

The mask to be set.


If some bit = 0 then the interrupt for the corresponding axis/buffer/input does
not occur – interrupt is disabled. Use ACSC_MASK_*** to set/reset a specified bit.
See
mask
GetInterruptMask for a detailed description of these enums.
If Mask is ACSC_ALL, the interrupts for all axes/buffers/inputs are enabled.
If Mask is ACSC_NONE, the interrupts for all axes/buffers/inputs are disabled. As
default all bits for each interrupts are set to one.

Return Value
None.
Remarks
The method sets the bit mask for specified interrupt. To get current mask for specified interrupt,
call GetInterruptMask.
Using a mask, you can reduce the number of generated events. The event will be generated only if
the interrupt is caused by an axis/buffer/input that corresponds to non-zero bit in therelated
mask.
If the method fails, the Error object is filled with the Error Description.
Example

// Sets the mask for specified interrupt only foraxis 0


Ch.SetInterruptMask(Interrupts.ACSC_INTR_PROGRAM_END,
(uint)AxisMasks.ACSC_MASK_AXIS_0);

4.7.4 GetInterruptMask
Description
The method retrieves the mask for specified interrupt.
Syntax
object.GetInterruptMask(Interrupts interrupt)
Arguments

Specifies one of the following interrupts:


Interrupt ACSC_INTR_ACSPL_PROGRAM – an ACSPL+ program has generated the interrupt
by INTERRUPT command

Version 2.70 239


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_INTR_ACSPL_PROGRAM_EX – an ACSPL+ program has generated the


interrupt by INTERRUPTEX command
ACSC_INTR_COMM_CHANNEL_CLOSED - a communication channel has been
closed.
ACSC_INTR_COMMAND – a line of ACSPL+ commands executed in a dynamic
buffer
ACSC_INTR_EMERGENCY - an EMERGENCY STOP signal has been generated.
ACSC_INTR_ETHERCAT_ERROR - an EtherCAT error occurred.
ACSC_INTR_LOGICAL_MOTION_END – a logical motion has finished
ACSC_INTR_MOTION_FAILURE – a motion has been interrupted due to a fault
ACSC_INTR_MOTION_PHASE_CHANGE – motion profile changes the phase
ACSC_INTR_MOTION_START – motion starts
ACSC_INTR_MOTOR_FAILURE – a motor has been disabled due to a fault
ACSC_INTR_NEWSEGM - an AST.#NEWSEGM bit is high.
ACSC_INTR_PHYSICAL_MOTION_END – a physical motion has finished
ACSC_INTR_PROGRAM_END – an ACSPL+ program has finished
ACSC_INTR_SOFTWARE_ESTOP - the EStop button was clicked.
ACSC_INTR_SYSTEM_ERROR - a system error occurred.
ACSC_INTR_TRIGGER – AST.#TRIGGER bit goes high.

Return Value
UInt32.
The method retrieves the bit mask for the specified interrupt.
Remarks
To set the mask for a specified interrupt, call SetInterruptMask.
If a bit in the Return Value equals 0, the interrupt for the corresponding axis/buffer/input is
disabled.
Use the ACSC_MASK_*** properties to find the values of specific bits. See Callback Interrupt Masks
for a detailed description of these properties.
By default all the interrupt bits are set to one.
If the method fails, the Error object is filled with the Error Description.
Example

// The example shows how to get the mask for specific interrupt
// An ACSPL+ program finished
uint mask = Ch.GetInterruptMask(Interrupts.ACSC_INTR_PROGRAM_END);

Version 2.70 240


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4.8 Variables Management Methods


The Variables Management methods are:
Table 3-33. Variables Management Methods

Method Description

DeclareVariable Creates the persistent global variable.

ClearVariables Deletes all persistent global variables.

4.8.1 DeclareVariable
Description
The method creates a persistent global variable.
Syntax
object.DeclareVariable (AcspVariableType type, string name)
Async Syntax
object.DeclareVariableAsync (AcspVariableType type, string name)
Arguments

Type of the variable.


type For an integer variable Type must be ACSC_INT_TYPE. For a real variable, Type must
be ACSC_REAL_TYPE.

name Name of the variable.

Return Value
None.
Remarks
The method creates the persistent global variable specified by name of type specified by type. The
variable can be used as any other ACSPL+ or global variable.
If it is necessary to declare one or two-dimensional array, name should also contains the
dimensional size in brackets.
The lifetime of a persistent global variable is not connected with any program buffer. The
persistent variable survives any change in the program buffers and can be erased only by the
ClearVariables method.
The method waits for the controller response.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 241


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

// The method creates the persistent global variable "MyVar"


// as integer type.
Ch.DeclareVariable(AcsplVariableType.ACSC_INT_TYPE, "MyVar");

4.8.2 ClearVariables
Description
Deletes all persistent global variables.
Syntax
object.ClearVariables
Arguments
None.
Return Value
None.
Remarks
The method deletes all persistent global variables created by the DeclareVariable method. The
method waits for the controller response.
If the method fails, the Error object is filled with the Error Description.
Example

// The method creates the persistent global variable "MyVar"


// as integer type.
Ch.DeclareVariable(AcsplVariableType.ACSC_INT_TYPE,"MyVar");
// The method deletes all persistent global variables
Ch.ClearVariables();

4.9 Service Methods


The Service methods are:
Table 3-34. Service Methods

Method Description

GetLogData Retrieves the data of firmware log.

GetFirmwareVersion Retrieves the firmware version of the controller.

GetSerialNumber Retrieves the controller serial number.

SysInfo Retrieves cerain system information.

GetBuffersCount Returns the number of available ACSPL+ programming buffers.

Version 2.70 242


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Method Description

GetAxesCount Returns the number of available axes.

GetDBufferIndex Retrieves the index of the D-Buffer.

4.9.1 GetLogData
Description
The method is used to retrieve the data of firmware log.
Syntax
object.GetLogData();
Async Syntax
object.GetLogDataAsync()
Arguments
None.
Return Value
String.
Example

// Synchronous Get log data


string logData = Ch.GetLogData();
// Asynchronous Get log data
int timeout = 2000;
ACSC_WAITBLOCK wb = Ch.GetLogDataAsync();
string logData1 = (string)Ch.GetResult(wb, timeout);

4.9.2 GetFirmwareVersion
Description
The method retrieves the firmware version of the controller.
Syntax
object.GetFirmwareVersion()
Arguments
None.
Return Value
String.
The method retrieves the controller firmware version.
Remarks
If the method fails, the Error object is filled with the Error Description.

Version 2.70 243


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Example

// Retrieves the firmware version of the controller


string firm = Ch.GetFirmwareVersion();

4.9.3 GetSerialNumber
Description
The method retrieves the controller serial number.
Syntax
object.GetSerialNumber()
Arguments
None.
Return Value
String.
The method retrieves the character string that contains the controller serial number.
Remarks
If the method fails, the Error object is filled with the Error Description.
Example

// Retrieves the character string that contains the controller


// serial number
string sern = Ch.GetSerialNumber();

4.9.4 SysInfo
Description
The method returns certain system information based on the argument that is specified (see
System Information Keys).
Syntax
object.SysInfo (int key)
Async Syntax
object.SysInfoAsync (int key)
Arguments

Configuration key, specifies the configured feature. Assigns value of


Key
key argument in the ACSPL+ SYSINFO function.

Return Value
Double.
Receives the configuration data.

Version 2.70 244


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Example

// Gets SPiiPlus Model Number


double value = Ch.SysInfo((int)SystemInfoKey.ACSC_SYS_MODEL_KEY);

4.9.5 GetBuffersCount
Description
The method returns the number of available ACSPL+ programming buffers.
Syntax
object.GetBuffersCount()
Async Syntax
object.GetBuffersCountAsync()
Arguments
None.
Return Value
Double.
Receives the number of available ACSPL+ programming buffers.
Example

// Retrieves the number of available buffers


double value = Ch.GetBuffersCount();

4.9.6 GetAxesCount
Description
The method returns the number of available axes.
Syntax
object.GetAxesCount ()
Async Syntax
object.GetAxesCountAsync ()
Arguments
None
Return Value
None.
Receives the number of available axes.
Example

// Retrieves the number of available axes


double value = Ch.GetAxesCount();

Version 2.70 245


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4.9.7 GetDBufferIndex
Description
The method returns the index of the D-Buffer.
Syntax
object.GetDBufferIndex();
Async Syntax
object.GetDBufferIndexAsync();
Arguments
None
Return Value
Double.
Receives the D-Buffer Index
Example

// Retrieves the D-Buffer index


double value = Ch.GetDBufferIndex();

4.10 Error Diagnostics Methods


The Error Diagnostics methods are:
Table 3-35. Error Diagnostics Methods

Method Description

GetMotorError Retrieves the reason why the motor was disabled.

Retrieves the termination code of the last executed motion of the


GetMotionError
specified axis.

Retrieves the error code of the last program error encountered in the
GetProgramError
specified buffer.

4.10.1 GetMotorError
Description
The method retrieves the reason for motor disabling.
Syntax
object.GetMotorError (Axisaxis)
Async Syntax
object.GetMotorErrorAsync (Axisaxis)
Arguments

Version 2.70 246


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Int32.
The method retrieves the reason for the motor becoming disabled.
Remarks
If the motor is enabled the method returns zero. If the motor was disabled, the method returns
the reason for the disabling. To get the error explanation, use the GetErrorString method.
See SPiiPlus ACSPL+ Programmer's Guide for all available motor error code descriptions. If the
method fails, the Error object is filled with the Error Description.
Example

// Retrieves the reason for motor disabling


int mError = Ch.GetMotorError(Axis.ACSC_AXIS_0);

4.10.2 GetMotionError
Description
The method retrieves the termination code of the last executed motion of the specified axis.
Syntax
object.GetMotionError (Axis axis)
Async Syntax
object.GetMotionErrorAsync (Axis axis)
Arguments

Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Return Value
Int32.
The method retrieves the termination code of the last executed motion of the specified axis.
Remarks
If the motion is in progress, the method returns zero. If the motion terminates for any reason, the
method returns the termination code. To get the error explanation, use the method
GetErrorString.
See the SPiiPlus ACSPL+ Programmer's Guide for all available motion termination codes description.
If the method fails, the Error object is filled with the Error Description.
Example

Version 2.70 247


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

// Retrieves the termination code of the last executed motion of


// axis 0
int mError = Ch.GetMotionError(Axis.ACSC_AXIS_0);

4.10.3 GetProgramError
Description
The method retrieves the error code of the last program error encountered in thespecified buffer.
Syntax
object.GetProgramError (ProgramBuffer buffer)
Async Syntax
object.GetProgramErrorAsync (ProgramBuffer buffer)
Arguments

buffer Number of the program buffer.

Return Value
Int32.
The method retrieves the error code of the last program error encountered in thespecified buffer.
Remarks
If the program is running, the method returns zero. If the program terminates for any reason, the
method returns the termination code. To get the error explanation, use GetErrorString.
If the method fails, the Error object is filled with the Error Description.
Example

// Appends buffer 0 with 1 line


Ch.AppendBuffer(ProgramBuffer.ACSC_BUFFER_0,
"!The program finished without STOP command");
// Run buffer 0
Ch.RunBuffer(ProgramBuffer.ACSC_BUFFER_0,null);
// Retrieves error 3114
int pError = Ch.GetProgramError(ProgramBuffer.ACSC_BUFFER_0);

4.11 Position Event Generation (PEG) Methods


Table 3-36. Position Event Generation (PEG) Methods

Method Description

Assigns engine-to-encoder as well as additional digital outputs for


AssignPegNT
use as PEG State and PEG Pulse outputs.

Version 2.70 248


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Method Description

Sets output pins assignment and mapping between FGP_OUT


AssignPegOutputsNT
signals to the bits of the ACSPL+ OUT(x) variable.

Used for switching MARK_1 physical inputs to ACSPL+ variables as


AssignFastInputsNT
Fast General Purpose inputs.

PegIncNT Sets the parameters for the Incremental PEG mode.

PegRandomNT Sets the parameters for the Random PEG mode.

Waits for the all values to be loaded and the PEG engine to be ready
WaitPegReadyNT
to respond to movement.

StartPegNT Initiates the PEG process on the specified axis.

StopPegNT Terminates the PEG process immediately on the specified axis.

4.11.1 AssignPegNT
Description
The method is used for engine-to-encoder assignment as well as for assigning additional digital
outputs assignment for use as PEG State and PEG Pulse outputs specifically for the SPiiPlus family
controllers.
Syntax
object.AssignPegNT(Axis axis, int engToEncBitCode, int gpOutsBitCode)
Async Syntax
object.AssignPegNTAsync(Axis axis, int engToEncBitCode, int gpOutsBitCode)
Arguments

PEG axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the


axis
axis 1, etc. For the axis constants see Axis Definitions.

Bit code for engines-to-encoders mapping, see the PEG and MARK
engToEncBitCode
Operations Application Notes.

General Purpose outputs assignment to use as PEG state and PEG pulse,
gpOutsBitCode
see the PEG and MARK Operations Application Notes.

Return Value
None.
Example

// Example synchronous call to AssignPegNT


int engToEncBitCode =0x0;

Version 2.70 249


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

int gpOutsBitCode = 0x0b11;


Ch.AssignPegNT(Axis.ACSC_AXIS_1, engToEncBitCode, gpOutsBitCode);

4.11.2 AssignPegOutputsNT
Description
The method is used for setting 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, specifically for the SPiiPlus family controllers.
OUT is an integer array that can be used for reading or writing the current state of the General
Purpose outputs - see the SPiiPlus Command & Variable Reference Guide.
Syntax
object.AssignPegOutputsNT(Axis axis, int outputIndex, int bitCode)
Async Syntax
object.AssignPegOutputsNTAsync(Axis axis, int outputIndex, int bitCode)
Arguments

PEG axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1,


axis
etc. For the axis constants see Axis Definitions.

outputIndex 0 for OUT_0, 1 for OUT_1, ..., 9 for OUT_9

Bit code for engine outputs to physical outputs mapping, see the PEG and
bitCode
MARK Operations Application Note.

Return Value
None.
Example

// Example synchronous call to AssignPegOutputNT


int outputBitCode =0x0b0;
int outputIndex = 0;
Ch.AssignPegNT(Axis.ACSC_AXIS_1, outputIndex, outputBitCode);

4.11.3 AssignFastInputsNT
Description
The method is used to switch MARK_1 physical inputs to ACSPL+ variables as fast General Purpose
inputs for SPiiPlus family controllers.

While this method is not related to PEG activity, it is included with the PEG methods for
the sake of completeness, since many times fast inputs are used in applications that
use PEG functionality.

Version 2.70 250


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

The method is used for setting input pins assignment and mapping between FGP_IN signals to the
bits of the ACSPL+ IN(x) variable, where x is the index that has been assigned to the controller in
the network during System Configuration.
IN is an integer array that can be used for reading the current state of the General Purpose inputs
- see the SPiiPlus Command& Variable Reference Guide.
Syntax
object.AssignFastInputsNT (Axis axis, int inputIndex, int bitCode)
Async Syntax
object. AssignFastInputsNTAsync(Axis axis, int inputIndex, int bitCode)
Arguments

PEG axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

inputIndex 0 for IN_0, 1 for IN_1, ..., 9 for IN_9

Bit code for engine outputs to physical outputs mapping, see the PEG and
bitCode
MARK Operations Application Note.

Return Value
None.
Example

// Example synchronous call to AssignPegOutputNT


Ch.AssignFastInputsNT(Axis.ACSC_AXIS_1, 1, 7);

4.11.4 PegIncNT
Description
The method is used for setting the parameters for the Incremental PEG mode for SPiiPlus family
controllers. Incremental PEG is defined by first point, last point and the interval.
Syntax
object.PegIncNT(MotionFlags flags, Axis axis, double width, double firstPoint, double interval,
double lastPoint, int tbNumber, double tbPeriod)
Async Syntax
object.PegIncNTAsync(MotionFlags flags, Axis axis, double width, double firstPoint, double interval,
double lastPoint, int tbNumber, double tbPeriod)
Arguments

Bit-mapped parameter that can include following flag:


flags ACSC_AMF_WAIT - the execution of the PEG is delayed until
the StartPegNT function is executed.

Version 2.70 251


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_AMF_INVERT_OUTPUT - the PEG pulse output is


inverted.
ACSC_AMF_SYNCHRONOUS - PEG starts synchronously with
the motion sequence.

PEG axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1


axis
to the axis 1, etc. For the axis constants see Axis Definitions.

width Width of desired pulse in milliseconds.

firstPoint Position where the first pulse is generated.

interval Distance between the pulse-generating points.

lastPoint Position where the last pulse is generated.

Number of time-based pulses generated after each encoder-


tbNumber based pulse. If time-based pulses are not desired, assign
Api.ACSC_NONE to this argument.

Period of time-based pulses. If time-based pulses are not


tbPeriod
desired, assign Api.ACSC_NONE to this parameter.

Return Value
None.
Example

// Example synchronous call to PegIncNT


Ch.PegIncNT(MotionFlags.ACSC_NONE, Axis.ACSC_AXIS_1, 0.5, 0, 200, 10000,
Api.ACSC_NONE, Api.ACSC_NONE);

4.11.5 PegRandomNT
Description
The method is used for setting the parameters for the Random PEG mode for SPiiPlus family
controllers. Random PEG function specifies an array of points where position-based events should
be generated.
Syntax
object.PegRandomNT(MotionFlags flags, Axis axis, double width, int mode, int firstIndex, int
lastIndex, string pointArray, string stateArray, int tbNumber, double tbPeriod)
Async Syntaxobject.PegRandomNTAsync(MotionFlags flags, Axis axis, double width, int mode, int
firstIndex, int lastIndex, string pointArray, string stateArray, int tbNumber, double tbPeriod)
Arguments

Bit-mapped parameter that can include the following


flags
flag:

Version 2.70 252


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

ACSC_AMF_WAIT - the execution of the PEG is delayed


until the StartPegNT function is executed.
ACSC_AMF_INVERT_OUTPUT - the PEG pulse output is
inverted.
ACSC_AMF_SYNCHRONOUS - PEG starts synchronously
with the motion sequence.

PEG axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_


axis AXIS_1 to the axis 1, etc. For the axis constants see Axis
Definitions.

width Width of desired pulse in milliseconds.

Output signal configuration according , see the PEG and


mode
MARK Operations Application Note.

Index of position in pointArray where the first pulse is


firstIndex
generated.

Index of position in pointArray where the last pulse is


lastIndex
generated.

Null-terminated string contained the name of the real


array that stores positions at which PEG pulse should be
pointAray generated.
The array must be declared as a global variable by an
ACSPL+ program or by the DeclareVariable method.

Null-terminated string containing the name of the


integer array that stores the desired output state at each
position.
stateArray The array must be declared as a global variable by an
ACSPL+ program or by the DeclareVariable method.
If output state change is not desired, this parameter
should be NULL.

Number of time-based pulses generated after each


tbNumber encoder-based pulse. If time-based pulses are not
desired, assign Api. ACSC_NONE to this argument.

Period of time-based pulses. If time-based pulses are not


tbPeriod
desired, assign Api.ACSC_NONE to this parameter.

Return Value
None.
Example

Version 2.70 253


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

// Example synchronous call to PegRandomNT


Ch.PegRandomNT(MotionFlags.ACSC_NONE,Axis.ACSC_AXIS_1,1.745,0x444,0,4,
”Points”,”States”,Api.ACSC_NONE,Api.ACSC_NONE);

4.11.6 WaitPegReadyNT
Description
The method waits for the all values to be loaded and the PEG engine to be ready to respond to
movement on the specified axis for SPiiPlus familycontrollers.
The method can be used in both the Incremental and Random PEG modes.
Syntax
object.WaitPegReadyNT (Axis axis, int timeout)
Async Syntax
object.WaitPegReadyNTAsync (Axis axis, int timeout)
Arguments

PEG axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc.
axis
For the axis constants see Axis Definitions.

Maximum waiting time in milliseconds.


timeout
If timeout is INFINITE, the method’s time-out interval never elapses.

Return Value
None.
Example

// Example synchronous call to WaitPegReadyNT


int timeout = 2000;
Ch.WaitPegReadyNT(Axis.ACSC_AXIS_1,timeout);

4.11.7 StartPegNT
Description
The method is used to initiate the PEG process on the specified axis for SPiiPlus family controllers.
Syntax
object.StartPegNT(Axis axis)
Async Syntax
object.StartPegNTAsync(Axis axis)
Arguments

PEG axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc. For
axis
the axis constants see Axis Definitions.

Version 2.70 254


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Return Value
None.
Example

// Example synchronous call to StartPegNT


Ch.StartPegNT(Axis.ACSC_AXIS_1);

4.11.8 StopPegNT
Description
The method is used to terminate the PEG process immediately on the specified axis for SPiiPlus
family controllers.
The method can be used in both the Incremental and Random PEG modes.
Syntax
object.StopPegNT(Axis axis)
Async Syntax
object.StopPegNTAsync(Axis axis)
Arguments

PEG axis: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1 to the axis 1, etc. For
Axis
the axis constants see Axis Definitions.

Return Value
None.
Example

// Example synchronous call to StopPegNT


Ch.StopPegNT(Axis.ACSC_AXIS_1);

4.12 Application Save/Load Methods


The Application Save/Load methods are:
Table 3-37. Application Save/Load Methods

Method Description

AnalyzeApplication Analyzes the type of application

LoadApplication Loads the applicationi

SaveApplication Saves the application

FreeApplication Frees memory after application is taken off

Version 2.70 255


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4.12.1 Structures and Classes


The Application Loader methods employ the following structures and classes

4.12.1.1 ApplicationFileInfo
Description
This structure describes any sections (or controller files).
Syntax

struct ACSC_APPSL_SECTION
{
ACSC_APPSL_FILETYPE type;
ACSC_APPSL_STRING filename;
ACSC_APPSL_STRING Description;
UInt32 size;
UInt32 offset;
UInt32 CRC;
Int32 inuse;
Int32 error;
IntPtr pData;
}

Variables

type Section (controller file) type

filename Section (controller file) name

Description Section (controller file) Description

size Data size

offset Offset in the file data section

CRC Data CRC

1 - In use
inuse
0 - Not in use

error Error code

data Pointer to start of data

Properties

Data Data string

Version 2.70 256


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

4.12.1.2 ACSC_APPSL_STRING
Description
This structure used for Application Saver / Loader functions.
Syntax
struct ACSC_APPSL_STRING
Properties

Value String value

4.12.2 Enumerations
The Application Loader methods employ the following enums:

4.12.2.1 ACSC_APPSL_FILETYPE
Description
Describes possible file types.
Syntax

public enum ACSC_APPSL_FILETYPE


{
ACSC_ADJ,
ACSC_SP,
ACSC_ACSPL,
ACSC_PAR,
ACSC_USER,
ACSC_PROT_STRING
}

Values

ACSC_ADJ Value 0: File type is an Adjuster

ACSC_SP Value 1: File type is an SP application

ACSC_ACSPL Value 2: File type is a Program Buffer

ACSC_PAR Value 3: File type is a Parameters file.

ACSC_USER Value 4: File type is a User file

ACSC_PROT_STRING

4.12.3 AnalyzeApplication
Description

Version 2.70 257


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

The method analyzes application file and returns information about the file components, such as,
saved ACSPL+ programs, configuration parameters, user files, etc.
Syntax
object.AnalyzeApplication (string fileName)
Arguments

Variable that specifies path to host application file. If analyzing controller


fileName
application, this parameter should be NULL or empty string.

Return Value
Return Value is class ApplicationFileInfo described in ApplicationFileInfo. If the method fails, there is
exception thrown.
Example

ApplicationFileInfo info;
string fileName = "neededFile";
info = Ch.AnalyzeApplication(fileName);
string strOut = Ch.LoadApplication(fileName, info, false);

4.12.4 LoadApplication
Description
The method loads user application file from a host PC to the controllerflash.
Syntax
object.LoadApplication (string fileName, ApplicationFileInfo info, bool isPreview)
Async Syntax
object.LoadApplicationAsync (string fileName, ApplicationFileInfo info, bool isPreview, out string
value);
Arguments

fileName Variable that specifies path to host application file.

info Class that describes all the application file data.

isPreview For internal use only. It must always be 0.

Return Value
String – reserver for internal use
Example

ApplicationFileInfo info;
string fileName = "neededFile";

Version 2.70 258


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

info = Ch.AnalyzeApplication(fileName);
string strOut = Ch.LoadApplication(fileName, info, false);

4.12.5 SaveApplication
Description
The method saves user application from the controller to a file on host PC.
Syntax:
object.SaveApplication (string fileName, ApplicationFileInfo info, bool isPreview)
Async Syntax:
object.SaveApplicationAsync (string fileName, ApplicationFileInfo info, bool isPreview, out string
value)
Arguments

fileName Variable that specifies path to host application file.

info Class that describes all the application file data.

Return Value
String – reserved for internal use
Example

string filename = "neededFile";


ApplicationFileInfo info = Ch.AnalyzeApplication(null);
Ch.SaveApplication(filename, info);

4.12.6 FreeApplication
Description
The method frees memory, previously allocated by the AnalyzeApplication method.
Syntax
object.FreeApplication (ApplicationFileInfo info)
Arguments

info Class that describes all the application file data.

Return Value
None
Example

string filename = "neededFile";


ApplicationFileInfo info = Ch.AnalyzeApplication(filename);

Version 2.70 259


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Ch.FreeApplication(info);

4.13 Load/Upload Data To/From Controller Methods


The Load/Upload Data To/From Controller methods are:
Table 3-38. Load/Upload Data To/From Controller Methods

Method Description

Writes value(s) from text file to SPiiPlus controller (variable or


LoadDataToController
file).

Writes value(s) from SPiiPlus controller (variable or file) to text


UploadDataFromController
file.

4.13.1 LoadDataToController
Description
This method writes value(s) from text file to SPiiPlus controller (variable or file).
Syntax:
object.LoadDataToController(int dest, string destName, int from1, int to1,int from2, int to2, string
srcFilename, int srcNumFormat, bool bTranspose)
Async Syntax:
object.LoadDataToControllerAsync(int dest, string destName, int from1, int to1,int from2, int to2,
string srcFilename, int srcNumFormat, bool bTranspose)
Arguments

Number of program buffer for local variable


Api.ACSC_NONE for global and ACSPL+ variable
dest
GeneralDefinition.ACSC_FILE for loading directly to file on flash memory
(only arrays can be written directly into controller files)

destName String that contains name of the Variable or File

from1/to1 Index range (first dimension)

from2/to2 Index range (second dimension)

srcFilename Filename (including path) of the source text data file

Format of number(s) in source file. Use:


srcNumFormat GeneralDefinition.ACSC_INT_BINARY for integers, and
GeneralDefinition.ACSC_REAL_BINARY for real

Version 2.70 260


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

If TRUE (1), then the array will be transposed before being loaded.
bTranspose
Otherwise, this parameter has no affect

Return Value
None
Remarks
The method writes to a specified variable (scalar/array) or straight to binary file on controller's flash
memory. The variable can be a ACSPL+ controller variable, user global or user local. The input file
must be ANSI format, otherwise an error 168 (invalid file format) is returned.
ACSPL+ and user global variables have global scope. Therefore, dest must be Api.ACSC_NONE (1) for
these classes of variables. User local variable exists only within a buffer. The buffer number must
be specified for user local variable.
If dest is Api.ACSC_NONE (-1) and there is no global variable with the name specified by destName, it
will be defined. Arrays will be defined with dimensions (to1+1,to2+1). If performing loading straight
to file, from1, to1, from2, and to2 are meaningless.
If the variable is scalar, all indexes from1, to1, from2, and to2 must be Api.ACSC_NONE (-1). The
method writes the value from file specified by SrcFileName, to the variable specified by name. In
this case if the variable is a one-dimensional array, from1, to1 must specify the index range and
from2, to2 must be Api.ACSC_NONE (-1). The text file, pointed to by srcFileName, must contain to1-
from1 +1 values at least. The method writes the values to the specified variable from index from1 to
index to1 inclusively.
If the variable is a two-dimensional array, from1, to1 must specify the index range of the first
dimension and from2, to2 must specify the index range of the second dimension. The text file,
pointed to by srcFileName, must contain ((to1-from1 +1) x (to2-from2 +1)) values at least. Otherwise,
error will occur.
The method uses the text file as follows: first, the method retrieves the to2-from2 +1 values and
writes them to row from1 of the specified controller variable, then retrieves next to2- from2 +1
values and writes them to row from1 +1 of the specified controller variable, and so forth. If
bTranspose is TRUE, the method actions are inverted. It takes to1-from1 +1 values and writes them
to column from2 of the specified controller variable, then retrieves next to1- from1 +1 values and
writes them to column from2 +1 of the specified controller variable, and so forth.
The text file is processed line-by-line; any characters except numbers, dots, commas and exponent
'e' are translated as separators between the numbers. Line that starts with no digits is considered
as comment and ignored.
Example

// Example call LoadDataToController


Ch.LoadDataToController((int)GeneralDefinition.ACSC_FILE,
"MyArrayInFile", Api.ACSC_NONE, Api.ACSC_NONE, Api.ACSC_NONE,
Api.ACSC_NONE,"C:\\UserArray.txt",(int)GeneralDefinition.ACSC_INT_BINARY,
false);

4.13.2 UploadDataFromController
Description

Version 2.70 261


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

This method writes value(s) from SPiiPlus controller (variable or file) to text file.
Syntax:
object.UploadDataFromController (int src, string srcName, int srcNumFormat, int from1, int to1, int
from2, int to2, string destFilename, string destNumFormat, Boolean bTranspose)
Async Syntax
object.UploadDataFromControllerAsync (int src, string srcName, int srcNumFormat, int from1, int to1,
int from2, int to2, string destFilename, string destNumFormat, Boolean bTranspose)
Arguments

Number of program buffer for local variable, Api.ACSC_NONE for global


src and ACSPL+ variable and GeneralDefinition.ACSC_FILE for loading directly
from file on flash memory.

srcName String that contains name of the Variable or File

Format of number(s) in Controller. Use


srcNumFormat GeneralDefinition.ACSC_INT_BINARY for integer, and
GeneralDefinition.ACSC_REAL_BINARY for real

from1/to1 Index range (first dimension)

from2/to2 Index range (second dimension)

destFilename Filename (including path) of the source text data file

Formatting string that will be used for printing into file ("1:%d\n" for
destNumFormat
Example). Use string with %d for integer, and %lf for real type

If TRUE (1), then the array will be transposed before being loaded.
bTranspose
Otherwise, this parameter has no affect

Return Value
None
Remarks
The method writes data to file from a specified variable (scalar/array) or straight from a binary file
in the controller’s flash memory. The variable can be a ACSPL+ controller variable, user global or
user local.
ACSPL+ and user global variables have global scope. Therefore src must have the value of
Api.ACSC_NONE (-1) for these classes of variables. User local variable exists only within a buffer. The
buffer number must be specified for user localvariable.
If there is no variable (or file) with the name specified by srcName, there would be error. If
performing loading straight to file, from1, to1, from2, and to2 are meaningless.
If the variable is scalar, all indexes from1, to1, from2, and to2 must be Api.ACSC_NONE (-1). The
method writes the value from variable specified by srcName, to the file specified by destFileName.

Version 2.70 262


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

If the variable is a one-dimensional array, from1, to1 must specify the index range and from2, to2
must be Api.ACSC_NONE (-1). The method writes the values from the specified variable from index
from1 to index to1 inclusively, to the file specified bydestFileName.
If the variable is a two-dimensional array, from1, to1 must specify the index range of the first
dimension and from2, to2 must specify the index range of the second dimension.
The method uses the variable as follows: first, the method retrieves the to2-from2 +1 values from
row from1 and writes them to the file specified by destFileName, then retrievesto2- from2 +1
values from row from1 +1 and writes them, and so forth.
If bTranspose is TRUE, the method actions are inverted. It takes to1-from1 +1 values from row from2
and writes them to first column of the specified controller variable, then retrieves the next to1-
from1 values from row from2 +1 and writes them to the ext column of the specified destination file.
The destination file’s format will be determined by string specified by destNumFormat. This string
will be used as argument in the *printf function.
Example

// Example call UploadDataFromController


Ch.UploadDataFromController(Api.ACSC_NONE, "MyGlobalArray",
(int)GeneralDefinition.ACSC_INT_BINARY, 0, 3, 2,
4,"C:\\MyTransposedArrayInFile.txt", "%d", true);

4.14 Emergency Stop Methods


The Emergency Stop methods are:
Table 3-39. Emergency Stop Methods

Method Description

RegisterEmergencyStop Enables Emergency Stop function.

UnregisterEmergencyStop Disables Emergency Stop function.

4.14.1 RegisterEmergencyStop
Description
This method initiates the “Emergency Stop” functionality for the calling application.
Syntax
object.RegisterEmergencyStop();
Return Value
None
Remarks
SPiiPlusUMD and Library provide the user application with the ability to open/close the Emergency
Stop button (shown below). Clicking the Emergency Stop button sends a stop to all motions and
motors command to all channels, which used in calling application, thereby stopping all motions and
disabling all motors.

Version 2.70 263


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Figure 3-1. Emergency Stop Button

Calling RegisterEmergencyStop causes the Emergency Stop button icon to appear in the right
bottom corner of the screen. If there is already such a button that is in use by other applications, a
new button does not appear; but all functionality is available for the new application.
Calling RegisterEmergencyStop requires having the local host SPiiPlus UMD running, even if it is
used through a remote connection because the Emergency Stop button is part of the local SPiiPlus
UMD. If there is no local SPiiPlus UMD running, the method fails.
Only a single call is required per application. It can be placed anywhere in code, even before the
opening of communication with controllers.
The application can remove the Emergency Stop button by calling UnregisterEmergencyStop. The
Emergency Stop button disappears if there are no additional registered applications that use it. The
termination of SPiiPlus UMD also removes the Emergency Stop button; therefore, if SPiiPlus UMD is
restarted, RegisterEmergencyStop has to be called again.
Calling RegisterEmergencyStop more than once per application is meaningless, but the method
succeeds anyway. In order to ensure that Emergency Stop button is active, itis recommended
placing a call of RegisterEmergencyStop after each call of any of OpenComm*** functions.
Example

// Example call Register Emergency stop


Ch.RegisterEmergencyStop();

4.14.2 UnregisterEmergencyStop
Description
This method terminates the “Emergency Stop” functionality for the calling application.
Syntax
object.UnregisterEmergencyStop()
Return Value
None
Remarks
Calling UnregisterEmergencyStop causes an application not to respond if the Emergency Stop
button is clicked. If there are no other applications that registered the EmergencyStop
functionality, the button will disappear.
Calling UnregisterEmergencyStop more than once per application is meaningless, but method will
succeed anyway.

Version 2.70 264


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Example

// Example call Unregister Emergency stop


Ch.UnregisterEmergencyStop();

4.15 Reboot Methods


The Reboot methods are:
Table 3-40. Reboot Methods

Method Description

ControllerReboot Reboots controller and waits for process completion.

Reboots controller, restores factory default settings and waits


ControllerFactoryDefault
for process completion.

4.15.1 ControllerReboot
Description
This method reboots controller and waits for processcompletion.
Syntax
object.ControllerReboot (int timeout)
Arguments

timeout Maximum waiting time in milliseconds.

Return Value
None
Example

// Open Ethernet with TCP protocol communication with the controller


// IP address: 10.0.0.100
EthernetCommOption port = EthernetCommOption.ACSC_SOCKET_STREAM_PORT;
Ch.OpenCommEthernetTCP("10.0.0.100", (int)port);
Ch.ControllerReboot(30000);
Ch.CloseComm();

4.15.2 ControllerFactoryDefault
Description
The method reboots the controller, restores factory default settings and waits for process
completion.
Syntax
object.ControllerFactoryDefault (int timeout)
Arguments

Version 2.70 265


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

timeout Maximum waiting time in milliseconds.

Return Value
If the method succeeds, the return value is non-zero. If the method fails, the return value is zero.
Example

// Open Ethernet with TCP protocol communication with the controller


// IP address: 10.0.0.100
EthernetCommOption port = EthernetCommOption.ACSC_SOCKET_STREAM_PORT;
Ch.OpenCommEthernetTCP("10.0.0.100", (int)port);
Ch.ControllerFactoryDefault(30000);
Ch.CloseComm();

4.16 Host-Controller File Operations


Host PC files can be copied to controller's non-volatile memory and user files can be deleted from
the controller's non-volatile memory as described in this section.
Table 3-41. Host-Controller File Copying Methods

Method Description

The function copies files from the host PC to the controller's


CopyFileToController
non-volatile memory

The function deletes user files from the controller's non-


DeleteFileFromController
volatile memory.

4.16.1 CopyFileToController
Description
The function copies file from host PC to controller’s non-volatile memory.
Syntax
object.CopyFileToController (string sourceFileName, string destinationFileName)
Async Syntax
object.CopyFileToControllerAsync (string sourceFileName, string destinationFileName)
Arguments

Pointer to a buffer that contains the name of the source file on host
sourceFileName
PC

Pointer to a buffer that contains name of destination file on the


destinationFileName
controller.

Return Value
None.

Version 2.70 266


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Example

// Example call CopyFileToController


Ch.CopyFileToController("C:\\tmp.txt","tmp.txt");

4.16.2 DeleteFileFromController
Description
The function deletes user files from controller's non-volatile memory.
Syntax
object.DeleteFileFromController (string fileName)
Async Syntax
object.DeleteFileFromControllerAsync (string fileName)
Arguments

Pointer to a buffer that contains name of the user file on controller's non-
fileName
volatile memory.

Return Value
None.
Example

// Example call DeleteFileFromController


Ch.DeleteFileFromController("tmp.txt");

4.17 Save to Flash Functions


The Save to flash method is
Table 3-42. Save to Flash Methods

Method Description

The function saves user application to the controller's non- volatile


ControllerSaveToFlash
memory.

4.17.1 ControllerSaveToFlash
Description
The function saves user application to the controller's non-volatile memory.
Syntax
object.ControllerSaveToFlash (Axis[] parameters, ProgramBuffer[] buffers,ServoProcessor[]
sPPrograms, string userArrays)
Arguments

Version 2.70 267


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Array of parameters constants. Each


element specifies system parameters or
one involved axis: ACSC_SYSTEM
corresponds to system parameters;
parameters ACSC_AXIS_0 corresponds to axis 0,
ACSC_AXIS_1 to axis 1, etc.
If there is no need to save user arrays to
controller's non-volatile memory, this
parameter should be NULL.

Array of buffer constants. Each element


specifies one involved buffer: ACSC_
BUFFER_0 corresponds to buffer 0, ACSC_
BUFFER_1 to buffer 1, etc.
buffers If all buffers need to be specified, ACSC_
BUFFER_ALL should be used. After the
last buffer, one additional element must
be located that contains -1 which marks
the end of the array.

Array of Servo Processor (SP) constants.


Each element specifies one involved SP:
ACSC_SP_0 corresponds to SP 0, ACSC_
SP_1 to SP 1, etc.
sPPrograms If all SPs need to be specified, ACSC_SP_
ALL should be used. After the last SP, one
additional element must be located that
contains - 1 which marks the end of the
array.

User Arrays list - Pointer to the null-


terminated string. The string contains
chained names of user arrays, separated
userArrays by '\r'(13) character.
If there is no need to save user arrays to
controller's non-volatile memory, this
parameter should be NULL.

Return Value
Int32.
Example
The following code sample saves all axes parameters and buffers to flash, with two user arrays:
"MyArray" and"MyArray2".

Version 2.70 268


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

Axis[] parameters = new Axis[2];


ProgramBuffer[] buffers = new ProgramBuffer[2];
ServoProcessor[] sPPrograms = new ServoProcessor[2];
parameters[0] = Axis.ACSC_PAR_ALL;
parameters[1] = Axis.ACSC_NONE;
buffers[0] = ProgramBuffer.ACSC_BUFFER_ALL;
buffers[1] = ProgramBuffer.ACSC_NONE;
sPPrograms[0] = ServoProcessor.ACSC_SP_ALL;
sPPrograms[1] = ServoProcessor.ACSC_NONE;
Ch.ControllerSaveToFlash(parameters,
buffers, sPPrograms,"MyArray\rMyArray2");

4.18 SPiiPlusSC Management


The SPiiPlusSC Management methods are:
Table 3-43. SPiiPlusSC Management Methods

Method Description

StartSPiiPlusSC The function starts the SPiiPlusSC controller.

StopSPiiPlusSC The function stops the SPiiPlusSC controller.

4.18.1 StartSPiiPlusSC
Description
The function starts the SPiiPlusSC controller.
Syntax
object.StartSPiiPlusSC()
Arguments
None
Return Value
None
Example

// Example call StartSPiiPlusSC


Ch.StartSPiiPlusSC();

4.18.2 StopSPiiPlusSC
Description
The function stops the SPiiPlusSC controller.
Syntax
object.StopSPiiPlusSC()
Arguments

Version 2.70 269


SPiiPlus .NET Library Programmer's Guide
4. Blended Segmented Motion Functions

None
Return Value
None
Example

// Example call StopSPiiPlusSC


Ch.StopSPiiPlusSC();

Version 2.70 270


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

5. Enumerations
This chapter presents the built-in enumeration types that are used for establishing various
properties during program runtime. For each property, the name of the constant, its value and a
description are given.

5.1 General Definitions


Syntax:
public enum GeneralDefinition
Table 4-1. General Definitions

Name Value Description

ACSC_VER 0x63F1100

ACSC_INT_BINARY 4 Integer type of the variable

ACSC_REAL_BINARY 8 Real type of the variable

ACSC_FILE -2

ACSC_AXES_MAX_NUMBER 64 Maximum number of axes

ACSC_BUFFERS_MAX_NUMBER 65 Maximum number of Program buffers

ACSC_SP_MAX_NUMBER 64 Maximum number of Servo Processors

ACSC_DC_VAR_MAX_NUMBER 10

ACSC_DEFAULT_REMOTE_PORT 9999

5.2 General Communication Options


Syntax:
public enum CommOptions
Table 4-2. General Communication Options

Name Value Description

ACSC_NONE 0

ACSC_ALL -1

The communication mode when each command is sent


ACSC_COMM_
0x00000001 to the controller with checksum and the controller also
USE_CHECKSUM
responds with checksum.

Version 2.70 271


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Name Value Description

When a hardware error is detected in the


ACSC_COMM_
communication channel and this bit is set, the library
AUTORECOVER_ 0x00000002
automatically repeats the transaction, without
HW_ERROR
counting iterations. By default, this flag is not set.

5.3 Ethernet Communication Options


Syntax:
public enum EthernetCommOption
Table 4-3. Ethernet Communication Options

Name Value Description

ACSC_SOCKET_ The library opens Ethernet communication using the


700
DGRAM_PORT connectionless socket and UDP communication protocol.

ACSC_SOCKET_ The library opens Ethernet communication using the


701
STREAM_PORT connection- oriented socket and TCP communication protocol.

5.4 Serial Communication Options


Syntax:
public enum SerialCommOption
Table 4-4. Serial Communication Option

Name Value Description

ACSC_AUTO -1

5.5 Axis Definitions


Syntax:
public enum Axis
Description
The general format for any axis definition is:
ACSC_AXIS_index
Where index is a number that ranges between 0 and 63, such as ACSC_AXIS_0, ACSC_AXIS_1, ACSC_
AXIS_30, etc. The axis constant contains the value associated with the index, that is, ACSC_AXIS_0
has a value of 0, ACSC_AXIS_1 has a value of 1, and so forth. ACSC_PAR_ALL stands for all parameters
(system and all axes parameters) and ACSC_SYSTEM stands for the system parameters. ACSC_NONE
has a value of -1 and serves as axes array terminator.

Version 2.70 272


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

5.6 Buffer Definitions


Syntax:
public enum ProgramBuffer
Description
The general format for any buffer definition is:
ACSC_BUFFER_index
Where index is a number that ranges between 0 and 64, such as ACSC_BUFFER_0, ACSC_BUFFER_1,
ACSC_BUFFER_64, etc. The buffer constant contains the value associated with the index, that is,
ACSC_BUFFER_0 has a value of 0, ACSC_BUFFER_1 has a value of 1, and so forth. ACSC_BUFFER_ALL
stands for all buffers. ACSC_NONE has a value of -1 and serves as buffer array terminator.

5.7 Servo Processor (SP) Definitions


Syntax:
public enum ServoProcessor
Description
The general format for any SP definition is:
ACSC_SP_index
Where index is a number that ranges between 0 and 63, such as ACSC_SP_0, ACSC_SP_1, ACSC_SP_
63, etc. The SP constant contains the value associated with the index, that is, ACSC_SP_0 has a value
of 0, ACSC_SP_1 has a value of 1, and so forth. ACSC_SP_ALL stands for all SPs. ACSC_NONE has a
value of -1 and serves as array terminator.

5.8 EtherCAT Flags


Syntax:
public enum EtherCatFlags
Table 4-5. EtherCAT Flags

Name Value Description

ACSC_NONE 0 Disable all EtherCAT flags

ACSC_ALL -1 Enable all EtherCAT flags

ACSC_ETHERCAT_1BYTE 0x00000001

ACSC_ETHERCAT_2BYTES 0x00000002

ACSC_ETHERCAT_4BYTES 0x00000004

ACSC_ETHERCAT_FLOAT 0x00000008

Version 2.70 273


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

5.9 Motion Flags


Syntax:
public enum MotionFlags
Table 4-6. Motion Flags

Name Value Description

ACSC_NONE 0 Disables all motion flags

ACSC_ALL -1 Enables all motion flags

The controller plans the motion but doesn’t start it


ACSC_AMF_WAIT 0x00000001
until the Go method is executed.

ACSC_AMF_ The value of the point coordinate is relative to the


0x00000002
RELATIVE end point coordinate of the previous motion.

ACSC_AMF_ The motion uses the specified velocity instead of


0x00000004
VELOCITY the default velocity.

ACSC_AMF_ The motion comes to the end point with the


0x00000008
ENDVELOCITY specified velocity

ACSC_AMF_ The slaved motion uses position lock. If the flag is


0x00000010
POSITIONLOCK not specified, velocity lock is used.

ACSC_AMF_
0x00000020 The slaved motion uses velocity lock.
VELOCITYLOCK

The motion uses the point sequence as a cyclic


ACSC_AMF_CYCLIC 0x00000100 array: after positioning to the last point it does
positioning to the first point and continues.

The time interval between adjacent points of the


ACSC_AMF_ spline (arbitrary path) motion is non-uniform and is
0x00000200
VARTIME specified along with an each added point. If the flag
is not specified, the interval is uniform.

Use a cubic interpolation between the specified


points (third-order spline) for the spline (arbitrary
ACSC_AMF_CUBIC 0x00000400 path) motion. If the flag is not specified, linear
interpolation is used (first-order spline). [In the
present version third-order spline is not supported].

Segmented slaved motion: if a master value travels


ACSC_AMF_
0x00001000 beyond the specified path, the last or the first
EXTRAPOLATED
segment is extrapolated.

Version 2.70 274


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Name Value Description

Segmented slaved motion: if a master value travels


ACSC_AMF_
0x00002000 beyond the specified path, the motion stalls at the
STALLED
last or first point.

Multi-axis motion does not use the motion


ACSC_AMF_ parameters from the leading axis but calculates the
0x00004000
MAXIMUM maximum allowed motion velocity, acceleration,
deceleration and jerk of the involved axes.

ACSC_AMF_ Position Event Generation (PEG): Start PEG


0x00008000
SYNCHRONOUS synchronously with the motion sequence.

ACSC_AMF_
0x00010000 Decelerate to corner.
JUNCTIONVELOCITY

Do not treat junction as a corner, if junction angle is


ACSC_AMF_ANGLE 0x00020000
less than or equal to the specified value in radians.

ACSC_AMF_
0x00040000 Synchronize user variables with segment execution.
USERVARIABLES

ACSC_AMF_
0x00080000 The PEG pulse output is inverted.
INVERT_OUTPUT

Syntax:
public enum RotationDirection
Table 4-7. Rotation Direction Flags

Name Value Description

ACSC_COUNTERCLOCKWISE 1 Counter clockwise rotation

ACSC_CLOCKWISE -1 Clockwise rotation

Syntax:
public enum GlobalDirection
Table 4-8. Global Direction Flags

Name Value Description

ACSC_POSITIVE_DIRECTION 1 Axis movement in positive direction

ACSC_NEGATIVE_DIRECTION -1 Axis movement in negative direction

Version 2.70 275


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

5.10 Data Collection Flags


Syntax:
public enum DataCollectionFlags
Table 4-9. Data Collection Flags

Name Value Description

ACSC_
0 Disables all data collections flags
NONE

ACSC_ALL -1 Enables all data collection flags

ACSC_
Temporal data collection. The sampling period is calculated
DCF_ 0x00000001
automatically according to the collection time.
TEMPORAL

ACSC_ Cyclic data collection uses the collection array as a cyclic


DCF_ 0x00000002 buffer and continues infinitely. When the array is full, each
CYCLIC new sample overwrites the oldest sample in the array.

Starts data collection synchronously to a motion. Data


ACSC_
0x00000004 collection started with the ACSC_DCF_SYNC flag is called axis
DCF_SYNC
data collection.

Creates synchronous data collection, but does not start until


ACSC_
0x00000008 the Go method is called. This flag can only be used with the
DCF_WAIT
ACSC_DCF_SYNC flag.

5.11 Motor State Flags


Syntax:
public enum MotorStates
Table 4-10. Motor State Flags

Name Value Description

ACSC_NONE 0 Disables all motor state flags

ACSC_ALL -1 Enables all motor state flags

ACSC_MST_ENABLE 0x00000001 Motor is enabled

ACSC_MST_INPOS 0x00000010 Motor has reached a target position.

ACSC_MST_MOVE 0x00000020 Motor is moving.

ACSC_MST_ACC 0x00000040 Motor is accelerating.

Version 2.70 276


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

5.12 Axis State Flags


Syntax:
public enum AxisStates
Table 4-11. Axis State Flags

Name Value Description

ACSC_NONE 0 Disables all axis state flags

ACSC_ALL -1 Enables all axis state flags

ACSC_AST_
0x00000001 Axis is leading in a group.
LEAD

ACSC_AST_DC 0x00000002 Axis data collection is in progress.

ACSC_AST_
0x00000004 PEG for the specified axis is in progress.
PEG

ACSC_AST_
0x00000020 Axis is moving.
MOVE

ACSC_AST_
0x00000040 Axis is accelerating.
ACC

ACSC_AST_ Slave motion for the specified axis is synchronized to


0x00000100
VELLOCK master in velocity lock mode.

ACSC_AST_ Slave motion for the specified axis is synchronized to


0x00000200
POSLOCK master in position lock mode.

5.13 Index and Mark State Flags


Syntax:
public enum IndexStates
Table 4-12. Index and Mark State Flags

Name Value Description

ACSC_NONE 0 Disables all index state flags

ACSC_ALL -1 Enables all index state flags

ACSC_IST_
0x00000001 Primary encoder index of the specified axis is latched.
IND

Version 2.70 277


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Name Value Description

ACSC_IST_
0x00000002 Secondary encoder index of the specified axis is latched.
IND2

ACSC_IST_ MARK1 signal has been generated and position of the


0x00000004
MARK specified axis was latched.

ACSC_IST_ MARK2 signal has been generated and position of the


0x00000008
MARK2 specified axis was latched.

5.14 Program State Flags


Syntax:
public enum ProgramStates
Table 4-13. Program State Flags

Name Value Description

ACSC_
0 Disables all program state flags
NONE

ACSC_ALL -1 Enables all program state flags

ACSC_PST_
0x00000001 Program in the specified buffer is compiled.
COMPILED

ACSC_PST_
0x00000002 Program in the specified buffer is running.
RUN

ACSC_PST_ Program in the specified buffer is suspended after the step


0x00000004
SUSPEND execution or due to breakpoint in debug mode.

ACSC_PST_ Program in the specified buffer is executed in debug


0x00000020
DEBUG mode, i.e. breakpoints are active.

ACSC_PST_
0x00000080 Auto routine in the specified buffer is running.
AUTO

5.15 Safety Control Masks


Syntax:
public enum SafetyControlMasks: uint

Version 2.70 278


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Table 4-14. Safety Control Masks

Name Value Description Type

ACSC_NONE 0 Disables all safety mask flags

ACSC_ALL -1 Enables all safety mask flags

ACSC_SAFETY_RL 0x00000001 Right Limit Motor fault

ACSC_SAFETY_LL 0x00000002 Left Limit Motor fault

ACSC_SAFETY_ Network
0x00000004 Network Error
NETWORK fault

ACSC_SAFETY_HOT 0x00000010 Motor Overheat Motor fault

ACSC_SAFETY_SRL 0x00000020 Software Right Limit Motor fault

ACSC_SAFETY_SLL 0x00000040 Software Left Limit Motor fault

Primary Encoder Not


ACSC_SAFETY_ENCNC 0x00000080 Motor fault
Connected

Secondary Encoder Not


ACSC_SAFETY_ENC2NC 0x00000100 Motor fault
Connected

ACSC_SAFETY_DRIVE 0x00000200 Driver Alarm Motor fault

ACSC_SAFETY_ENC 0x00000400 Primary Encoder Error Motor fault

ACSC_SAFETY_ENC2 0x00000800 Secondary Encoder Error Motor fault

ACSC_SAFETY_PE 0x00001000 Position Error Motor fault

ACSC_SAFETY_CPE 0x00002000 Critical Position Error Motor fault

ACSC_SAFETY_VL 0x00004000 Velocity Limit Motor fault

ACSC_SAFETY_AL 0x00008000 Acceleration Limit Motor fault

ACSC_SAFETY_CL 0x00010000 Current Limit Motor fault

ACSC_SAFETY_SP 0x00020000 Servo Processor Alarm Motor fault

System
ACSC_SAFETY_PROG 0x02000000 Program Error
fault

Version 2.70 279


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Name Value Description Type

System
ACSC_SAFETY_MEM 0x04000000 Memory Overuse
fault

System
ACSC_SAFETY_TIME 0x08000000 Time Overuse
fault

System
ACSC_SAFETY_ES 0x10000000 Emergency Stop
fault

System
ACSC_SAFETY_INT 0x20000000 Servo Interrupt
fault

System
ACSC_SAFETY_INTGR 0x40000000 Integrity Violation
fault

See the SPiiPlus ACSPL+ Programmer’s Guide for detailed explanation of faults.

5.16 Interrupt Types


Syntax:
public enum Interrupts
Table 4-15. Interrupt Types

Name Value Description

ACSC_INTR_ACSPL_ ACSPL+ program has generated the interrupt by


22
PROGRAM INTERRUPT command.

ACSC_INTR_ACSPL_ A user has sent the INTERRUPTEX


21
PROGRAM_EX command.

ACSC_INTR_COMM_
32 Communication channel has been closed.
CHANNEL_CLOSED

A line of ACSPL+ commands executed in a dynamic


ACSC_INTR_COMMAND 21
buffer.

ACSC_INTR_EMERGENCY 15 EMERGENCY STOP signal has been generated.

ACSC_INTR_ETHERCAT_
29 EtherCAT error occurred.
ERROR

Version 2.70 280


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Name Value Description

ACSC_INTR_LOGICAL_
17 Logical motion has finished.
MOTION_END

ACSC_INTR_MOTION_
18 Motion has been interrupted due to a fault.
FAILURE

ACSC_INTR_MOTION_
25 Motion profile changed the phase
PHASE_CHANGE

ACSC_INTR_MOTION_
24 Physical motion has started.
START

ACSC_INTR_MOTOR_
19 Motor has been disabled due to a fault.
FAILURE

ACSC_INTR_NEWSEGM 27 AST.#NEWSEGM bit went high.

ACSC_INTR_PHYSICAL_
16 Physical motion has finished.
MOTION_END

ACSC_INTR_PROGRAM_
20 ACSPL+ program has finished.
END

ACSC_INTR_SOFTWARE_
33 EStop button was clicked.
ESTOP

ACSC_INTR_SYSTEM_
28 System error occurred.
ERROR

ACSC_INTR_TRIGGER 26 AST.#TRIGGER bit went high

5.17 Callback Interrupt Masks


Syntax:
public enum AxisMasks: ulong
public enum BufferMasks: ulong
public enum InputMasks: uint
Table 4-16. Callback Interrupt Masks

Bit Name Bit Description Interrupt

ACSC_NONE 0

ACSC_ALL -1

Version 2.70 281


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Bit Name Bit Description Interrupt

ACSC_INTR_PEG,
ACSC_INTR_MARK1,
ACSC_INTR_MARK2,
ACSC_INTR_
PHYSICAL_MOTION_
END,
ACSC_INTR_LOGICAL_
ACSC_MASK_AXIS_0 0 Axis 0 MOTION_END,

... ACSC_MASK_AXIS_ ... ... ACSC_INTR_MOTION_


63 63 FAILURE,
Axis 63
ACSC_INTR_MOTOR_
FAILURE,
ACSC_INTR_MOTION_
START,
ACSC_INTR_MOTION_
PHASE_CHANGE,
ACSC_INTR_TRIGGER

ACSC_INTR_
ACSC_MASK_ PROGRAM_END,
0 Buffer 0
BUFFER_0 ACSC_INTR_
... ...
... ACSC_MASK_ COMMAND,
63 Buffer 63
BUFFER_63 ACSC_INTR_ACSPL_
PROGRAM

ACSC_MASK_INPUT_
0
0 IN(0).0
... ACSC_INTR_INPUT
… ACSC_MASK_ … IN(0).31
31
INPUT_31

5.18 Configuration Keys


Syntax:
public enum ConfigKey
Table 4-17. Configuration Keys

Key Name Key Description

Bit 6 defines HSSI route, bit 7 defines source for


ACSC_CONF _WORD1_KEY 1
interrupt generation.

Version 2.70 282


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Key Name Key Description

ACSC_CONF _INT_EDGE_
3 Sets the interrupt edge to be positive or negative.
KEY

ACSC_CONF _ENCODER_
4 Sets encoder type: A&B or analog.
KEY

Sets the specified output pin to be one of the


following:
ACSC_CONF_OUT_KEY 29
OUT0 PEG
Brake

ACSC_CONF _MFLAGS9_
204 Controls value of MFLAGS.9
KEY

ACSC_CONF_DIGITAL_ Assigns use of OUT0 signal: general purpose output


205
SOURCE_KEY or PEG output.

ACSC_CONF_SP_OUT_
206 Reads SP output pins.
PINS_KEY

ACSC_CONF_BRAKE_OUT_
229 Controls brake method.
KEY

5.19 System Information Keys


Syntax:
public enum SystemInfoKey
Table 4-18. System Information Keys

Key Name Key Description

ACSC_SYS_MODEL_KEY 1

ACSC_SYS_VERSION_KEY 2

ACSC_SYS_NBUFFERS_KEY 10

ACSC_SYS_DBUF_INDEX_KEY 11

ACSC_SYS_NAXES_KEY 13

ACSC_SYS_NNODES_KEY 14

ACSC_SYS_NDCCH_KEY 15

ACSC_SYS_ECAT_KEY 17

Version 2.70 283


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

5.20 Represantaion, Variables and Return Types Definitions


Syntax:
public enum AcsplVariableType
Table 4-19. ACSPL+ Variables Types

Name Value Description

ACSC_INT_TYPE 1 Integer Variable type

ACSC_REAL_TYPE 2 Real Variable type

Syntax:
public enum RepresentationTypes
Table 4-20. Representation Types

Name Value Description

ACSC_NONE 0

ACSC_ALL -1

ACSC_DEC_REAL_TYPE 8

ACSC_DEC_INT_TYPE 4

ACSC_BIN_INT_TYPE 2

ACSC_OCT_INT_TYPE 1

ACSC_HEX_INT_TYPE 16

5.21 Log Detalization and Presentation Definitions


Syntax:
public enum ACSC_LOG_DETALIZATION_LEVEL
Table 4-21. Log Detalization Definitions

Name Value Description

Minimum 0

Medium 1

Maximum 2

Syntax:
public enum ACSC_LOG_DATA_PRESENTATION

Version 2.70 284


SPiiPlus .NET Library Programmer's Guide
5. Enumerations

Table 4-22. Log Presentation Definitions

Name Value Description

Compact 0

Formatted 1

Full 2

Version 2.70 285


SPiiPlus .NET Library Programmer's Guide
6. Events

6. Events
SPiiPlus NET Library has events for the following types of interrupts:

The bit-mapped event parameter: Param is an interrupt mask that determines which
axis/buffer/input a given interrupt was generated for. See Callback Interrupt Masks for
a description of Param for each interrupt.

Table 5-1. Events and Interrupts

Event Interrupt

ACSPLCOMMAND (long Param) ACSC_INTR_COMMAND

ACSPLPROGRAM (BufferMasks Param) ACSC_INTR_ACSPL_PROGRAM

COMMCHANNELCLOSED () ACSC_INTR_COMM_CHANNEL_CLOSED

EMERGENCY () ACSC_INTR_EMERGENCY

ETHERCATERROR () ACSC_INTR_ETHERCAT_ERROR

LOGICALMOTIONEND (AxisMasks Param) ACSC_INTR_LOGICAL_MOTION_END

MOTIONFAILURE (AxisMasks Param) ACSC_INTR_MOTION_FAILURE

MOTIONPHASECHANGE (AxisMasks Param) ACSC_INTR_MOTION_PHASE_CHANGE

MOTIONSTART (AxisMasks Param). ACSC_INTR_MOTION_START

MOTORFAILURE (AxisMasks Param) ACSC_INTR_MOTOR_FAILURE

NEWSEGM () ACSC_INTR_NEWSEGM

PHYSICALMOTIONEND (AxisMasks Param) ACSC_INTR_PHYSICAL_MOTION_END

PROGRAMEND (BufferMasks Param) ACSC_INTR_PROGRAM_END

SOFTWAREESTOP () ACSC_INTR_SOFTWARE_ESTOP

SYSTEMERROR () ACSC_INTR_SYSTEM_ERROR

SYSTEMERROR () ACSC_INTR_ACSPL_PROGRAM_EX

TRIGGER (AxisMasks Param) ACSC_INTR_TRIGGER

Version 2.70 286


SPiiPlus .NET Library Programmer's Guide
7. Error Handling

7. Error Handling
The SPiiPlus NET Library throws ACSException when API function fails to complete the requested
operation successfully. The exception object contains an error code and an Error Description that
can be used to evaluate the error occurred.
> Error code, received from GetLastError() function (see Error Codes).
> A string with a description of the error.
For example:

Communication Initialization failure. Error – 132

7.1 Error Handling Example in C#


The following code illustrates error handling in C#:

private void OpenCommSerial()


{
try {
Ch.OpenCommSerial(1,115200);
}
catch (ACSException ex)
{
// handle Exception
}
}

7.2 Error Codes


This section provides a breakdown of the Error codes associated with the .NET Library.

Any error code greater than 1000 is a controller error as defined in the SPiiPlus
Command & Variable Reference Guide.

Table 6-1. NET Library Error Codes

Error
Error Message Remarks
Code

Asynchronous call Attempt was made to use a method asynchronously that is


101
is not supported. only support synchronously, for example, Send.

No such file or This error is returned by the OpenLogFile method if a


102
directory. component of a path does not specify an existing directory.

Version 2.70 287


SPiiPlus .NET Library Programmer's Guide
7. Error Handling

Error
Error Message Remarks
Code

The FW version
does not support This error is returned by one of the OpenComm***
103
the current NET methods. Upgrade the FW of the controller.
Library version.

Controllers reply is A timeout has occurred due to a lack of response of the


104
too long. controller.

Internal library
109 error: Invalid file
handle.

Internal library
122 error: Cannot open
Log file.

Too many open This error is returned by the OpenLogFile


124
files. method if no more file handles available.

This error is returned by the WriteLogFile method if no


No space left on
128 more space for writing is available on the device (for
device.
example when the disk is full).

A time out occurred while waiting for a controller response.


130 Timeout expired. This error indicates that during specified timeout the
controller did not respond or response was invalid.

This error is returned by one of the Open*** methods in


Communication the following cases: the specified communication
132 initialization parameters are invalid ,the corresponding physical
failure. connection is not established ,the controller does not
respond for specified communication channel.

Internal library
error: Creating
133
communication
object failure.

Invalid
Specified communication handle must be handle returned
134 communication
by one of the Open*** methods.
handle.

Version 2.70 288


SPiiPlus .NET Library Programmer's Guide
7. Error Handling

Error
Error Message Remarks
Code

All channels are The maximum number of the concurrently opened


135
busy. communication channels is 10.

This error is returned by the OpenLogFile method if the


Invalid name of
136 specified log file name is invalid or more than 256
Log file.
characters.

Received message
is too long (more This error cannot be returned and is present for
137
than size of user compatibility with previous versions of the library.
buffer).

This error is returned by one of the an AppendBuffer or


The program
138 LoadBuffer method if ACSPL+ program contains a string
string is long.
longer than 2032 bytes.

Method
139 parameters are
invalid.

History buffer is
140
closed.

Name of variable
141
must be specified.

This error is returned by the ReadVariable,


Error in index ReadVariableAsScalar, ReadVariableAsVector,
142
specification. ReadVariableAsMatrix,WriteVariable methods if the From1,
To1, From2, To2 arguements were specified incorrectly.

Controller reply
This error is returned by the ReadVariable,
contains less
143 ReadVariableAsScalar, ReadVariableAsVector,
values than
ReadVariableAsMatrix, WriteVariable methods.
expected.

Function is not
145 supported in
current version

Internal error:
Error of thehistory
147
buffer
initialization.

Version 2.70 289


SPiiPlus .NET Library Programmer's Guide
7. Error Handling

Error
Error Message Remarks
Code

Unsolicited
150 messages buffer is
closed.

This error is returned by the EnableEvent method for any


Callback of the communication channels.
151
registration error.
Only PCI Bus communication supports user callbacks.

This error is returned by the EnableEvent method if the


Callback method
application tries to enable another event for the same
152 has been already
interrupt that was already used. Only one event can be
installed.
enabled for each interrupt.

Checksum of the
153 controllerresponse
is incorrect.

Internal library
error: The
154 controller replies
sequence is
invalid.

Internal library
155
error.

Internal library
error: Error of the
157 unsolicited
messages buffer
initialization.

Non-waiting call
158
has been aborted.

Error of the non-


159 waiting call
cancellation.

Internal error:
Queue of
160
transmitted
commands is full.

Version 2.70 290


SPiiPlus .NET Library Programmer's Guide
7. Error Handling

Error
Error Message Remarks
Code

The library cannot


send to the
Check physical connection with the controller (or settings)
162 specified
and try to reconnect.
communication
channel.

The library cannot


receive from the
Check physical connection with the controller (or settings)
163 specified
and try to reconnect.
communication
channel.

Internal library
164 error: Sending of
the chain is failed.

Specified IP
165 address is
duplicated.

There is no
166 Application with
such Handle.

Array name was


167
expected.

168 File is not Data File. Input file is not in ANSI format.

Application Saver
171
Loader CRC Error

Application Saver
172 Loader Header CRC
Error

Application Saver
173 Loader File Size
Error

Application Saver
174 Loader File Open
Error

Version 2.70 291


SPiiPlus .NET Library Programmer's Guide
7. Error Handling

Error
Error Message Remarks
Code

Application Saver
175 Loader Unknown
File Error

Application Saver
176 Loader Format
Version Error

Application Saver
177 Loader Section
Size is Zero

Internal library
179 error: Thread local
storage error.

Returned by the GetPCICards method in the following


cases:
PCI driver SpiiPlus PCI driver is not installed correctly.
180
initialization error. The version of the SpiiPlus PCI Bus driver is incorrect - in this
case, it is necessary to reinstall the SpiiPlus PCI driver
(WINDRIVER) and the library.

Pointer to the
buffer is invalid or
Null pointer
185
received instead
of user allocated
object

Specified priority
for the callback
189
thread cannot be
set

Cannot access
DPRAM directly
Returned by DPRAM access methods, when attempting to
190 through any
call them with Serial or Ethernet channels.
channel but PCI
and Direct.

Invalid DPRAM
Returned by DPRAM access methods, when attempting to
192 address was
access illegal address
specified

Version 2.70 292


SPiiPlus .NET Library Programmer's Guide
7. Error Handling

Error
Error Message Remarks
Code

This version of
simulator does not Returned by DPRAM access methods, when attempting to
193
support work with access old version Simulator that does not support DPRAM.
DPRAM.

Returned by methods that work with host file system


195 File not found. when a specified file name is not found.
Check the path and filename.

Returned by methods that analyze SPiiPlus application files


196 Not enough data when application file format is incorrect.
Check application file and replace with a valid file.

Returned by one of the OpenComm methods. Check the


The application following:
cannot establish SPiiPlus User Mode Driver is loaded (that is, the User Mode
197 communication Drive icon appears in the Task tray).
with the SPiiPlus SPiiPlus User Mode Driver shows an error message.
User Mode Driver In case of remote connection, access from a remote
application is enabled.

The controller does not reply for more than 20 seconds.


Returned by any method that exchanges data with the
controller. Check the following:
Controller is powered on (MPU LED is green)
198 Not responding
Controller connected properly to host
Controller executes a time consuming command like
compilation of a large program, save to flash, load to flash,
etc.

The DLL and the Returned by one of the OpenComm methods.


199 UMD versions are Verify that the files ACSCL_x86.DLL / ACSCL_x64.DLL and
not compatible. ACSCSRV.EXE are of the same version.

Error in array
601 and/or index
definition

Communication
602 channel is already
open

Argument Value
603
has incorrect type

Version 2.70 293


SPiiPlus .NET Library Programmer's Guide
7. Error Handling

Error
Error Message Remarks
Code

Argument Value is
604
not initialized

Variable name
605
must be specified

Wrong call type


606
was specified

607 Wrong return type

Version 2.70 294


1 Hataasia St
Ramat Gabriel Industrial Park
Migdal Ha’Emek 2307037 Israel
Tel: (+972) (4) 654 6440 Fax: (+972) (4) 654 6443

Contact us: [email protected] | www.acsmotioncontrol.com

You might also like