SPiiPlus .NET Library Programmer's Guide
SPiiPlus .NET Library Programmer's Guide
NET Library
Programmer's Guide
April 2019
Document Revision: 2.70
SPiiPlus .NET Library Programmer's Guide
COPYRIGHT
Changes are periodically made to the information in this document. Changes are published as release notes and later
incorporated into revisions of this document.
No part of this document may be reproduced in any form without prior written permission from ACS Motion Control.
TRADEMARKS
ACS Motion Control, SPiiPlus, PEG, MARK, ServoBoost, NetworkBoost and NanoPWN are trademarks of ACS Motion Control Ltd.
EtherCAT is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
Any other companies and product names mentioned herein may be the trademarks of their respective owners.
www.acsmotioncontrol.com
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
February
2.50.10 Replaced "GUI" with "command"
2018
December
2.50 Updated for SPiiPlus ADK Suite v2.50
2017
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
Format Description
Monospace + grey
Code example
background
Blue Hyperlink
Flagged Text
Warning - describes a condition that may result in serious bodily injury or death.
Version 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
Version 2.70 10
SPiiPlus .NET Library Programmer's Guide
Version 2.70 11
SPiiPlus .NET Library Programmer's Guide
Version 2.70 12
SPiiPlus .NET Library Programmer's Guide
Version 2.70 13
SPiiPlus .NET Library Programmer's Guide
Version 2.70 14
SPiiPlus .NET Library Programmer's Guide
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
Version 2.70 17
SPiiPlus .NET Library Programmer's Guide
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.
Version 2.70 19
SPiiPlus .NET Library Programmer's Guide
1. General Information
ACSC_
WAITBLOCK Wait block returned by Async method.
Waitblock
Return When asynchronous execution completes returns result of execution that can
Value be further cast to specific .NET type.
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.
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.
// 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.
// close communication
channel.CloseComm();
// close communication
channel.CloseComm();
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.
// open connections
channel1.OpenCommSimulator();
channel2.OpenCommSerial(1, 115200);
channel3.OpenCommPCI(Api.ACSC_NONE);
// 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.1 Redistribution
SPiiPlus NET Library is installed automatically by the SPiiPlus ADK Suite installation.
C#:
Using ACS.SPiiPlusNET;
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
Method Description
Version 2.70 26
SPiiPlus .NET Library Programmer's Guide
3. Methods
Method Description
OpenCommPCI Opens a communication channel with the controller via PCI Bus.
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
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
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
Version 2.70 28
SPiiPlus .NET Library Programmer's Guide
3. Methods
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
3.1.3 CancelOperation
Description
This method cancels asynchronous (non-waiting) call.
Syntax
object.CancelOperation(ACSC_WAITBLOCK wait)
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
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
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
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
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
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
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
Version 2.70 32
SPiiPlus .NET Library Programmer's Guide
3. Methods
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
Return Value
IPAddress[].
The method returns array of IP addresses of found SPiiPlus cards or empty array if no cards are
detected.
Example
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
/*...*/
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.
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
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.
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
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.
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
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
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
3.1.15 OpenCommSerial
Description
The method opens communication with the controller via a serial port.
Syntax
object.OpenCommSerial(int channel, int rate)
Arguments
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
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
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
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
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
Method Description
Version 2.70 39
SPiiPlus .NET Library Programmer's Guide
3. Methods
Method Description
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
Version 2.70 40
SPiiPlus .NET Library Programmer's Guide
3. Methods
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
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
Error Description
Example
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
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.
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
Return Value
None.
Example
In the following example, network variable of EtherCAT node 0 at offset 26 is being mapped to
global variable: I1.
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
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
count Internal count of devices with the same Product and Vendor IDs.
Return Value
Double.
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
Return Value
Double.
Example
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
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
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
slaveIndex Index of the desired EtherCAT slave, which can be determined by using the
Return Value
Double.
Example
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
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
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
Version 2.70 48
SPiiPlus .NET Library Programmer's Guide
3. Methods
Method Description
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
3.3.2 GetNETLibraryVersion
Description
Version 2.70 49
SPiiPlus .NET Library Programmer's Guide
3. Methods
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
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
3.3.5 GetErrorString
Description
The method retrieves the explanation of an error code.
Syntax
object.GetErrorString(ErrorCodes
Arguments
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
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
3.3.7 GetTimeout
Description
Version 2.70 52
SPiiPlus .NET Library Programmer's Guide
3. Methods
3.3.8 SetIterations
Description
The method sets the number of iterations in one transaction.
Syntax
object.SetIterations(int iterations)
Arguments
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
3.3.9 SetCommOptions
Description
The method sets the communication options.
Syntax
object.SetCommOptions(CommOptions options)
Arguments
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
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
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
Method Description
Clears the specified program buffer and then loads ACSPL+ program
LoadBuffer
to this 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
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
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
Version 2.70 56
SPiiPlus .NET Library Programmer's Guide
3. Methods
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
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
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
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
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
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
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 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
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
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
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
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
3.4.9 UploadBuffer
Description
The method uploads ACSPL+ program from the specified program buffer.
Syntax
object.UploadBuffer(ProgramBuffer buffer)
Arguments
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
Method Description
ReadVariable Reads variable from a controller and returns it in the form of object
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
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
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
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
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
Version 2.70 69
SPiiPlus .NET Library Programmer's Guide
3. Methods
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
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
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
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).
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
Dimension Indices
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
Version 2.70 79
SPiiPlus .NET Library Programmer's Guide
3. Methods
Methods Description
3.6.1 OpenHistoryBuffer
Description
The method opens a history buffer.
Syntax
object.OpenHistoryBuffer(int Size)
Arguments
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
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
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
Methods Description
3.7.1 OpenMessageBuffer
Description
The method opens an unsolicited messages buffer.
Syntax
object.OpenMessageBuffer(int size)
Arguments
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
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
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
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
Ch.ClearBuffer(ProgramBuffer.ACSC_BUFFER_0, 1, 1000);
Method Description
Version 2.70 84
SPiiPlus .NET Library Programmer's Guide
3. Methods
Method Description
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
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
3.8.3 WriteLogFile
Description
The method writes to log file.
Syntax
object.WriteLogFile(string buf)
Arguments
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
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
These methods can only be used with the SPiiPlusSC Motion Controller.
Method Description
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
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
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
3.9.3 WriteSCLogFile
Description
Version 2.70 88
SPiiPlus .NET Library Programmer's Guide
3. Methods
Return Value
None.
Remarks
The method writes data from a buffer to the SPiiPlusSC log file.
Example
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
Return Value
None.
Remarks
If Continuous Log is active, the function will fail.
Example
Version 2.70 89
SPiiPlus .NET Library Programmer's Guide
3. 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.
Method Description
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.
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
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
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.
from1,
Index range (first dimension) for one dimensional array variables.
to1
from2,
Index range (second dimension) for two dimensional matrix variables.
to2
Return Value
None.
Example
See Shared Memory Program Example.
Method Description
Version 2.70 92
SPiiPlus .NET Library Programmer's Guide
3. Methods
Method Description
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).
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
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).
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
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
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
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
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
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
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
Method Description
Version 2.70 98
SPiiPlus .NET Library Programmer's Guide
3. Methods
Method Description
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
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
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
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 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
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
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
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
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
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
3.12.6 GetAcceleration
Description
The method retrieves a value of motion acceleration.
Syntax
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
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
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.
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
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
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:
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
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
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
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 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
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
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
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
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
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
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
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
3.12.16 SetFPosition
Description
The method assigns a current value of feedback position.
Syntax
object.SetFPosition(Axis axis, double fPosition)
Async Syntax
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
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
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
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
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
3.12.19 GetRPosition
Description
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
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
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
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
Method Description
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
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
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
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
3.13.3 EnableM
Description
The method activates severalmotors.
Syntax
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
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.
If the method fails, the Error object is filled with the Error Description.
Example
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
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
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
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.
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
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
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
3.13.10 SplitAll
Description
The method breaks down all axis groups created before.
Syntax
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
Method Description
Synchronously starts up several motions that are waiting in the specified motion
GoM
queues.
Method Description
Terminates a motion using reduced deceleration profile and defines the kill
KillExt
reason.
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
// 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
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
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
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
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
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
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
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
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.
If the method fails, the Error object is filled with the Error Description.
Example
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.
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
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.
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
Method Description
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.
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.
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
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.
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
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.
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.
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
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
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.
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.
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
Method Description
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
Method Description
Method Description
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.
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.
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
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.
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
Method Description
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
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.
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
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:
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
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).
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.
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
Method Description
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.
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
3.19.2 MultiPointM
Description
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.
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.
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
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.
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).
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.
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
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])
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.
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
Method Description
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
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
{
// 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.
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
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
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
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.
Example
Method Description
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.
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
3.22.2 ExtendedSegmentedMotion
Description
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
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.
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
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.
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
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
3.22.4 ExtendedSegmentArc1
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
Async Syntax
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.
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.
3.22.5 ExtendedSegmentArc2
Description
The method adds an arc segment to a segmented motion and specifies the coordinates of the
center point and the rotation angle.
Syntax
Syntax
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.
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.
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
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);
Ch.Line(Axes, Point1);
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.
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
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
[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);
Function Description
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.
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
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.
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.
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
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
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.
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.
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
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
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.
Return Value
None from synchronous version, ACSC_WAITBLOCK from async version.
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 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
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);
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
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.
Return Value
None from synchronous version, ACSC_WAITBLOCK from async version.
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
Ch.EndSequenceM(Axes);
Method Description
Method Description
Informs the controller that no more points will be specified for the
EndSequence
current single-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.
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
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.
Example
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.
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
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
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.
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
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
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
Method Description
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.
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).
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
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
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);
Method Description
GetIndexState Retrieves the current state of the index and mark variables.
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
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
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)
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
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
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
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
Return Value
ProgramStates
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
Method Description
GetInputPort Retrieves the current state of the specified digital input port.
GetOutputPort Retrieves the current state of the specified digital output port.
SetOutputPort Sets the specified digital output port to the specified value.
Method Description
GetExtInputPort Retrieves the current state of the specified extended input port.
GetExtOutputPort Retrieves the current state of the specified extended output port.
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
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
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
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
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
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
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
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
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
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
4.4.6 SetOutputPort
Description
The method sets the specified digital output port to the specified value.
Syntax
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
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
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
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)
Async Syntax
object.GetExtInputAsync(int port, int bit)
Arguments
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
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
Return Value
Int32.
Remarks
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
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
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
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
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
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
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
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
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.
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
Method Description
GetFault Retrieves the set of bits that indicate the motor or system faults.
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.
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.
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
// 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.
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
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
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 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
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
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 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
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.
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
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.
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
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
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
Ch.EnableResponse(Axis.ACSC_AXIS_0,SafetyControlMasks.ACSC_SAFETY_PE);
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
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
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
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.
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
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)
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
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
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
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.
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.
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
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
Ch.FaultClearM(axes);
Method Description
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
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.
Example
4.6.2 WaitLogicalMotionEnd
Description
The method waits for the logical end of a motion.
Syntax
object.WaitLogicalMotionEnd (Axis axis, int timeout)
Arguments
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
4.6.3 WaitCollectEndExt
DESCRIPTION
The method waits for the end of data collection.
SYNTAX
object.WaitCollectEndExt(int timeout)
ARGUMENTS
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
4.6.4 WaitProgramEnd
Description
The method waits for the program termination in the specified buffer.
Syntax
object.WaitProgramEnd(ProgramBuffer buffer, int timeout)
Arguments
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.
Example
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
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
4.6.6 WaitMotorEnabled
Description
The method waits until the specified motor is commutated.
Syntax
object.WaitMotorEnabled (Axis axis, int state, int timeout)
Arguments
1 – the method waits for the motor to be enabled, 0 – the method waits for the
state
motor to be disabled.
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
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
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
Ch.WaitInput(0, 0, 1, timeout);
Method Description
4.7.1 EnableEvent
Description
The method enables event generation for the specified interrupt condition.
Syntax
object.EnableEvent(Interrupts flags)
Arguments
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
4.7.2 DisableEvent
Description
The method disables event generation for the specified interrupt condition.
Syntax
object.DisableEvent (Interrupts flags)
Arguments
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
4.7.3 SetInterruptMask
Description
The method sets the mask for specified interrupt.
Syntax
object.SetInterruptMask(Interrupts interrupt, Uint32 mask)
Arguments
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
4.7.4 GetInterruptMask
Description
The method retrieves the mask for specified interrupt.
Syntax
object.GetInterruptMask(Interrupts interrupt)
Arguments
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);
Method Description
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
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
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
Method Description
Method Description
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
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.
Example
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
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
Return Value
Double.
Receives the configuration data.
Example
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
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
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
Method Description
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
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
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
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
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
Method Description
Method Description
Waits for the all values to be loaded and the PEG engine to be ready
WaitPegReadyNT
to respond to movement.
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
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
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
Bit code for engine outputs to physical outputs mapping, see the PEG and
bitCode
MARK Operations Application Note.
Return Value
None.
Example
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.
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.
Bit code for engine outputs to physical outputs mapping, see the PEG and
bitCode
MARK Operations Application Note.
Return Value
None.
Example
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
Return Value
None.
Example
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
Return Value
None.
Example
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.
Return Value
None.
Example
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.
Return Value
None.
Example
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
Method Description
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
1 - In use
inuse
0 - Not in use
Properties
4.12.1.2 ACSC_APPSL_STRING
Description
This structure used for Application Saver / Loader functions.
Syntax
struct ACSC_APPSL_STRING
Properties
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
Values
ACSC_PROT_STRING
4.12.3 AnalyzeApplication
Description
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
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
Return Value
String – reserver for internal use
Example
ApplicationFileInfo info;
string fileName = "neededFile";
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
Return Value
String – reserved for internal use
Example
4.12.6 FreeApplication
Description
The method frees memory, previously allocated by the AnalyzeApplication method.
Syntax
object.FreeApplication (ApplicationFileInfo info)
Arguments
Return Value
None
Example
Ch.FreeApplication(info);
Method Description
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
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
4.13.2 UploadDataFromController
Description
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
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.
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
Method Description
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.
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
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.
Example
Method Description
4.15.1 ControllerReboot
Description
This method reboots controller and waits for processcompletion.
Syntax
object.ControllerReboot (int timeout)
Arguments
Return Value
None
Example
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
Return Value
If the method succeeds, the return value is non-zero. If the method fails, the return value is zero.
Example
Method Description
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
Return Value
None.
Example
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
Method Description
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
Return Value
Int32.
Example
The following code sample saves all axes parameters and buffers to flash, with two user arrays:
"MyArray" and"MyArray2".
Method Description
4.18.1 StartSPiiPlusSC
Description
The function starts the SPiiPlusSC controller.
Syntax
object.StartSPiiPlusSC()
Arguments
None
Return Value
None
Example
4.18.2 StopSPiiPlusSC
Description
The function stops the SPiiPlusSC controller.
Syntax
object.StopSPiiPlusSC()
Arguments
None
Return Value
None
Example
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.
ACSC_VER 0x63F1100
ACSC_FILE -2
ACSC_DC_VAR_MAX_NUMBER 10
ACSC_DEFAULT_REMOTE_PORT 9999
ACSC_NONE 0
ACSC_ALL -1
ACSC_AUTO -1
ACSC_ETHERCAT_1BYTE 0x00000001
ACSC_ETHERCAT_2BYTES 0x00000002
ACSC_ETHERCAT_4BYTES 0x00000004
ACSC_ETHERCAT_FLOAT 0x00000008
ACSC_AMF_
0x00000020 The slaved motion uses velocity lock.
VELOCITYLOCK
ACSC_AMF_
0x00010000 Decelerate to corner.
JUNCTIONVELOCITY
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
Syntax:
public enum GlobalDirection
Table 4-8. Global Direction Flags
ACSC_
0 Disables all data collections flags
NONE
ACSC_
Temporal data collection. The sampling period is calculated
DCF_ 0x00000001
automatically according to the collection time.
TEMPORAL
ACSC_AST_
0x00000001 Axis is leading in a group.
LEAD
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_IST_
0x00000001 Primary encoder index of the specified axis is latched.
IND
ACSC_IST_
0x00000002 Secondary encoder index of the specified axis is latched.
IND2
ACSC_
0 Disables all program state flags
NONE
ACSC_PST_
0x00000001 Program in the specified buffer is compiled.
COMPILED
ACSC_PST_
0x00000002 Program in the specified buffer is running.
RUN
ACSC_PST_
0x00000080 Auto routine in the specified buffer is running.
AUTO
ACSC_SAFETY_ Network
0x00000004 Network Error
NETWORK fault
System
ACSC_SAFETY_PROG 0x02000000 Program Error
fault
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.
ACSC_INTR_COMM_
32 Communication channel has been closed.
CHANNEL_CLOSED
ACSC_INTR_ETHERCAT_
29 EtherCAT error occurred.
ERROR
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_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_NONE 0
ACSC_ALL -1
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_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
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
ACSC_CONF _MFLAGS9_
204 Controls value of MFLAGS.9
KEY
ACSC_CONF_SP_OUT_
206 Reads SP output pins.
PINS_KEY
ACSC_CONF_BRAKE_OUT_
229 Controls brake method.
KEY
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
Syntax:
public enum RepresentationTypes
Table 4-20. Representation Types
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
Minimum 0
Medium 1
Maximum 2
Syntax:
public enum ACSC_LOG_DATA_PRESENTATION
Compact 0
Formatted 1
Full 2
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.
Event Interrupt
COMMCHANNELCLOSED () ACSC_INTR_COMM_CHANNEL_CLOSED
EMERGENCY () ACSC_INTR_EMERGENCY
ETHERCATERROR () ACSC_INTR_ETHERCAT_ERROR
NEWSEGM () ACSC_INTR_NEWSEGM
SOFTWAREESTOP () ACSC_INTR_SOFTWARE_ESTOP
SYSTEMERROR () ACSC_INTR_SYSTEM_ERROR
SYSTEMERROR () ACSC_INTR_ACSPL_PROGRAM_EX
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:
Any error code greater than 1000 is a controller error as defined in the SPiiPlus
Command & Variable Reference Guide.
Error
Error Message Remarks
Code
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.
Internal library
109 error: Invalid file
handle.
Internal library
122 error: Cannot open
Log file.
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.
Error
Error Message Remarks
Code
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).
Method
139 parameters are
invalid.
History buffer is
140
closed.
Name of variable
141
must be specified.
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.
Error
Error Message Remarks
Code
Unsolicited
150 messages buffer is
closed.
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.
Internal error:
Queue of
160
transmitted
commands is full.
Error
Error Message Remarks
Code
Internal library
164 error: Sending of
the chain is failed.
Specified IP
165 address is
duplicated.
There is no
166 Application with
such Handle.
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
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.
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
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.
Error in array
601 and/or index
definition
Communication
602 channel is already
open
Argument Value
603
has incorrect type
Error
Error Message Remarks
Code
Argument Value is
604
not initialized
Variable name
605
must be specified