SPiiPlus MATLAB Library Programmer's Guide
SPiiPlus MATLAB Library Programmer's Guide
Library
Programmer's Guide
April 2021
Document Revision: 3.10
SPiiPlus MATLAB Library Programmer's Guide
SPiiPlus MATLAB Library
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 3.10 2
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
1. Revision History
Date Revision Description
September
3.02 Add DataCollectionExt and DataCollectionExtAsync
2020
Version 3.10 3
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Format Description
Blue Hyperlink
Flagged Text
Version 3.10 4
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
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 ACS
Downloads.
Version 3.10 5
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Table of Contents
1. Revision History 3
2. General Information 19
2.1 General 19
2.2 Operating Environment 19
2.3 Communication Channels 19
2.4 Controller Simulation 19
2.5 Installation and Supplied Components 19
2.6 Asynchronous Calls Support 19
2.6.1 GetResult 20
2.7 Standard (SPiiPlus C Library) Features 20
2.8 Specific MATLAB Library Features 21
2.9 Communication Scenarios 22
3. Using the SPiiPlus MATLAB Library 24
3.1 Redistribution 24
3.2 MathWorks® MATLAB® 24
4. Methods 25
4.1 Communication Methods 26
4.1.1 Structures 27
4.1.1.1 ACSC_CONNECTION_DESC 27
4.1.1.2 ACSC_PCI_SLOT 27
4.1.1.3 ACSC_CONNECTION_INFO 27
4.1.2 Enumerations 28
4.1.2.1 ACSC_CONNECTION_TYPE 28
4.1.3 CancelOperation 28
4.1.4 Command 29
4.1.5 CloseComm 30
4.1.6 FlushLogFile 30
4.1.7 GetConnectionsList 31
4.1.8 GetEthernetCards 31
4.1.9 GetPCICards 32
4.1.10 OpenCommSimulator 33
4.1.11 OpenCommEthernetTCP 33
Version 3.10 6
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
4.1.12 OpenCommEthernetUDP 34
4.1.13 OpenCommPCI 34
4.1.14 OpenCommSerial 35
4.1.15 GetConnectionInfo 36
4.1.16 SetServerExtLogin 36
4.1.17 TerminateConnection 37
4.1.18 Transaction 38
4.2 EtherCAT® Methods 39
4.2.1 GetEtherCATState 39
4.2.2 GetEtherCATError 40
4.2.3 MapEtherCATInput 42
4.2.4 MapEtherCATOutput 43
4.2.5 UnmapEtherCATInputsOutputs 44
4.2.6 GetEtherCATSlaveIndex 44
4.2.7 GetEtherCATSlaveOffset 45
4.2.8 GetEtherCATSlaveVendorID 46
4.2.9 GetEtherCATSlaveProductID 46
4.2.10 GetEtherCATSlaveRevision 47
4.2.11 GetEtherCATSlaveType 48
4.2.12 GetEtherCATSlaveState 49
4.3 Service Communication Methods 49
4.3.1 GetACSCHandle 50
4.3.2 GetNETLibraryVersion 51
4.3.3 GetCommOptions 51
4.3.4 GetDefaultTimeout 52
4.3.5 GetErrorString 52
4.3.6 GetLibraryVersion 53
4.3.7 GetTimeout 54
4.3.8 SetIterations 54
4.3.9 SetCommOptions 55
4.3.10 SetTimeout 55
4.3.11 SetQueueOverflowTimeout 56
4.3.12 GetQueueOverflowTimeout 56
4.4 ACSPL+ Program Management Methods 57
Version 3.10 7
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
4.4.1 AppendBuffer 57
4.4.2 ClearBuffer 58
4.4.3 CompileBuffer 59
4.4.4 LoadBuffer 60
4.4.5 LoadBuffersFromFile 61
4.4.6 RunBuffer 62
4.4.7 StopBuffer 63
4.4.8 SuspendBuffer 64
4.4.9 UploadBuffer 65
4.5 Read and Write Variables Methods 66
4.5.1 ReadVariable 66
4.5.2 ReadVariableAsScalar 71
4.5.3 ReadVariableAsVector 73
4.5.4 ReadVariableAsMatrix 76
4.5.5 WriteVariable 78
4.6 History Buffer Management Methods 83
4.6.1 OpenHistoryBuffer 84
4.6.2 CloseHistoryBuffer 84
4.6.3 GetHistory 85
4.7 Unsolicited Messages Buffer Management Methods 86
4.7.1 OpenMessageBuffer 86
4.7.2 CloseMessageBuffer 87
4.7.3 GetSingleMessage 87
4.8 Log File Management Methods 88
4.8.1 SetLogFileOptions 88
4.8.2 OpenLogFile 89
4.8.3 CloseLogFile 90
4.8.4 WriteLogFile 90
4.8.5 GetLogData 91
4.9 SPiiPlusSC Log File Management Methods 92
4.9.1 OpenSCLogFile 92
4.9.2 CloseSCLogFile 93
4.9.3 WriteSCLogFile 93
4.9.4 FlushSCLogFile 93
Version 3.10 8
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 9
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 10
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 11
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 12
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 13
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 14
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 15
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
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 41
Table 3-5. Service Communication Methods 50
Table 3-6. ACSPL+ Program Management Methods 57
Table 3-7. Read and Write Variables Methods 66
Table 3-8. Value Dimension Indices 80
Table 3-9. History Buffer Management Methods 83
Table 3-10. Unsolicited Messages Buffer Management Methods 86
Table 3-11. Log File Management Methods 88
Table 3-12. SPiiPlusSC Log File Management Methods 92
Table 3-13. Shared Memory Methods 94
Table 3-14. System Configuration Methods 97
Table 3-15. Setting and Reading the Motion Parameters Methods 103
Table 3-16. Axis/Motor Management Methods 123
Table 3-17. Motion Management Methods 132
Table 3-18. Point-to-Point Motion Methods 144
Table 3-19. Track Motion Control Method 151
Table 3-20. Jog Methods 155
Table 3-21. Slaved Motion Methods 158
Table 3-22. Multi-Point Motion Methods 164
Table 3-23. Arbitrary Path Motion Methods 168
Table 3-24. PVT Methods 172
Table 3-25. Segmented Motion Methods 178
Table 3-26. Points and Segments Manipulation Methods 194
Table 3-27. Data Collection Methods 202
Table 3-28. Status Report Methods 206
Table 3-29. Inputs/Outputs Access Methods 211
Table 3-30. Safety Control Methods 224
Table 3-31. Wait-for-Condition Methods 240
Version 3.10 16
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 17
SPiiPlus MATLAB Library Programmer's Guide
1. Revision History
Version 3.10 18
SPiiPlus MATLAB Library Programmer's Guide
2. General Information
2. General Information
2.1 General
The SPiiPlus MATLAB Library provides the easiest way to incorporate SPiiPlus motion control
functionality.
The SPiiPlus MATLAB Library supports MathWorks® MATLAB® R2011b (v7.12) and later.
Version 3.10 19
SPiiPlus MATLAB Library Programmer's Guide
2. General Information
return ACSC_WAITBLOCK object that can be used to wait for operation completion and receive
operation results.
2.6.1 GetResult
Description
The method returns the result of a previous asynchronous call.
Syntax
result = object.Getresult(waitblock, timeout)
Arguments
Return Value
Remarks
To get a result of a previous asynchronous call GetResult method should be used. It receives the
wait block returned by async function and a timeout for wait operation. The return value of
GetResult method is .NET object that can be further cast to string, int or double type, according to
asynchronous function called.
If the method fails, the Error object is filled with the error description.
Example
Version 3.10 20
SPiiPlus MATLAB Library Programmer's Guide
2. General Information
One user client application can open up to ten communication channels simultaneously.
Different communication channels are usually connected to different controllers.
However, two or more communication channels can be connected to the same controller.
For example, an application can communicate with a controller through both the
controller's Ethernet channel and its serial channels.
> Acknowledgement for each command sent to the controller
The library automatically checks the status of each command sent by the user application
to the controller. The user application can check the status to confirm that the command
was received successfully.
> Communication history
The SPiiPlus MATLAB 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 MATLAB library supports setting and reading parameters, advanced motion control,
program management, I/O, safety, and more.
> Debug tools
The SPiiPlus MATLAB 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 3.10 21
SPiiPlus MATLAB Library Programmer's Guide
2. General Information
%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 MATLAB 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;
Version 3.10 22
SPiiPlus MATLAB Library Programmer's Guide
2. 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(10);
%get axis position
pos1 = channel1.GetFPosition(AxisDefs.ACSC_AXIS_1);
pos2 = channel2.GetFPosition(AxisDefs.ACSC_AXIS_2);
pos3 = channel3.GetFPosition(AxisDefs.ACSC_AXIS_3);
%close communication
channel1.CloseComm;
channel2.CloseComm;
channel3.CloseComm;
Version 3.10 23
SPiiPlus MATLAB Library Programmer's Guide
3. Using the SPiiPlus MATLAB Library
3.1 Redistribution
SPiiPlus MATLAB Library is installed automatically by the SPiiPlus ADK Suite installation.
Version 3.10 24
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4. Methods
This chapter details the methods available in the SPiiPlus MATLAB Library. Each method contains of
following documentation structure:
> 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: argument_name.
> Description of the arguments and their function.
> Return Value
> Remarks
> Example - A short MATLAB 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 Variables 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 3.10 25
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Method Description
Version 3.10 26
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.1.1 Structures
The Communication methods employ the following structures:
4.1.1.1 ACSC_CONNECTION_DESC
Description
This structure describes the connection information.
Syntax
ACSC_CONNECTION_DESC(application, handle, processId)
Members
4.1.1.2 ACSC_PCI_SLOT
Description
This structure defines a physical location of PCI card.
Syntax
ACSC_PCI_SLOT(busNumber, slotNumber, func)
Members
4.1.1.3 ACSC_CONNECTION_INFO
Description
This structure provides information about specified controller connection for an application. Used in
the GetConnectionInfo method.
Syntax
ACSC_CONNECTION_INFO(type, serialPort, serialBaudRate, pCISlot,
ethernetProtocol, ethernetIP, ethernetPort)
Members
Version 3.10 27
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.1.2 Enumerations
The Communication methods employ the following enums:
4.1.2.1 ACSC_CONNECTION_TYPE
Description
This enum is used for setting communication type. Used in the GetConnectionInfo method.
Values
4.1.3 CancelOperation
Description
This method cancels asynchronous (non-waiting) call.
Syntax
object.CancelOperation(wb);
Return Value
None.
Remarks
The method waits for the controller response. If the method fails, the Error object is filled with the
error description.
Version 3.10 28
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
4.1.4 Command
Description
The method sends a command to the controller and analyzes the controller response.
Syntax
object.Command(commandName);
Async Syntax
wb = object.CommandAsync(commandName);
Arguments
Return Value
None.
Return Value (async call)
Remarks
The method sends a vector of characters 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.
Example
Version 3.10 29
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.1.5 CloseComm
Description
The method closes communication via the specified communication channel.
Syntax
object.CloseComm;
Arguments
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
4.1.6 FlushLogFile
Description
The method allows flushing the User-Mode Driver (UMD) internal binary buffer to a specified text
file, from a user application.
Syntax
object.FlushLogFile(fileName);
Arguments
Vector of characters specifying the text file into which the buffer is to be
fileName
flushed
Return Value
None.
Remarks
If Continuous Log is active, the function will fail.
Example
Version 3.10 30
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.1.7 GetConnectionsList
Description
This method retrieves all currently opened connections on active server and their details.
Syntax
connectionsList = object.GetConnectionsList;
Arguments
None
Return Value
Remarks
Each connection is described by its handle, application name and process ID, therefore, all
arguments will have the same size and order, after the method returns.
This method can be used to check if there are some unused connections that remain from
applications that did not close the communication channel or were not gracefully closed
(terminated or killed).
Each returned connection can be terminated only by the TerminateConnection method.
Using any method of the SetServer family makes previously returned connections irrelevant
because it changes the active server.
Example
%Get active connections list, find application by name and terminate its
connection
name = 'neededApplication.exe';
connectionList = Ch.GetConnectionsList;
for i=1:length(connectionList)
if strcmp(name, connectionList(i).Application)
Ch.TerminateConnection( connectionList(i));
end
end
4.1.8 GetEthernetCards
Description
The method retrieves all SPiiPlus controller IP addresses within a local domain through a standard
Ethernet communication protocol.
Version 3.10 31
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Syntax
ethernetCards = object.GetEthernetCards(broadcast);
Arguments
Return Value
Example
4.1.9 GetPCICards
Description
This method retrieves information about the controller cards inserted in the computer PCI Bus.
Syntax
pciCards = object.GetPCICards;
Arguments
None
Return Value
Remarks
If no controller cards are detected, the method returns empty array, otherwise method fills the
array with information about the detected cards.
The slotNumber member of ACSC_PCI_SLOT. SlotNumber can be used in the OpenCommPCI call to
open communication with a specific card.
If the method fails, the Error object is filled with the error description.
Example
Version 3.10 32
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.1.10 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 MATLAB 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 MATLAB method works with the Simulator exactly as with a
physical controller.
If the method fails, the Error object is filled with the error description.
Example
4.1.11 OpenCommEthernetTCP
Description
The method opens communication with the controller via Ethernet using the TCP protocol.
Syntax
object.OpenCommEthernetTCP(address, port)
Arguments
Return Value
None.
Remarks
After a channel is open, any SPiiPlus MATLAB method works with the channel irrespective of the
physical nature of the channel.
Version 3.10 33
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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
4.1.12 OpenCommEthernetUDP
Description
The method opens communication with the controller via Ethernet using the UDP protocol.
Syntax
object.OpenCommEthernetUDP(address, port);
Arguments
Return Value
None.
Remarks
After a channel is open, any SPiiPlus MATLAB 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 to the controller.
If the method fails, the Error object is filled with the error description.
Example
4.1.13 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.
Version 3.10 34
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Syntax
object.OpenCommPCI(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 MATLAB 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
4.1.14 OpenCommSerial
Description
The method opens communication with the controller via a serial port.
Syntax
object.OpenCommSerial(channel, rate);
Arguments
Return Value
None.
Remarks
After a channel is open, any SPiiPlus COM 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.
Version 3.10 35
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
%Open serial communication through port COM1 with baud rate 115200
Ch.OpenCommSerial(1, 115200);
4.1.15 GetConnectionInfo
Description
The method is used to retrieve the details of opened communication channel.
Syntax
connInfo = object.GetConnectionInfo;
Arguments
None
Return Value
Example
4.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(iP, port, username, password, domain);
Arguments
Version 3.10 36
SPiiPlus MATLAB Library Programmer's Guide
4. 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
4.1.17 TerminateConnection
Description
This method terminates specified communication channel (connection) on active server.
Syntax
object.TerminateConnection(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 3.10 37
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
if ( strcmp(name, connectionList(i).Application) )
Ch.TerminateConnection( connectionList(i) );
end
end
4.1.18 Transaction
Description
The method executes one transaction with the controller, i.e., it sends a command and receives a
controller response.
Syntax
response = object.Transaction(command);
Async Syntax
wb = object.TransactionAsync(command);
Arguments
Return Value
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
Version 3.10 38
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Method Description
4.2.1 GetEtherCATState
Description
The method is used to retrieve the EtherCAT state.
Syntax
ethercatFlags = object.GetEtherCATState;
Async Syntax
wb = object.GetEtherCATStateAsync;
Arguments
None
Return Value
Version 3.10 39
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Remarks
The EtherCAT State contained in the variable designated by the State argument is defined by the
following bits:
Table 3-3. EtherCAT States
All bits (except #INSYNC in some cases) should be true for proper bus functioning. When monitoring
the bus state, checking bit #OP is enough. Any bus error will reset the #OP bit.
Example
4.2.2 GetEtherCATError
Description
The method is used to retrieve the last EtherCAT error code.
Syntax
etherCATError = object.GetEtherCATError;
Async Syntax
wb = object.GetEtherCATErrorAsync;
Arguments
None
Version 3.10 40
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Return Value
Remarks
The EtherCAT error codes are:
Table 3-4. EtherCAT Error Codes
Error Description
Example
Version 3.10 41
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.2.3 MapEtherCATInput
Description
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(flags, offset, variableName);
Async Syntax
wb = object.MapEtherCATInputAsync(flags, offset, variableName);
Arguments
Return Value
None.
Return Value (async call)
Example
In the following example, network variable of EtherCAT node 0 at offset 43 is being mapped to the
global variable: I0.
flags = MotionFlags.ACSC_NONE;
offset = 43;
varName = 'l0';
Version 3.10 42
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.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(flags, offset, variableName);
Async Syntax
wb = object.MapEtherCATOutputAsync(flags, offset, variableName);
Arguments
Return Value
None.
Return Value (async call)
Example
In the following example, network variable of EtherCAT node 0 at offset 26 is being mapped to
global variable: I1.
flags = MotionFlags.ACSC_NONE;
offset = 26;
varName = 'l1';
Version 3.10 43
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.2.5 UnmapEtherCATInputsOutputs
Description
The method resets all previous mapping defined by MapEtherCATInput and MapEtherCATOutput
methods.
The method call is legal only when the EtherCAT State is OP.
Syntax
object.UnmapEtherCATInputsOutputs;
Async Syntax
wb = object.UnmapEtherCATInputsOutputsAsync;
Arguments
None
Return Value
None.
Return Value (async call)
Example
4.2.6 GetEtherCATSlaveIndex
Description
The method retrieves the index of an EtherCAT slave according to provided parameters.
Syntax
index = object.GetEtherCATSlaveIndex(vendorID, productID, count);
Async Syntax
wb = object.GetEtherCATSlaveIndexAsync(vendorID, productID, count);
Arguments
Version 3.10 44
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Scalar representing Internal count of devices with the same Product and
count
Vendor IDs.
Return Value
Example
vendorID = 2;
productID = 270807122;
count = 0;
index = Ch.GetResult()
4.2.7 GetEtherCATSlaveOffset
Description
The method retrieves the offset of a network variable of a specified EtherCAT slave in EtherCAT
telegram.
Syntax
offset = object.GetEtherCATSlaveOffset(variableName, slaveIndex);
Async Syntax
wb = object.GetEtherCATSlaveOffsetAsync(variableName, slaveIndex);
Arguments
Return Value
Version 3.10 45
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
varName = 'Output';
slaveIndex = 3;
4.2.8 GetEtherCATSlaveVendorID
Description
The method retrieves the Vendor ID of a specified EtherCAT slave.
Syntax
venID = object.GetEtherCATSlaveVendorID(slaveIndex);
Async Syntax
wb = object.GetEtherCATSlaveVendorIDAsync(slaveIndex);
Arguments
Return Value
Example
slaveIndex = 3;
4.2.9 GetEtherCATSlaveProductID
Description
The method retrieves the Product ID of a specified EtherCAT slave.
Version 3.10 46
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Syntax
prodID = object.GetEtherCATSlaveProductID(slaveIndex);
Async Syntax
wb = object.GetEtherCATSlaveProductID(int slaveIndex);
Arguments
Return Value
Example
slaveIndex = 3;
4.2.10 GetEtherCATSlaveRevision
Description
The method retrieves the revision of a specified EtherCAT slave.
Syntax
revision = object.GetEtherCATSlaveRevision (slaveIndex);
Async Syntax
wb = object.GetEtherCATSlaveRevisionAsync (slaveIndex);
Arguments
Return Value
Version 3.10 47
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
slaveIndex = 3;
4.2.11 GetEtherCATSlaveType
Description
The method retrieves the type of a specified EtherCAT slave.
Syntax
type = object.GetEtherCATSlaveType(vendorID, productID);
Async Syntax
wb = object.GetEtherCATSlaveTypeAsync(vendorID, productID);
Arguments
Return Value
Remarks:
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
vendorID = 2;
productID = 270807122;
Version 3.10 48
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.2.12 GetEtherCATSlaveState
Description
The method retrieves the EtherCAT state of a specified EtherCAT slave.
Syntax
state = object.GetEtherCATSlaveState (slaveIndex);
Async Syntax
wb = object.GetEtherCATSlaveProductID(slaveIndex);
Arguments
Return Value
Remarks:
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
slaveIndex = 3;
Version 3.10 49
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Method Description
4.3.1 GetACSCHandle
Description
The method retrieves the SPiiPlus C Library communication handle.
Syntax
handle = object.GetACSCHandle;
Arguments
None.
Return Value
Remarks
The method retrieves the SPiiPlus C Library communication handle. If the method fails, the Error
object is filled with the error description.
Example
Version 3.10 50
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.3.2 GetNETLibraryVersion
Description
The method retrieves the SPiiPlus NET Library version number.
Syntax
version = object.GetNETLibraryVersion;
Arguments
None.
Return Value
Remarks
The SPiiPlus NET Library version consists of four (or less) numbers separated by points:
#.#.#.#. The binary version number is represented by 32-bit unsigned integer value. Each byte of
this value specifies one number in the following order: high byte of high word – first number, low
byte of high word – second number, high byte of low word – third number and low byte of low
word – forth number. For example the version “2.10” has the following binary representation
(hexadecimal format): 0x020A0000.
The first two numbers in the string form are obligatory. Any release version of the library consists
of two numbers. The third and fourth numbers specify an alpha or beta version, special or private
build, etc.
If the method fails, the Error object is filled with the error description.
Example
4.3.3 GetCommOptions
Description
The method retrieves the communication options.
Syntax
options = object.GetCommOptions;
Arguments
None.
Return Value
Remarks
To set the communication options call SetCommOptions.
Version 3.10 51
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
The return value is bit-mapped to represent the current communication options. Currently only the
following option flag is supported:
ACSC_COMM_USE_CHECKSUM - communication mode when each command sends to the controller
with checksum and the controller responds with checksum.
If the method fails, the Error object is filled with the error description.
Example
4.3.4 GetDefaultTimeout
Description
The method retrieves default communication timeout.
Syntax
timeout = object.GetDefaultTimeout;
Arguments
None.
Return Value
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
4.3.5 GetErrorString
Description
The method retrieves the explanation of an error code.
Syntax
errorStr = object.GetErrorString(errorCode);
Arguments
Version 3.10 52
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Return Value
Remarks
If the error relates to SPiiPlus MATLAB 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
4.3.6 GetLibraryVersion
Description
The method retrieves the legacy SPiiPlus C Library version number.
Syntax
libVersion = object.GetLibraryVersion;
Arguments
None.
Return Value
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
Version 3.10 53
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.3.7 GetTimeout
Description
The method retrieves communication timeout.
Syntax
timeout = object.GetTimeout;
Arguments
None.
Return Value
Remarks
If the method succeeds, the return value is the current timeout value in milliseconds. If the method
fails, the Error object is filled with the error description.
Example
4.3.8 SetIterations
Description
The method sets the number of iterations in one transaction.
Syntax
object.SetIterations(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 MATLAB 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.
Version 3.10 54
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
4.3.9 SetCommOptions
Description
The method sets the communication options.
Syntax
object.SetCommOptions(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, using bitor() operator. 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
4.3.10 SetTimeout
Description
The method sets the communication timeout.
Syntax
object.SetTimeout(timeout);
Version 3.10 55
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Arguments
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
4.3.11 SetQueueOverflowTimeout
Description
The method sets the Queue Overflow timeout.
Syntax
OBJECT.SETQUEUEOVERFLOWTIMEOUT(TIMEOUT);
Arguments
Return Value
None.
Example
4.3.12 GetQueueOverflowTimeout
Description
The method retrieves the Queue Overflow timeout.
Syntax
timeout = object.GetQueueOverflowTimeout;
Arguments
None.
Version 3.10 56
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Return Value
Example
Method Description
4.4.1 AppendBuffer
Description
The method appends one or more ACSPL+ lines to the program in the specified buffer.
Syntax
object.AppendBuffer(buffer, text);
Async Syntax
wb = object.AppendBufferAsync(buffer, text);
Version 3.10 57
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Arguments
Return Value
None.
Return Value (async call)
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
4.4.2 ClearBuffer
Description
Deletes the specified ACSPL+ program lines in the specified program buffer.
Syntax
object.ClearBuffer(buffer, fromLine, toLine);
Async Syntax
wb = object.ClearBufferAsync(buffer, fromLine, toLine);
Arguments
Version 3.10 58
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
If toLine is larger then the total number of lines in the specified program
buffer, the range includes the last program line.
If toLine is ACSC_MAX_LINE, the method deletes all lines in the specified
buffer.
Return Value
None.
Return Value (async call)
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
4.4.3 CompileBuffer
Description
The method compiles the ACSPL+ program in the specified program buffer(s).
Syntax
object.CompileBuffer(buffer)
Async Syntax
wb = object.CompileBufferAsync(buffer)
Arguments
Return Value
None.
Return Value (async call)
Version 3.10 59
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Remarks
The method compiles an ACSPL+ program in the specified program buffer or all programs in all
buffers if buffer is ACSC_NONE.
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
4.4.4 LoadBuffer
Description
The method clears the specified program buffer and then loads ACSPL+ program to this buffer.
Syntax
object.LoadBuffer(buffer, text);
Async Syntax
wb = object.LoadBufferAsync(buffer, text);
Arguments
Return Value
None.
Return Value (async call)
Version 3.10 60
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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
4.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(filename);
Arguments
filename Vector of characters representing name and path of the file to be loaded.
Return Value
None.
Remarks
The method analyzes the file, determines which program buffers should be loaded, clears them
and then loads ACSPL+ programs to those buffers.
Version 3.10 61
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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
filePath = 'C:\\ACSPLFile.txt';
%Opens a file to load
Ch.LoadBuffersFromFile(filePath);
4.4.6 RunBuffer
Description
The method starts up ACSPL+ program in the specified buffer.
Syntax
object.RunBuffer(buffer, label);
Async Syntax
wb = object.RunBufferAsync(buffer, label);
Arguments
Return Value
None.
Version 3.10 62
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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 powhere 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
4.4.7 StopBuffer
Description
The method stops the execution of ACSPL+ program in the specified buffer(s).
Syntax
object.StopBuffer(buffer);
Async Syntax
wb = object.StopBufferAsync(buffer);
Arguments
Version 3.10 63
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Return Value
None.
Return Value (async call)
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
4.4.8 SuspendBuffer
Description
The method suspends the execution of ACSPL+ program in the specified program buffer(s).
Syntax
object.SuspendBuffer(buffer);
Async Syntax
wb = object.SuspendBufferAsync(buffer);
Arguments
Return Value
None.
Version 3.10 64
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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
4.4.9 UploadBuffer
Description
The method uploads ACSPL+ program from the specified program buffer.
Syntax
reply = object.UploadBuffer(buffer);
Arguments
Return Value
Version 3.10 65
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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
Method Description
4.5.1 ReadVariable
Description
The method reads a variable from the controller.
Syntax
result = object.ReadVariable(variable, nBuf, from1, to1, from2, to2);
Async Syntax
wb = object.ReadVariableAsync(variable, nBuf, from1, to1, from2, to2);
Arguments
Version 3.10 66
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
from1, to1 Index range (first dimension) starting from zero. Default value: -1.
from2, to2 Index range (second dimension) starting from zero. Default value: -1.
Return Value
The type of return value is real or integer, depending on the type of controller
variable.
result 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 “-1”
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)
Version 3.10 67
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
The from1 and to1 should be equal and specify the index of the element. from2 and to2
should be omitted or specified as -1. 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)
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 -1. 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 to1 and 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
Version 3.10 68
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Version 3.10 69
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
%Reading a part of row 1 from element with index 0 till element with
%index 2:
%Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
%in the controller:
%Parameters: 'MyMatrix' - user variable name
%ProgramBuffer.ACSC_NONE - global variable
%rowIndex - from1, to1
%fromColumnIndex – from2
%toColumnIndex – to2
rowIndex = 1;
fromColumnIndex = 0;
toColumnIndex = 2;
obj = Ch.ReadVariable('MyMatrix', ProgramBuffer.ACSC_NONE, rowIndex,
rowIndex, fromColumnIndex, toColumnIndex);
%Now var is a vector of size 3
Version 3.10 70
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.5.2 ReadVariableAsScalar
Description
The method reads the variable from a controller and returns as a scalar.
Syntax
object.ReadVariableAsScalar (variable, nBuf, ind1, ind2);
Async Syntax
wb = object.ReadVariableAsScalarAsync(variable, nBuf, ind1, ind2);
Arguments
ind1 Index of first dimension (row number) starting from zero. Default value: -1
Return Value
The return value is scalar, that is, the type of return value is real or
result
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:
Version 3.10 71
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Version 3.10 72
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.5.3 ReadVariableAsVector
Description
The method reads a variable from a controller and returns it as vector.
Syntax
result object.ReadVariableAsVector(variable, nBuf, from1, to1, from2, to2);
Async Syntax
wb = object.ReadVariableAsVectorAsync(variable, nBuf, from1, to1, from2, to2);
Arguments
from1, to1 Index range (first dimension) starting from zero. Default value: -1.
from2, to2 Index range (second dimension) starting from zero. Default value: -1.
Return Value
The return value is a one-dimensional array (vector). The type of return value
result
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 -1.
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
Version 3.10 73
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Version 3.10 74
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
Version 3.10 75
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
%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
fromRowIndex = 0;
toRowIndex = 1;
columnIndex = 1;
var = Ch.ReadVariableAsVector('MyMatrix', ProgramBuffer.ACSC_NONE,
fromRowIndex, toRowIndex, columnIndex, columnIndex);
%Now var is a vector of size 2
4.5.4 ReadVariableAsMatrix
Description
The method reads the variable from a controller and returns it as matrix.
Syntax
result = object.ReadVariableAsMatrix(variable, nBuf, from1, to1, from2, to2)
Async Syntax
wb = object.ReadVariableAsMatrixAsync(variable, nBuf, from1, to1, from2, to2)
Arguments
from1, to1 Index range (first dimension) starting from zero. Default value: -1.
from2, to2 Index range (second dimension) starting from zero. Default value: -1.
Return Value
Version 3.10 76
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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 -1. 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 -1. 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 3.10 77
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
var = Ch.ReadVariableAsMatrix('VEL');
%or:
var = Ch.ReadVariableAsMatrix('VEL', ProgramBuffer.ACSC_NONE);
%now var is a matrix of size 1x8
4.5.5 WriteVariable
Description
The method writes a value defined as object to the controller variable(s).
Version 3.10 78
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Syntax
object.WriteVariable(value, variable, nBuf, from1, to1, from2, to2)
Async Syntax
wb = object.WriteVariableAsync(value, variable, nBuf, from1, to1, from2, to2)
Arguments
Return Value
None.
Return Value (async call)
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:
> Write value to whole variable
from1, to1, from2 and to2 indexes should be omitted or specified as -1. The value
dimension should correspond to the variable dimension as follows:
> If variable is scalar, value should be scalar, or vector of size 1, or matrix of size 1x1
> If variable is vector of size N, value should be vector of size N, or matrix of size 1xN, or
matrix of size Nx1
Version 3.10 79
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
> If variable is matrix of size NxM, value should be matrix of size NxM
> Writing a value to one element of vector (one-dimensional array)
The from1 and to1 should be equal and specify index of the element. from2 and to2 should
be omitted or specified as -1.
> Writing value to one element of matrix (two-dimensional array)
The from1 and to1 should be equal and specify row number. The from2 and TO2 should be
equal and specify column number.
> Writing a value to sub-vector (more then one element) of vector
The from1 and to1 should specify sub-vector index range, from1 should be less then to1.
The from2 and to2 should be omitted or specified as -1.
> Writing a value to row or part of row of matrix
The from1 and to1 should be equal and specify row number. The from2 and to2 should
specify elements range within the specified row, from2 should be less then to2.
> Writing a value to column or part of column of matrix
The from1 and to1 should specify rows range within the specified column, from1 should be
less than to1. The from2 and to2 should be equal and specify column number.
> Writing a value to sub-matrix of matrix
The from1 and to1 should specify rows range, from1 should be less then to1. The from2 and
to2 should specify columns range, from2 should be less then to2.
If indexes (from1, to1, from2, to2) are specified, their values must correspond to value dimensions
described below:
Table 3-8. Value Dimension Indices
Dimension Indeces
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.
Version 3.10 80
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
%Write variable
%Initialize scalar
scalar = 57600;
%Initialize vector
vector = repmat(1.1, 1, 8);
%Initialize matrix
matrix = repmat(2, 3, 4);
%Initialize subVector
subVector = repmat(3, 1, 2);
%Initialize subMatrix
subMatrix = repmat(4, 2, 2);
Version 3.10 81
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Version 3.10 82
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
%Writing value to column 2, from element with index 0 till element with
%index 1:
%Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
%in the controller:
%Parameters: subVector - value to be assigned to the
%variable
%'MyMatrix' - user variable name
%ProgramBuffer.ACSC_NONE - global variable
%fromRowIndx - from1
%toRowIndx – to1
%columnIndx – from2, to2
fromRowIndx = 0;
toRowIndx = 1;
columnIndx = 2;
Ch.WriteVariable(subVector, 'MyMatrix', ProgramBuffer.ACSC_NONE,
fromRowIndx, toRowIndx, columnIndx, columnIndx);
Method Description
Version 3.10 83
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.6.1 OpenHistoryBuffer
Description
The method opens a history buffer.
Syntax
object.OpenHistoryBuffer(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
4.6.2 CloseHistoryBuffer
Description
The method closes the history buffer and discards all stored history.
Syntax
object.CloseHistoryBuffer
Arguments
None.
Return Value
None.
Rermarks
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.
Version 3.10 84
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
4.6.3 GetHistory
Description
The method retrieves the contents of the history buffer.
Syntax
history = object.GetHistory(bClear);
Arguments
If TRUE, the method clears contents of the history buffer. If FALSE, the history
bClear
buffer content is not cleared.
Return Value
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.
Example
Version 3.10 85
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
%history buffer.
str = Ch.GetHistory(false);
Method Description
4.7.1 OpenMessageBuffer
Description
The method opens an unsolicited messages buffer.
Syntax
object.OpenMessageBuffer(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 command. For example, the disp command in an ACSPL+ program forces the controller
to send an unsolicited message.
Only one message buffer can be open for each communication channel.
The message buffer works as a FIFO buffer: GetSingleMessage extracts the earliest message
stored in the buffer. If GetSingleMessage extracts the messages slower than the controller
produces them, buffer overflow can occur, and some messages will be lost. Generally, the greater
the buffer, the less likely is buffer overflow to occur.
If the method fails, the Error object is filled with the error description.
Example
Version 3.10 86
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.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
4.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(timeout)
Arguments
Return Value
String.
Remarks
The method retrieves single unsolicited message from the message buffer.
Version 3.10 87
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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
bufferSize = 5000;
cmd = '?FPOS0';
timeout = 1000;
%The method opens an unsolicited messages
%buffer, size of the opened buffer is 5000
Ch.OpenMessageBuffer(bufferSize);
%Sending the command '?FPOS0'
Ch.Send(cmd);
%The method retrieves unsolicited message
%from the buffer and wait 1 second till a
%message arrives
message = Ch.GetSingleMessage(timeout);
Method Description
4.8.1 SetLogFileOptions
Description
The function sets the log file options.
Syntax
object.SetLogFileOptions(detailization, presentation);
Version 3.10 88
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Arguments
Compact: No more than the first ten bytes of each data string will be
logged. Non-printing characters will be represented in HexASCII code.
presentation Formatted: All the binary data will be logged. Non-printingcharacters
will be represented in Hex ASCII code.
Full: All the binary data will be logged as is.
Return Value
None.
Remarks
The function configures the log file options. The function may be called before or after the log file
is opened
Example
4.8.2 OpenLogFile
Description
The method opens a log file.
Syntax
object.OpenLogFile(filename);
Arguments
filename Vector of characters 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.
Version 3.10 89
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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
4.8.3 CloseLogFile
Description
The method closes the log file.
Syntax
object.CloseLogFile
Arguments
None.
Return Value
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
4.8.4 WriteLogFile
Description
The method writes to log file.
Syntax
object.WriteLogFile(buf)
Arguments
Version 3.10 90
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
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 COM Library version 5.0, this is no longer the case. See, FlushLogFile.
If the method fails, the Error object is populated with the error description.
Example
4.8.5 GetLogData
Description
The method is used to retrieve the data of firmware log.
Syntax
object.GetLogData;
Async Syntax
wb = object.GetLogDataAsync
Arguments
None.
Return Value
String.
Return Value (async call)
Example
Version 3.10 91
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
These methods can only be used with the SPiiPlusSC Motion Controller.
Method Description
4.9.1 OpenSCLogFile
Description
The method opens the SPiiPlusSC log file.
Syntax
object.OpenSCLogFile(filename);
Arguments
filename Vector of characters representing the name or path of the log file.
Return Value
None.
Remarks
The method opens a binary file that stores all SPiiPlusSC log history. The messages are written to
the file in binary format, i.e., exactly as they are received and sent, including all service bytes.
The main use of the SPiiPlusSC log file is for debugging purposes.
Example
Version 3.10 92
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
4.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
4.9.3 WriteSCLogFile
Description
The method writes to the SPiiPlusSC log file.
Syntax
object.WriteSCLogFile(buf);
Arguments
buf Vector of characters representing the string to be written to the log file.
Return Value
None.
Remarks
The method writes data from a buffer to the SPiiPlusSC log file.
Example
4.9.4 FlushSCLogFile
Description
The method enables flushing the SPiiPlusSC internal buffer to a specified text file from the .NET
Library application.
Version 3.10 93
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Syntax
object.FlushSCLogFile(filename, bClear);
Arguments
Return Value
None.
Remarks
If Continuous Log is active, the function will fail.
Example
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 SPiiPlusNT family product.
Method Description
4.10.1 GetSharedMemoryAddress
Description
The method reads the address of shared memory variable.
Version 3.10 94
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Syntax
address = object.GetSharedMemoryAddress(nBuf, var);
Async Syntax
wb = object.GetSharedMemoryAddressAsync(nBuf, var);
Arguments
Number of program buffer for local variable or ACSC_NONE for global and
nBuf
ACSPL+ variable.
Return Value
Example
See Shared Memory Program Example
4.10.2 ReadSharedMemoryInteger
Description
The method reads value(s) from an integer shared memory variable.
Syntax
result = object.ReadSharedMemoryInteger(address, from1, to1, from2, to2);
Arguments
from1, to1 Index range (first dimension) for one dimensional array variables.
from2, to2 Index range (second dimension) for two dimensional matrix variables.
Return Value
Example
See Shared Memory Program Example
4.10.3 ReadSharedMemoryReal
Description
The method reads value(s) from a real shared memory variable.
Version 3.10 95
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Syntax
result = object.ReadSharedMemoryReal( address, from1, to1, from2, to2);
Arguments
from1, to1 Index range (first dimension) for one dimensional array variables.
from2, to2 Index range (second dimension) for two dimensional matrix variables.
Return Value
4.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
from1, to1 Index range (first dimension) for one dimensional array variables.
from2, to2 Index range (second dimension) for two-dimensional matrix variables.
Return Value
None.
Example
See Shared Memory Program Example
CntValues = [ 1, 2, 3, 4 ];
address1 = Ch.GetSharedMemoryAddress(ProgramBuffer.ACSC_NONE,
Version 3.10 96
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
'intVariable');
Ch.WriteSharedMemoryVariable(intValues, address1, 0, 1, 0, 1);
intResults = Ch.ReadSharedMemoryInteger(address1, 0, 1, 0, 1);
realValues = [666.66, 777.77, 888.88, 999.99 ];
address2 = Ch.GetSharedMemoryAddress(ProgramBuffer.ACSC_NONE,
'realVariable');
Ch.WriteSharedMemoryVariable(realValues, address2, 0, 1, 0, 1);
realResults = Ch.ReadSharedMemoryReal(address2, 0, 1, 0, 1);
Method Description
4.11.1 SetConf
Description
The method writes system configuration data.
Syntax
object.SetConf(key, index, value)
Async Syntax
wb = object.SetConfAsync(key, index, value)
Version 3.10 97
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Arguments
Return Value
None.
Return Value (async call)
Remarks
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 ACSPL+ Command and Variable Guide.
If the method fails, the Error object is filled with the error description.
Example
4.11.2 GetConf
Description
The method reads system configuration data.
Syntax
conf = object.GetConf(key, index)
Async Syntax
wb = object.GetConfAsync(key, index)
Version 3.10 98
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Arguments
Return Value
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 ACSPL+ Commmand & Variable
Reference Guide.
If the method fails, the Error object is filled with the error description.
Example
4.11.3 GetVolatileMemoryUsage
Description
The function retrieves the volatile memory load in percentage.
Syntax
memUsg = object.GetVolatileMemoryUsage;
Async Syntax
wb = object.GetVolatileMemoryUsageAsync;
Arguments
None
Return Value
Version 3.10 99
SPiiPlus MATLAB Library Programmer's Guide
4. Methods
Example
4.11.4 GetVolatileMemoryTotal
Description
The function retrieves the amount of total volatile memory.
Syntax
memTotal = object.GetVolatileMemoryTotal;
Async Syntax
wb = object.GetVolatileMemoryTotalAsync
Arguments
None
Return Value
Example
4.11.5 GetVolatileMemoryFree
Description
The function retrieves the amount of free volatile memory.
Syntax
freeMem = object.GetVolatileMemoryFree;
Async Syntax
wb = object.GetVolatileMemoryFreeAsync;
Arguments
None
Return Value
Example
4.11.6 GetNonVolatileMemoryUsage
Description
The function retrieves the non-volatile memory load in percentage.
Syntax
memUsg = object.GetNonVolatileMemoryUsage;
Async Syntax
wb = object.GetNonVolatileMemoryUsageAsync;
Arguments
None
Return Value
Example
4.11.7 GetNonVolatileMemoryTotal
Description
The function retrieves the amount of total non-volatile memory.
Syntax
memTotal = object.GetNonVolatileMemoryTotal;
Async Syntax
wb = object.GetNonVolatileMemoryTotalAsync;
Arguments
None
Return Value
Example
4.11.8 GetNonVolatileMemoryFree
Description
The function retrieves the amount of free non-volatile memory.
Syntax
freeMem = object.GetNonVolatileMemoryFree;
Async Syntax
wb = object.GetNonVolatileMemoryFreeAsync;
Arguments
None
Return Value
Example
Method Description
Method Description
4.12.1 SetVelocity
Description
The method defines a value of motion velocity.
Syntax
object.SetVelocity(axis, velocity);
Async Syntax
wb = object.SetVelocityAsync(axis velocity);
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.
Return Value (async call)
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 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
4.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, velocity);
Async Syntax
wb = object.SetVelocityImmAsync(axis, 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
4.12.3 GetVelocity
Description
The method retrieves a value of motion velocity.
Syntax
velocity = object.GetVelocity(axis);
Async Syntax
wb = object.GetVelocityAsync(axis);
Arguments
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
4.12.4 SetAcceleration
Description
The method defines a value of motion acceleration.
Syntax
object.SetAcceleration(axis, acceleration);
Async Syntax
wb = object. SetAccelerationImmAsync(axis, acceleration);
Arguments
The scalar value specifies required motion acceleration. The value will
acceleration
be used in the subsequent motions except the master-slave motions.
Return Value
None.
Return Value (async call)
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
4.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, acceleration);
Async Syntax
wb = object. SetAccelerationImmAsync(axis, acceleration);
Arguments
Return Value
None.
Return Value (async call)
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 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
4.12.6 GetAcceleration
Description
The method retrieves a value of motion acceleration.
Syntax
acceleration = object.GetAcceleration(axis);
Async Syntax
wb = object.GetAccelerationAsync(axis);
Arguments
Return Value
Example
4.12.7 SetDeceleration
Description
The method defines a value of motion deceleration.
Syntax
object.SetDeceleration(axis, deceleration);
Async Syntax
wb = object.SetDecelerationAsync(axis, deceleration);
Arguments
The scalar value specifies a required motion deceleration. The value will
deceleration
be used in the subsequent motions except the master-slave motions.
Return Value
None.
Return Value (async call)
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
4.12.8 SetDecelerationImm
Description
The method defines a value of motion deceleration. Unlike SetDeceleration, the method
immediatly affects any executed or intended motion.
Syntax
object.SetDecelerationImm(axis, deceleration);
Async Syntax
wb = object.SetDecelerationImmAsync(axis, deceleration);
Arguments
Return Value
None.
Return Value (async call)
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 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
4.12.9 GetDeceleration
Description
The method retrieves a value of motion deceleration.
Syntax
deceleration = object.GetDeceleration(axis);
Async Syntax
wb = object.GetDecelerationAsync(axis);
Arguments
Return Value
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
4.12.10 SetJerk
Description
The method defines a value of motion jerk.
Syntax
object.SetJerk(axis, jerk);
Async Syntax
wb = object.SetJerkAsync(axis, jerk);
Arguments
The scalar value specifies a required motion jerk. The value will be used in the
jerk
subsequent motions except for the master-slave motions.
Return Value
None.
Return Value (async call)
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
4.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, jerk);
Async Syntax
wb = object.SetJerkImmAsync(axis, jerk);
Arguments
Return Value
None.
Return Value (async call)
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 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
4.12.12 GetJerk
Description
The method retrieves a value of motion jerk.
Syntax
jerk = object.GetJerk(axis);
Async Syntax
wb = object.GetJerkAsync(axis);
Arguments
Return Value
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
4.12.13 SetKillDeceleration
Description
The method defines a value of motion kill deceleration.
Syntax
object.SetKillDeceleration(axis, killDeceleration);
Async Syntax
wb = object.SetKillDecelerationAsync(axis, killDeceleration);
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 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
4.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 planned motion.
Syntax
object.SetKillDecelerationImm(axis, killDeceleration);
Async Syntax
object.SetKillDecelerationImmAsync(axis, killDeceleration);
Arguments
Return Value
None.
Return Value (async call)
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 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
4.12.15 GetKillDeceleration
Description
The method retrieves a value of motion kill deceleration.
Syntax
killDecl = object.GetKillDeceleration(axis);
Async Syntax
wb = object.GetKillDecelerationAsync(axis);
Arguments
Return Value
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
4.12.16 SetFPosition
Description
The method assigns a current value of feedback position.
Syntax
object.SetFPosition(axis, fPosition);
Async Syntax
wb = object.SetFPositionAsync(axis, fPosition);
Arguments
fPosition The scalar value specifies the current value of feedback position.
Return Value
None.
Return Value (async call)
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
4.12.17 GetFPosition
Description
The method retrieves the current value of the motor feedback position.
Syntax
fPosition = object.GetFPosition(axis);
Async Syntax
wb = object.GetFPositionAsync(axis);
Arguments
Return Value
fPosition Scalar specifying the current 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
4.12.18 SetRPosition
Description
The method assigns a current value of reference position.
Syntax
object.SetRPosition(axis, rPosition);
Async Syntax
wb = object.SetRPositionAsync(axis, rPosition);
Arguments
rPosition The sacalar value specifies the current value of reference position.
Return Value
None.
Return Value (async call)
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
4.12.19 GetRPosition
Description
The method retrieves an instant value of the motor reference position.
Syntax
rPosition = object.GetRPosition(axis);
Async Syntax
wb = object.GetRPositionAsync(axis);
Arguments
Return Value
rPosition Scalar specifying 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
4.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
fVel = object.GetFVelocity(axis);
Async Syntax
wb = object.GetFVelocityAsync(axis);
Arguments
Return Value
fVel Scalar specifying the instantaneous value of the motor feedback velocity.
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
4.12.21 GetRVelocity
Description
The method retrieves an instant value of the motor reference velocity.
Syntax
rVel = object.GetRVelocity(axis);
Async Syntax
wb = object.GetRVelocityAsync(axis);
Arguments
Return Value
rVel Scalar specifying the instantaneous 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
4.13.1 Commut
Description
The method initiates motor commutation.
Syntax
object.Commut(axis);
Async Syntax
wb = object.CommutAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Commutate axis 0
Ch.Commut(AxisDefs.ACSC_AXIS_0);
%or
%Commutate axis 0 asynchronuously
wb = Ch.CommutAsync(AxisDefs.ACSC_AXIS_0);
4.13.2 Enable
Description
The method activates an axis.
Syntax
object.Enable(axis);
Async Syntax
wb = object.EnableAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%or
%Enable axis 0 asynchronuously
wb = Ch.EnableAsync(AxisDefs.ACSC_AXIS_0);
4.13.3 EnableM
Description
The method activates several motors.
Syntax
object.EnableM(axes);
Async Syntax
wb = object.EnableMAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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
4.13.4 Disable
Description
The method shuts off an axis.
Syntax
object.Disable(axis);
Async Syntax
wb = object.DisableAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Disable axis 0
Ch.Disable(AxisDefs.ACSC_AXIS_0);
%or
%Disable axis 0 asynchronuously
wb = Ch.DisableAsync(AxisDefs.ACSC_AXIS_0);
4.13.5 DisableAll
Description
The method shuts off all axes.
Syntax
object.DisableAll;
Async Syntax
wb = object.DisableAllAsync;
Arguments
None.
Return Value
None.
Return Value (async call)
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
4.13.6 DisableExt
Description
The method shuts off an axis and defines the disable reason.
Syntax
object.DisableExt(axis, reason);
Async Syntax
wb = object.DisableExtAsync(axis, reason);
Arguments
Integer number that defines the reason of disabling the axis. The specified
reason value 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
timeout = 5000;
myCode = 10;
%Disable axis 0 with internal customer code
Ch.DisableExt(AxisDefs.ACSC_AXIS_0, myCode);
%or
%Disable axis 0 with internal customer code asynchronuously
wb = Ch.DisableExtAsync(AxisDefs.ACSC_AXIS_0, myCode);
% Set value of motor state to 0 corresponding to MotorStates.ACSC_NONE
motorState = MotorStates.GetValue(MotorStates.ACSC_NONE);
%Wait till axis 0 is commutated during 5 sec
Ch.WaitMotorCommutated(AxisDefs.ACSC_AXIS_0, motorState, timeout);
4.13.7 DisableM
Description
The method shuts off several axes.
Syntax
object.DisableM(axes);
Async Syntax
wb = object.DisableMAsync(axes);
Arguments
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
4.13.8 Group
Description
The method creates a coordinate system for a multi-axis motion.
Syntax
object.Group(axes);
Async Syntax
wb = object.GroupAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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 to only one group at a time. If the application requires restructuring the axes, it
must split the existing group and only then create the new one. 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
4.13.9 Split
Description
The method breaks down a previously created axis group.
Syntax
object.Split(axes);
Async Syntax
wb = object.Split(axes);
Arguments
Return Value
None.
Return Value (async call)
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
4.13.10 SplitAll
Description
The method breaks down all axis groups created before.
Syntax
object.SplitAll;
Async Syntax
wb = object.SplitAllAsync;
Arguments
None.
Return Value
None.
Return Value (async call)
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
%or
%Split all groups created before asynchronuously
wb = Ch.SplitAllAsync;
Method Description
Terminates a motion using reduced deceleration profile and defines the kill
KillExt
reason.
4.14.1 Go
Description
The method starts up a motion waiting in the specified motion queue.
Syntax
object.Go(axis);
Async Syntax
wb = object.GoAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is commutated during 5 sec
Ch.WaitMotorCommutated(AxisDefs.ACSC_AXIS_0,motorState, timeout);
%Wait till GO command executed on axis 0,target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_WAIT, AxisDefs.ACSC_AXIS_0,10000);
%Motion Start
Ch.Go(AxisDefs.ACSC_AXIS_0);
%or
%Motion Start asynchronuously
wb = Ch.GoAsync(AxisDefs.ACSC_AXIS_0);
%Finish the motion, End of multi-point motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.14.2 GoM
Description
The method synchronously starts up several motions that are waiting in the specified motion
queues.
Syntax
object.GoM(axes);
Async Syntax
wb = object.GoMAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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
4.14.3 Halt
Description
The method terminates a motion using the full deceleration profile.
Syntax
object.Halt(axis);
Async Syntax
object.HaltAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
%Relative motion of axis 0,target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, AxisDefs.ACSC_AXIS_0, 10000);
%Halt executed to axis 0
Ch.Halt(AxisDefs.ACSC_AXIS_0);
%or
%Halt executed to axis 0 asynchronuously
wb = Ch.HaltAsync(AxisDefs.ACSC_AXIS_0);
%Finish the motion
%End of the multi-point motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.14.4 HaltM
Description
The method terminates several motions using the full deceleration profile.
Syntax
object.HaltM(axes);
Async Syntax
wb = object.HaltMAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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
wb = Ch.HaltMAsync(axes);
%Finish the motion
%End of the multi-point motion
Ch.EndSequenceM(axes);
4.14.5 Kill
Description
The method terminates a motion using reduced deceleration profile.
Syntax
object.Kill(axis);
Async Syntax
wb = object.KillAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Enable axes 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
%Relative motion of axis 0,target position of 10000
4.14.6 KillAll
Description
The method terminates all currently executed motions.
Syntax
object.KillAll;
Async Syntax
wb = object.KillAllAsync;
Arguments
None.
Return Value
None.
Return Value (async call)
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
4.14.7 KillM
Description
The method terminates several motions using reduced deceleration profile.
Syntax
object.KillM(axes);
Async Syntax
wb = object.KillMAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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
4.14.8 KillExt
Description
The method terminates a motion using reduced deceleration profile and defines the kill reason.
Syntax
object.KillExt(axis, reason);
Async Syntax
wb = object.KillExtAsync(axis, reason);
Arguments
Integer number that defines the reason of disabling the axis. The specified
reason value is stored in the MERR variable in the controller and so modifies the
state of the disabled motor.
Return Value
None.
Return Value (async call)
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
myCode = 10;
timeout = 5000;
%Enable axes 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
%Relative motion of axis 0,target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, AxisDefs.ACSC_AXIS_0, 10000);
%Kill axis 0 with internal customer code
Ch.KillExt(AxisDefs.ACSC_AXIS_0, myCode);
%or
% %Kill axis 0 with internal customer code asynchronuously
wb = Ch.KillExtAsync(AxisDefs.ACSC_AXIS_0, myCode);
%Finish the motion
%End of the multi-point motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.14.9 Break
Description
Terminates a motion immediately and provides a smooth transition to the next motion.
Syntax
object.Break(axis);
Async Syntax
wb = object.BreakAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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 no effect.
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 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
timeout = 5000;
%Enable axes 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
%Relative motion of axis 0,target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, AxisDefs.ACSC_AXIS_0, 10000);
%Executing of break to axis 0
Ch.Break(AxisDefs.ACSC_AXIS_0);
%or
%Executing of break to axis 0 asynchronuously
wb = Ch.BreakAsync(AxisDefs.ACSC_AXIS_0);
%Change the end of the point to point 0 on the fly
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, AxisDefs.ACSC_AXIS_0, 0);
%Finish the motion
4.14.10 BreakM
Description
Terminates several motions immediately and provides a smooth transition to the next motions.
Syntax
object.BreakM(axes);
Async Syntax
wb = object.BreakMAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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
4.15.1 ToPoint
Description
The method initiates a single-axis motion to the specified point.
Syntax
object.ToPoint(flags, axis, point);
Async Syntax
wb = object.ToPointAsync(flags, axis, 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 Go 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.
For the MotionFlags constants see Motion Flags.
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
4.15.2 ToPointM
Description
The method initiates a multi-axis motion to the specified point.
Syntax
object.ToPointM(flags, axes, points);
Async Syntax
wb = object.ToPointMAsync(flags, axes, points);
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.
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_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.
For the MotionFlags constants see Motion Flags.
Array of the target coordinates. The number and order of values must
points correspond to the axes array. The point must specify a value for each
element of axes except the last ACSC_AXIS_NONE 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 method. To execute motion with other
motion velocity or non-zero end velocity, use ExtToPoint or ExtToPointM methods.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end. To wait for the motion end, use
WaitMotionEnd method.
The motion builds the velocity profile using the required values of velocity, acceleration,
deceleration, and jerk of the 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
4.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(flags, axis, point, velocity, endVelocity);
Async Syntax
wb = object.ExtToPointAsync(flags, axis, point, velocity, endVelocity);
Arguments
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.
Return Value (async call)
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
timeout = 5000;
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
% Set motion flags to Ch.ACSC_AMF_VELOCITY Or Ch.ACSC_AMF_ENDVELOCITY
flags = bitor(MotionFlags.ACSC_AMF_VELOCITY, MotionFlags.ACSC_AMF_
ENDVELOCITY);
startMotionVelocity = 5000;
endMotionVelocity = 1000;
targetPoint = 10000;
%Initiate motion with ExtToPoint
Ch.ExtToPoint(flags,AxisDefs.ACSC_AXIS_0, targetPoint,
startMotionVelocity, endMotionVelocity);
%or
%Initiate motion with ExtToPoint asynchronuously
wb = Ch.ExtToPointAsync(flags,AxisDefs.ACSC_AXIS_0, targetPoint,
startMotionVelocity, endMotionVelocity);
%Wait motion motion during 20 sec
Ch.WaitMotionEnd(AxisDefs.ACSC_AXIS_0,timeout*4);
%Finish the motion
%End of the multi-point motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.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(flags, axes, points, velocity, endVelocity);
Async Syntax
wb = object.ExtToPointMAsync(flags, axes, points, velocity, endVelocity);
Arguments
Array of the target coordinates. The number and order of values must
points correspond to the axes array. The point must specify a value for each
element of axes except the last ACSC_AXIS_NONE 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.
Return Value (async call)
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
Method Description
4.16.1 Track
Description
The method initiates a single-axis track motion.
Syntax
object.Track(flags, axis);
Async Syntax
wb = object.TrackAsync(flags, axis);
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.
For the MotionFlags constants see Motion Flags
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
%Controll the motion of the axis 0 with Track
Ch.Track(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_0);
%or
%Controll the motion of the axis 0 with Track asynchronuously
wb = Ch.TrackAsync(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_0);
%Set target position to 5000
result = Ch.Transaction('TPOS0=5000');
4.16.2 SetTargetPosition
Description
The method assigns a current value of track position.
Syntax
object.SetTargetPosition(axis, targetPosition);
Async Syntax
wb = object. SetTargetPositionAsync(axis, targetPosition);
Arguments
Return Value
None.
Return Value (async call)
Remarks
The method assigns a current value to the Track position. If the corresponding axis is initialized with
track motion, the change of TPOS will cause generation of ptp motion to that new value.
For more information see the explanation of the track command in the SPiiPlus ACSPL+
Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, 5000);
%Set target position to zero
Ch.SetTargetPosition(AxisDefs.ACSC_AXIS_0, 0);
%OR set target position to zero asynchronuously
Ch.SetTargetPosition(AxisDefs.ACSC_AXIS_0, 0);
Ch.Track(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_0);
4.16.3 GetTargetPosition
Description
The method retrieves a current value of track position.
Syntax
position = object.GetTargetPosition(axis);
Async Syntax
wb = object. SetTargetPositionAsync(axis);
Arguments
Return Value
Remarks
The method reads a current value of the corresponding TPOS variable. If the corresponding axis is
initialized with track motion, TPOS controls the motion of the axis.
For more information see the explanation of the track command in the SPiiPlus ACSPL+
Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, 5000);
%Retreive target position to zero
position = Ch.GetTargetPosition(AxisDefs.ACSC_AXIS_0);
%OR retreive target position asynchronuously
wb = Ch.GetTargetPosition(AxisDefs.ACSC_AXIS_0);
position = Ch.GetResult(wb, 2000);
Method Description
4.17.1 Jog
Description
The method initiates a single-axis jog motion.
Syntax
object.Jog(flags, axis, velocity);
Async Syntax
wb = object.JogAsync(flags, axis, velocity);
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
Go method is executed.
flags
ACSC_AMF_VELOCITY: the motion will use velocity specified by the Velocity
argument instead of the default velocity.
For the MotionFlags constants see Motion Flags
Return Value
None.
Return Value (async call)
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
timeout = 5000;
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
%Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
%Initiate a single-axis jog motion to axis 0 to positive direction with
%the specified velocity 10000
Ch.Jog(MotionFlags.ACSC_AMF_WAIT, AxisDefs.ACSC_AXIS_0,10000);
%or
%Initiate a single-axis jog motion asynchronuously
wb = Ch.JogAsync(MotionFlags.ACSC_AMF_WAIT, AxisDefs.ACSC_AXIS_0,10000);
%Finish the motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.17.2 JogM
Description
The method initiates a multi-axis jog motion.
Syntax
object.JogM(flags, axes, direction, velocity);
Async Syntax
wb = object.JogMAsync(flags, axes, direction, velocity);
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_VELOCITY: the motion will use velocity specified by the Velocity
argument instead of the default velocity.
For the MotionFlags constants see Motion Flags
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 any reason.
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
Method Description
4.18.1 SetMaster
Description
The method initiates calculating of master value for an axis.
Syntax
object.SetMaster(axis, formula);
AsyncSyntax
wb = object.SetMasterAsync(axis, formula);
Arguments
formula Vector of characters that specifies a rule for calculating master value.
Return Value
None.
Return Value (async call)
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 for the 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 its operands.
If the method fails, the Error object is filled with the error description.
Example
4.18.2 Slave
Description
The method initiates a master-slave motion.
Syntax
object.Slave(flags, axis);
Async Syntax
wb = object.SlaveAsync(flags, axis);
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).
For the MotionFlags constants see Motion Flags
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
%factor equal 2
mFormula = '2*T_FPOS';
axes = AxisDefs.ToNetArray(AxisDefs.ACSC_AXIS_2, AxisDefs.ACSC_AXIS_3,
AxisDefs.ACSC_NONE);
%Enable axes ZT
Ch.EnableM(axes);
%Set master formula “Z_MPOS=2 * T_FPOS”
Ch.SetMaster(AxisDefs.ACSC_AXIS_2, mFormula);
%Set axis Z to slave
Ch.Slave(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_2);
%or
%Set axis Z to slave asynchronuously
wb = Ch.SlaveAsync(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_2);
%Relative motion with target position of 10000
4.18.3 SlaveStalled
Description
The method initiates master-slave motion within predefined limits.
Syntax
object.SlaveStalled(flags, axis, left, right);
Async Syntax
wb = object.SlaveStalledAsync(flags, axis, left, 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).
For the MotionFlags constants see Motion Flags.
Return Value
None.
Return Value (async call)
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 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
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
%factor equal 2
mFormula = '2*T_FPOS';
axes = AxisDefs.ToNetArray(AxisDefs.ACSC_AXIS_2, AxisDefs.ACSC_AXIS_3,
AxisDefs.ACSC_NONE);
%Enable axes ZT
Ch.EnableM(axes);
%Set master formula “Z_MPOS=2 * T_FPOS”
Ch.SetMaster(AxisDefs.ACSC_AXIS_2, mFormula);
%Left (negative) limit of the following area,right (positive) limit of
the
%following area
%Initiate master-slave motion
Ch.SlaveStalled(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_2,-5000,5000);
%or
%Initiate master-slave motion asynchronuously
wb = Ch.SlaveStalledAsync(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_2,-
5000,5000);
%Relative motion with target position of 10000
Ch.ToPoint(MotionFlags.ACSC_AMF_RELATIVE, AxisDefs.ACSC_AXIS_3, 10000);
%Finish the motion
Method Description
4.19.1 MultiPoint
Description
The method initiates a single-axis multi-point motion.
Syntax
object.MultiPoint(flags, axis, dwell);
Async Syntax
wb = object.MultiPointAsync(flags, axis, 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
flags 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.
For the MotionFlags constants see Motion Flags.
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
timeout = 5000;
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, timeout);
%Create multi-point motion of axis 0 with default velocity with dwell 1
ms
Ch.MultiPoint(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_0, 1)
% or
% Create multi-point motion asynchronuously
wb = Ch.MultiPointAsync(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_0, 1);
%Add some points
for index = 0:4
Ch.AddPoint(AxisDefs.ACSC_AXIS_0, 100 * index)
end
%Finish the motion
4.19.2 MultiPointM
Description
The method initiates a multi-axis multi-point motion.
Syntax
object.MultiPointM(flags, axes, dwell);
Async Syntax
wb = object.MultiPointMAsync(flags, axes, dwell);
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.
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
flags 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.
For the MotionFlags constants see Motion Flags.
Return Value
None.
Return Value (async call)
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 is used.
If the method fails, the Error object is filled with the error description.
Example
Method Description
4.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(flags, axis, period);
Async Syntax
wb = object.SplineAsync(flags, axis, 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).
For the MotionFlags constants see Motion Flags.
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 WaitProgramEnd 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
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, 5000);
%Create the arbitrary path motion to axis 0, use a cubic interpolation
%between the specified points with uniform interval 500 ms
Ch.Spline(MotionFlags.ACSC_AMF_CUBIC, AxisDefs.ACSC_AXIS_0, 500);
% or
% Create the arbitrary path motion asynchronuously
wb = Ch.SplineAsync(MotionFlags.ACSC_AMF_CUBIC, AxisDefs.ACSC_AXIS_0,
500);
%Add some points
for index = 0:4
points(1) = 100*index;
points(2) = 20000*index;
Ch.AddPVPoint(AxisDefs.ACSC_AXIS_0, points(1),points(2));
end
%Finish the motion
%End of the multi-point motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.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(flags, axes, period);
Async Syntax
wb = object.SplineMAsync(flags, axes, 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).
For the MotionFlags constants see Motion Flags
Time interval between adjacent points. The parameter is used only if the
period
ACSC_AMF_VARTIME flag is not specified.
Return Value
None.
Return Value (async call)
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
4.21.1 AddPVPoint
Description
The method adds a point to a single-axis PV spline motion and specifies velocity.
Syntax
object.AddPVPoint(axis, point, velocity);
Async Syntax
wb = object.AddPVPointAsync(axis, point, velocity);
Arguments
Return Value
None.
Return Value (async call)
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
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, 5000);
%Create PV motion with uniform time interval with uniform interval 500 ms
Ch.Spline(MotionFlags.ACSC_AMF_CUBIC, AxisDefs.ACSC_AXIS_0, 500);
%Add some points
for index = 0:4
points(1) = 100*index;
points(2) = 20000*index;
Ch.AddPVPoint(AxisDefs.ACSC_AXIS_0, points(1),points(2));
% or add point asynchronuously
wb = Ch.AddPVPointAsync(AxisDefs.ACSC_AXIS_0, points(1),points(2));
end
%Finish the motion
%End of the multi-point motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.21.2 AddPVPointM
Description
The method adds a point to a multiple-axis PV spline motion and specifies velocity.
Syntax
object.AddPVPointM(axes, point, velocities);
Async Syntax
wb = object.AddPVPointMAsync(axes, point, velocities);
Arguments
Array of the coordinates of added point. The number and order of values
point must correspond to the axes array. point must specify a value for each
element of axes except the last ACSC_AXIS_NONE element.
Array of the velocities of added point. The number and order of values
velocities must correspond to the axes array. The velocity must specify a value for
each element of axes except the last ACSC_AXIS_NONE element.
Return Value
None.
Return Value (async call)
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 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 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
Ch.EnableM(axes);
%Create PV motion with uniform time interval with uniform interval 1000
ms
Ch.SplineM(MotionFlags.ACSC_AMF_CUBIC, axes, 1000);
%Add some points
for index = 0:4
points(1) = 100*(index);
points(2) = 200*(index);
Ch.AddPVPointM(axes, points, points);
% or add points asynchronuously
wb = Ch.AddPVPointMAsync(axes, points, points);
end
%Finish the motion
%End of the multi-point motion
Ch.EndSequenceM(axes);
4.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, point, velocity, timeInterval);
Async Syntax
wb = object.AddPVTPointAsync(axis, point, velocity, 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.
Return Value (async call)
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 AddPVTPointM. 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
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
points = [0, 0];
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, 5000);
%PVT motion and uniform interval is not used
flags = bitor(MotionFlags.ACSC_AMF_CUBIC, MotionFlags.ACSC_AMF_VARTIME);
Ch.Spline(flags, AxisDefs.ACSC_AXIS_0, 0);
%Add some points
for index = 0:4
points(1) = 100*(index);
points(2) = 200*(index);
%Add PVT point with specified position, velocity
%and time interval of 500 ms for each point
Ch.AddPVTPoint(AxisDefs.ACSC_AXIS_0, points(1), points(2),500);
% or initiate motion asynchronuously
wb = Ch.AddPVTPointAsync(AxisDefs.ACSC_AXIS_0, points(1), points
(2),500);
end
%Finish the motion
%End of the multi-point motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.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(axes, point, velocities, timeInterval);
Async Syntax
wb = object.AddPVTPointMAsync(axes, point, velocities, timeInterval);
Arguments
Array of the velocities of added point. The number and order of values
velocities must correspond to the axes array. The velocity must specify a value
for each element of axes except the last ACSC_AXIS_NONE 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.
Return Value (async call)
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 AddPVTPoint. To add a point to a PV motion with a
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, 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
4.22.1 ExtendedSegmentedMotionExt
Description
The method initiates a multi-axis extended segmented motion. Extended segmented motion
provides new features:
Syntax
object.ExtendedSegmentedMotion(flags, axes, point, velocity, endVelocity, junctionVelocity,
angle, starvationMargin, segments);
Async Syntax
wb = object.ExtendedSegmentedMotionAsync(flags, axes, point, velocity, endVelocity,
junctionVelocity, angle, starvationMargin, segments);
Arguments
If the Segments parameter is used, then the starvation margin must also be
defined.
Return Value
None.
Return Value (async call)
Example
4.22.2 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(flags, axes, point, velocity, endVelocity, values, variables, index, masks);
Async Syntax
wb = object.SegmentLineAsync(flags, axes, point, velocity, endVelocity, values, variables,
index, masks);
Arguments
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 ACSC_AXIS_
NONE element.
Return Value
None.
Return Value (async call)
Remarks
The function adds a linear segment that starts in the current point and ends in the destination
point to segmented motion.
All axes specified in the axes array must be specified before the call of
theExtendedSegmentedMotionExt method. The number and order of the axes in the axes array
must correspond exactly to the number and order of the axes of the
ExtendedSegmentedMotionExt 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.
This function replaces the Line and ExtLine methods which are now obsolete.
Example
4.22.3 SegmentArc1
Description
The method adds an arc segment to a segmented motion and specifies the coordinates of the
center point, the coordinates of the final point and the direction of rotation.
Syntax
object.SegmentArc1(flags, axes, center, finalPoint, rotation, velocity, endVelocity, values,
variables, index, masks);
Async Syntax
wb = object.SegmentArc1Async(flags, axes, center, finalPoint, rotation, velocity, endVelocity,
values, variables, index, masks);
Arguments
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 ACSC_AXIS_NONE 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 ACSC_AXIS_NONE element.
Return Value
None.
Return Value (async call)
Remarks
All axes specified in the axes array must be specified before the call of the
ExtendedSegmentedMotionExt methods. The number and order of the axes in the Axes array
4.22.4 SegmentArc2
Description
Syntax
object.SegmentArc2(flags, axes, center, angle, velocity, endVelocity, values, variables, index,
masks);
Async Syntax
wb = object.SegmentArc2Async(flags, axes, center, angle, velocity, endVelocity, values,
variables, index, masks);
Arguments
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 ACSC_AXIS_NONE element.
Return Value
None.
Return Value (async call)
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
ExtendedSegmentedMotionExt method. The number and order of the axes in the axes array must
correspond exactly to the number and order of the axes of the ExtendedSegmentedMotionExt
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
4.22.5 Stopper
Description
The method provides a smooth transition between two segments of segmented motion.
Syntax
object.Stopper(axes);
Async Syntax
wb = object.StopperAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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 with an
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
4.22.6 Projection
Description
The method sets a projection matrix for segmented motion.
Syntax
object.Projection(axes, matrix);
Async Syntax
wb = object.ProjectionAsync(axes, matrix);
Arguments
Vector of characters specifying the name of the matrix that provides the
matrix
specified projection.
Return Value
None.
Return Value (async call)
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
AxisDefs.ACSC_NONE);
points = [1000, 1000];
center = [1000,0];
matrix = zeros(3,2);
matrix(1,1) = 1;
matrix(2,2) = 1.41421;
matrix(3,2) = 1.41421;
%Declare the matrix that will contain the projection
Ch.DeclareVariable(AcsplVariableType.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.SegmentedMotion(MotionFlags.ACSC_NONE,axes,points);
%Incline the working plance XY by 45 degrees.
inclAxes = Axis.ToNetArray(AxisDefs.ACSC_AXIS_0, AxisDefs.ACSC_AXIS_1...
, AxisDefs.ACSC_AXIS_1, AxisDefs.ACSC_NONE);
%Set projection matrix for segmented motion.
Ch.Projection(inclAxes,'ProjectionMatrix');
%or
%Set projection matrix for segmented motion asynchronuously
wb = Ch.ProjectionAsync(inclAxes,'ProjectionMatrix');
%Describe circle with center (1000, 0) clockwise rotation.
%Althought the circle was defined,really on the plane XY we
%will get the ellipse stretched along the Y axis
Ch.SegmentArc2(MotionFlags.ACSC_NONE, axes, center,...
-2*3.141529, -1, -1, [], [], -1, []);
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.23.1 AddPoint
Description
The method adds a point to a single axis multi-point or spline motion.
Syntax
object.AddPoint(axis, point);
Async Syntax
wb = object.AddPointAsync(axis, point);
Arguments
Return Value
None.
Return Value (async call)
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 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 a non-zero value.
If the method fails, the Error object is filled with the error description.
Example
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
points = [0, 0];
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, 5000);
%Create multi-point motion with default velocity and dwell 1 ms
Ch.MultiPoint(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_0,1);
for index = 0:4
%Add a point to a single axis multi-point motion.
Ch.AddPoint(AxisDefs.ACSC_AXIS_0,100*index);
% or add a point to a single axis multi-point motion asynchronuously
wb = Ch.AddPointAsync(AxisDefs.ACSC_AXIS_0,100*index);
end
%Finish the motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.23.2 AddPointM
Description
The method adds a point to a multi-axis multi-point or spline motion.
Syntax
object.AddPointM(axes, point);
Async Syntax
wbb = object.AddPointMAsync(axes, point);
Arguments
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.
Return Value (async call)
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.
4.23.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, point, rate);
Async Syntax
wb = object.ExtAddPointAsync(axis, point, rate);
Arguments
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.
Return Value (async call)
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 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.
If the method fails, the Error object is filled with the error description.
Example
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
points = [0, 0];
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, 5000);
%Create multi-point motion with default velocity and dwell 1 ms
Ch.MultiPoint(MotionFlags.ACSC_AMF_VELOCITY, AxisDefs.ACSC_AXIS_0,1);
for index = 0:4
%Add a point to a single axis multi-point motion with specified
velocity.
Ch.ExtAddPoint(AxisDefs.ACSC_AXIS_0,100*index, 5000);
% or add a point to a single axis multi-point motion asynchronuously
wb = Ch.ExtAddPointAsync(AxisDefs.ACSC_AXIS_0,100*index, 5000);
end%Finish the motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
4.23.4 ExtAddPointM
Description
The method adds a point to a multi-axis multi-point or spline motion and specifies a specific velocity
or motion time.
Syntax
object.ExtAddPointM(axes, point, rate);
Async Syntax
wb = object.ExtAddPointMAsync(axes, point, rate);
Arguments
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 ACSC_AXIS_NONE element.
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.
Return Value (async call)
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.23.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);
Async Syntax
wb = object.EndSequenceAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
points = [0, 0];
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is enabled during 5 sec
Ch.WaitMotorEnabled(AxisDefs.ACSC_AXIS_0, motorState, 5000);
%Create multi-point motion with default velocity and dwell 1 ms
Ch.MultiPoint(MotionFlags.ACSC_NONE, AxisDefs.ACSC_AXIS_0,1);
for index = 0:4
%Add a point to a single axis multi-point motion.
Ch.AddPoint(AxisDefs.ACSC_AXIS_0,100*index);
end
%Finish the motion
Ch.EndSequence(AxisDefs.ACSC_AXIS_0);
% or finish the motion asynchronuously
wb = Ch.EndSequenceAsync(AxisDefs.ACSC_AXIS_0);
4.23.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(axes);
Async Syntax
wb = object.EndSequenceAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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
Method Description
4.24.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
wb = 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.
Vector of characters specifying the array name that stores the collected
samples.
array
The array must be declared as a global variable by an ACSPL+ program or by
the DeclareVariable method.
Return Value
None.
Return Value (async call)
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 in the
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
flags = DataCollectionFlags.ACSC_DCF_WAIT;
vars = 'FPOS(0)\rFVEL(0)\rFACC(0)';
%Initiate data collection.
Ch.DataCollection(flags, AxisDefs.ACSC_AXIS_0, 'MyArrayForDC', 100, 100,
vars);
%or initiate data collection asynchronuously
wb = Ch.DataCollectionAsync(flags, AxisDefs.ACSC_AXIS_0, 'MyArrayForDC',
100, 100, vars);
4.24.2 StopCollect
Description
The method terminates data collection.
Syntax
object.StopCollect;
Async Syntax
wb = object.StopCollectAsync;
Arguments
None.
Return Value
None.
Return Value (async call)
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 with the
WaitCollectEnd 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
Method Description
GetIndexState Retrieves the current state of the index and mark variables.
4.25.1 GetMotorState
Description
The method retrieves the current motor state.
Syntax
motorState = object.GetMotorState(axis);
Async Syntax
wb = object.GetMotorStateAsync(axis);
Arguments
Return Value
motorState Set of Motor State Flags constants specifying the current motor state.
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.25.2 GetAxisState
Description
The method retrieves the current axis state.
Syntax
axisStates = object.GetAxisState(axis);
Async Syntax
wb = object.GetAxisStateAsync(axis);
Arguments
Return Value
axisStates Set of Axis State Flags constants specifying the current motor state.
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.25.3 GetIndexState
Description
The method retrieves the current set of bits that indicate the index and mark state.
Syntax
indexStates = object.GetIndexState(axis);
Async Syntax
wb = object.GetIndexStateAsync(axis)
Arguments
Return Value
Set of Index and Mark State Flags constants specifying the current
indexStates
motor state.
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. To resume 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.25.4 ResetIndexState
Description
The method resets the specified bit of the index/mark state.
Syntax
object.ResetIndexState(axis, mask);
Async Syntax
wb = object.ResetIndexStateAsync(axis, mask);
Arguments
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.
For the axis constants see Index and Mark State Flags.
Return Value
None.
Return Value (async call)
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
Ch.ResetIndexState(AxisDefs.ACSC_AXIS_0,IndexStates.ACSC_IST_IND2);
Ch.ResetIndexState(AxisDefs.ACSC_AXIS_0,IndexStates.ACSC_IST_MARK);
Ch.ResetIndexState(AxisDefs.ACSC_AXIS_0,IndexStates.ACSC_IST_MARK2);
state = Ch.GetIndexState(AxisDefs.ACSC_AXIS_0);
4.25.5 GetProgramState
Description
The method retrieves the current state of the program buffer.
Syntax
prgStates = object.GetProgramState(buffer);
Async Syntax
wb = object.GetProgramStateAsync(buffer);
Arguments
Return Value
prgStates Set of Program State Flags constants specifying the current motor state..
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.
SetExtOutputPort Sets the specified extended output port to the specified value.
4.26.1 GetInput
Description
The method retrieves the current state of the specified digital input.
Syntax
state = object.GetInput(port, bit);
Async Syntax
wb = object.GetInputAsync(port, bit);
Arguments
Return Value
state Scalar specifying 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.26.2 GetInputPort
Description
The method retrieves the current state of the specified digital input port.
Syntax
state = object.GetInputPort(port);
Async Syntax
wb = object.GetInputPortAsync(port);
Arguments
Return Value
state Scalar specifying the current state of the specified digital input port.
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.26.3 GetOutput
Description
The method retrieves the current state of the specified digital output.
Syntax
state = object.GetOutput(port, bit);
Async Syntax
wb = object.GetOutputAsync(port, bit);
Arguments
Return Value
state Scalar specifying the current state of the specified digital output.
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.26.4 GetOutputPort
Description
The method retrieves the current state (0 or 1) of the specified digital output port.
Syntax
state = object.GetOutputPort(port);
Async Syntax
wb = object.GetOutputPortAsync(port);
Arguments
Return Value
state Scalar specifying the current state of the specified digital output.
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.26.5 SetOutput
Description
The method sets the specified digital output to the specified value.
Syntax
object.SetOutput(port, bit, value);
Async Syntax
wb = object.SetOutputAsync port, bit, value);
Arguments
Return Value
None.
Return Value (async call)
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.26.6 SetOutputPort
Description
The method sets the specified digital output port to the specified value.
Syntax
object.SetOutputPort(port, value);
Async Syntax
wb = object.SetOutputPortAsync(port, value);
Arguments
Return Value
None.
Return Value (async call)
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.26.7 GetAnalogInputNT
Description
The function retrieves the current value of the specified analog input.
Syntax
value = object.GetAnalogInputNT(port);
Async Syntax
wb = object.GetAnalogInputNTAsync(port);
Arguments
Return Value
Scalar specifying the current value of a specific analog input. Units: in scaling, by
state
percent, of the signal and ranges from -100 to +100 of the maximum level.
Remarks
The function retrieves the current value of specified analog input.
Analog inputs are represented in the controller variable AIN. For more information about analog
inputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
4.26.8 GetAnalogOutputNT
Description
The function retrieves the current value of the specified analog output.
Syntax
value = object.GetAnalogOutputNT(port);
Async Syntax
wb = object.GetAnalogOutputNTAsync(port);
Arguments
Return Value
Scalar specifying the current value of a specific analog output. Units: in scaling,
value
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 SetAnalogOutputNT method.
Analog outputs are represented in the controller variable AOUT. For more information about
analog outputs, see SPiiPlus ACSPL+ Programmer’s Guide.
Example
4.26.9 SetAnalogOutputNT
Description
The function writes the specified value to the specified analog output.
Syntax
object.SetAnalogOutputNT(port, value);
Async Syntax
wb = object.SetAnalogOutputNTAsync(port, double);
Arguments
Return Value
None.
Return Value (async call)
Remarks
The function writes the specified value to the specified analog outputs. To get a value of the
specific analog output, use the SetAnalogOutputNT 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
4.26.10 GetExtInput
Description
The method retrieves the current state of the specified extended input.
Syntax
value = object.GetExtInput(port, bit);
Async Syntax
wb = object.GetExtInputAsync(port, bit);
Arguments
Return Value
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.26.11 GetExtInputPort
Description
The method retrieves the current state of the specified extended input port.
Syntax
value = object.GetExtInputPort(port);
Async Syntax
wb = object.GetExtInputPortAsync(port);
Arguments
Return Value
value Scalar specifying the current state of the specified extended input port.
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.26.12 GetExtOutput
Description
The method retrieves the current state of the specified extended output.
Syntax
value = object.GetExtOutput(port, bit);
Async Syntax
wb = object.GetExtOutputAsync(port, bit);
Arguments
Return Value
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.26.13 GetExtOutputPort
Description
The method retrieves the current state of the specified extended output port.
Syntax
value = object.GetExtOutputPort(port);
Async Syntax
wb = object.GetExtOutputPortAsync(port);
Arguments
Return Value
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.26.14 SetExtOutput
Description
The method sets the specified extended output to the specified value.
Syntax
object.SetExtOutput(port, bit, value);
Async Syntax
wb = object.SetExtOutputAsync(port, bit, value);
Arguments
Return Value
None.
Return Value (async call)
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
4.26.15 SetExtOutputPort
Description
The method sets the specified extended output port to the specified value.
Syntax
object.SetExtOutputPort(port, value);
Async Syntax
wb = object.SetExtOutputPortAsync(port, value);
Arguments
Return Value
None.
Return Value (async call)
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
Sets the mask that defines for which axis or system faults the
SetResponseMask
controller provides default response.
Method Description
GetSafetyInputPort Retrieves the current state of the specified safety input port.
Sets the set of bits that define inversion for the specified
SetSafetyInputPortInv
safety input port.
4.27.1 GetFault
Description
The method retrieves the set of bits that indicate the motor or system faults.
Syntax
faults = object.GetFault(axis);
Async Syntax
wb = object.GetFaultAsync(axis);
Arguments
Return Value
Set of Safety Control Masks constants specifying the current motor or system
faults
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
4.27.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, mask);
Async Syntax
wb = object.SetFaultMaskAsync(axis, mask);
Arguments
Return Value
None.
Return Value (async call)
Remarks
The method sets the mask that enables/disables the examination and processing of the 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.27.3 GetFaultMask
Description
The method retrieves the mask that defines which controller faults are examined and processed.
Syntax
mask = object.GetFaultMask(axis);
Async Syntax
wb = object.GetFaultMaskAsync(axis);
Arguments
Return Value
Safety Control Masks constants that defines which controller faults are
mask
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
4.27.4 EnableFault
Description
The method enables the specified axis or system fault.
Syntax
object.EnableFault(axis, fault);
Async Syntax
wb = object.EnableFaultAsync(axis, fault);
Arguments
Return Value
None.
Return Value (async call)
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.27.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, fault);
Async Syntax
wb = object.DisableFaultAsync(axis, fault);
Arguments
Return Value
None.
Return Value (async call)
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.27.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, mask);
Async Syntax
wb = object.SetResponseMaskAsync(axis, mask);
Arguments
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.
Return Value (async call)
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.27.7 GetResponseMask
Description
The method retrieves the mask that defines the motor or the system faults for which the
controller provides the default response.
Syntax
mask = object.GetResponseMask(axis);
Async Syntax
wb = object.GetResponseMaskAsync(axis);
Arguments
Return Value
Safety Control Masks constants specifying the motor or the system faults for
mask
which the controller provides the default response.
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.27.8 EnableResponse
Description
The method enables the response to the specified axis or system fault.
Syntax
object.EnableResponse(axis, response);
Async Syntax
wb = object.EnableResponseAsync(axis, response);
Arguments
Return Value
None.
Return Value (async call)
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
4.27.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, response);
Async Syntax
wb = object.DisableResponseAsync(axis, response);
Arguments
Return Value
None.
Return Value (async call)
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. 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
4.27.10 GetSafetyInput
Description
The method retrieves the current state of the specified safety input.
Syntax
sInput = object.GetSafetyInput(axis, input);
Async Syntax
wb = object.GetSafetyInputAsync(axis, input);
Arguments
ACSC_SAFETY_HOT
ACSC_SAFETY_DRIVE
ACSC_SAFETY_ES
See Safety Control Masks for a detailed description of these properties.
Return Value
Safety Control Masks constant specifying the current state of the specified
sInput
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.
Some safety inputs can be unavailable in specific controller models. For example,
SPiiPlus SA controller does not provide Motor Overheat, Preliminary Left Limit, or
Preliminary Right Limit safety inputs.
See specific model documentation for details.
If the method fails, the Error object is filled with the error description.
Example
4.27.11 GetSafetyInputPort
Description
The method retrieves the current state of the specified safety input port.
Syntax
portState = object.GetSafetyInputPort(axis);
Async Syntax
wb = object.GetSafetyInputPortAsync(axis);
Arguments
Return Value
Safety Control Masks constant specifying the current state of the specified
portState
safety input port.
Remarks
Return Value (async call)
Remarks
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.
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.
Some safety inputs can be unavailable in specific controller models. For example,
SPiiPlus SA controller does not provide Motor Overheat, Preliminary Left Limit, or
Preliminary Right Limit safety inputs.
See specific model documentation for details.
If the method fails, the Error object is filled with the error description.
Example
4.27.12 SetSafetyInputPortInv
Description
The method sets the set of bits that define inversion for the specified safety input port.
Syntax
object.SetSafetyInputPortInv(axis, value);
Async Syntax
wb = object.SetSafetyInputPortInvAsync(axis, value);
Arguments
Return Value
None.
Return Value (async call)
Remarks
The method sets the bits that define inversion for the specified safety input port. 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.
Some safety inputs can be unavailable in specific controller models. For example,
SPiiPlus SA controller does not provide Motor Overheat, Preliminary Left Limit, or
Preliminary Right Limit safety inputs.
See specific model documentation for details.
If the method fails, the Error object is filled with the error description.
Example
4.27.13 FaultClear
Description
The method clears the current faults and the result of the previous fault stored in the MERR
variable.
Syntax
object.FaultClear(axis);
Async Syntax
wb = object.FaultClearAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
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.27.14 FaultClearM
Description
The method clears the current faults and results of previous faults stored in the MERR variable for
multiple axis.
Syntax
object.FaultClearM(axes);
Async Syntax
wb = object.FaultClearMAsync(axes);
Arguments
Return Value
None.
Return Value (async call)
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
Method Description
WaitInput Waits for the specified state of the specified digital input.
4.28.1 WaitMotionEnd
Description
The method waits for the end of a motion.
Syntax
object.WaitMotionEnd(axis, 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.28.2 WaitLogicalMotionEnd
Description
The method waits for the logical end of a motion.
Syntax
object.WaitLogicalMotionEnd (axis, 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.28.3 WaitCollectEnd
Description
The method waits for the end of data collection.
Syntax
object.WaitCollectEnd(timeout);
Arguments
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.28.4 WaitProgramEnd
Description
The method waits for the program termination in the specified buffer.
Syntax
object.WaitProgramEnd(buffer, 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
Ch.RunBuffer(ProgramBuffer.ACSC_BUFFER_1,[]);
%Wait program ends during 10 sec
Ch.WaitProgramEnd(ProgramBuffer.ACSC_BUFFER_1 , 10000);
4.28.5 WaitMotorCommutated
Description
The method waits for the specified state of the specified motor.
Syntax
object.WaitMotorCommutated(axis, state, timeout);
Arguments
Return Value
None.
Remarks
The method does not return while 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
%Commut axis 0
Ch.Commut(AxisDefs.ACSC_AXIS_0);
% Set value of motor state to 1 corresponding to MotorStates.ACSC_MST_
ENABLE
motorState = MotorStates.GetValue(MotorStates.ACSC_MST_ENABLE);
%Wait till axis 0 is commutated during 5 sec
Ch.WaitMotorCommutated(AxisDefs.ACSC_AXIS_0,motorState, 5000);
4.28.6 WaitMotorEnabled
Description
The method waits until the specified motor is commutated.
Syntax
object.WaitMotorEnabled (axis, state, timeout);
Arguments
Return Value
None.
Remarks
The method does not return while 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
%Enable axis 0
Ch.Enable(AxisDefs.ACSC_AXIS_0);
4.28.7 WaitInput
Description
The method waits for the specified state of digital input.
Syntax
object.WaitInput (port, bit, state, 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
Method Description
4.29.1 EnableEvent
Description
The method enables event generation for the specified interrupt condition.
Syntax
object.EnableEvent(flags);
Arguments
Return Value
None.
Remarks
The library generates an event when the specified Interrupt occurs. SPiiPlus MATLAB Library has
events for all types of interrupts:
PEG (AxisMasks Param), MARK1 (AxisMasks Param) etc. For full list of SPiiPlus MATLAB Library 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 DisableEvent method with the flags argument equal to the
specified interrupt type.
If the method fails, the Error object is filled with the error description.
Example
4.29.2 DisableEvent
Description
The method disables event generation for the specified interrupt condition.
Syntax
object.DisableEvent (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.29.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 the related
mask.
If the method fails, the Error object is filled with the error description.
Example
4.29.4 GetInterruptMask
Description
The method retrieves the mask for specified interrupt.
Syntax
mask = object.GetInterruptMask(interrupt);
Arguments
Return Value
mask Scalar representing 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
mask = Ch.GetInterruptMask(Interrupts.ACSC_INTR_PROGRAM_END);
Method Description
4.30.1 DeclareVariable
Description
The method creates a persistent global variable.
Syntax
object.DeclareVariable(type, name);
Async Syntax
wb = object.DeclareVariableAsync(type, name);
Arguments
Return Value
None.
Return Value (async call)
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.30.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
Ch.DeclareVariable(AcsplVariableType.ACSC_INT_TYPE,'MyVar');
%The method deletes all persistent global variables
Ch.ClearVariables;
Method Description
Method Description
4.31.1 GetFirmwareVersion
Description
The method retrieves the firmware version of the controller.
Syntax
version = object.GetFirmwareVersion;
Arguments
None.
Return Value
Remarks
If the method fails, the Error object is filled with the error description.
Example
4.31.2 GetSerialNumber
Description
The method retrieves the controller serial number.
Syntax
sn = object.GetSerialNumber
Arguments
None.
Return Value
Remarks
If the method fails, the Error object is filled with the error description.
Example
4.31.3 SysInfo
Description
The method returns certain system information based on the argument that is specified.
Syntax
data = object.SysInfo (key);
Async Syntax
wb = object.SysInfoAsync (key);
Arguments
Return Value
Example
key = SystemInfoKey.GetValue(SystemInfoKey.ACSC_SYS_MODEL_KEY);
%Get SPiiPlus Model Number
value = Ch.SysInfo(key);
%Get SPiiPlus Model Number asynchronuously
wb = Ch.SysInfoAsync(key);
value = Ch.GetResult(wb, 2000);
4.31.4 GetBuffersCount
Description
The method returns the number of available ACSPL+ programming buffers.
Syntax
numOfBufs = object.GetBuffersCount;
Async Syntax
wb = object.GetBuffersCountAsync;
Arguments
None.
Return Value
Example
4.31.5 GetAxesCount
Description
The method returns the number of available axes.
Syntax
axesCount = object.GetAxesCount;
Async Syntax
wb = object.GetAxesCountAsync;
Arguments
None
Return Value
Example
4.31.6 GetDBufferIndex
Description
The method returns the index of the D-Buffer.
Syntax
index = object.GetDBufferIndex;
Async Syntax
wb = object.GetDBufferIndexAsync;
Arguments
None
Return Value
Example
4.31.7 GetUMDVersion
Description
The method retrieves the User Mode Driver version number.
Syntax
libVersion = object.GetUMDVersion;
Arguments
None.
Return Value
Remarks
The User Mode Driver 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, or other build.
If the method fails, the Error object is filled with the error description.
Example
Method Description
4.32.1 GetMotorError
Description
The method retrieves the reason for motor disabling.
Syntax
error = object.GetMotorError(axis);
Async Syntax
wb = object.GetMotorErrorAsync(axis);
Arguments
Return Value
error Scalar specifying 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.32.2 GetMotionError
Description
The method retrieves the termination code of the last executed motion of the specified axis.
Syntax
error = object.GetMotionError(axis);
Async Syntax
wb = object.GetMotionErrorAsync(axis);
Arguments
Return Value
Scalar specifying the termination code of the last executed motion of the
error
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.32.3 GetProgramError
Description
The method retrieves the error code of the last program error encountered in the specified buffer.
Syntax
error = object.GetProgramError(buffer);
Async Syntax
wb = object.GetProgramErrorAsync(buffer);
Arguments
Return Value
Scalar specifying the error code of the last program error encountered in the
error
specified 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
WaitPegReadyNT
ready to respond to movement.
4.33.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 NT
family controllers.
Syntax
object.AssignPegNT(axis, engToEncBitCode, gpOutsBitCode)
Async Syntax
wb = object.AssignPegNTAsync(axis, engToEncBitCode, gpOutsBitCode)
Arguments
Return Value
None.
Return Value (async call)
Example
engToEncBitCode = 0;
gpOutsBitCode = hex2dec('0b11');
%Synchronous call to AssignPegNT
Ch.AssignPegNT(AxisDefs.ACSC_AXIS_1, engToEncBitCode, gpOutsBitCode);
%Asynchronous call to AssignPegNT
wb = Ch.AssignPegNTAsync(AxisDefs.ACSC_AXIS_1, engToEncBitCode,...
gpOutsBitCode);
4.33.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 NT 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 ACSPL+ Command & Variable Reference Guide.
Syntax
object.AssignPegOutputsNT(axis, outputIndex, bitCode);
Async Syntax
wb = object.AssignPegOutputsNTAsync(axis, outputIndex, bitCode);
Arguments
For the bit code for engine outputs to physical outputs mapping, see
bitCode
the SPiiPlus NT PEG and MARK Operations Application Notes.
Return Value
None.
Return Value (async call)
Example
outputIndex = 0;
outputBitCode = hex2dec('0b10');
%Synchronous call to AssignPegOutputNT
Ch.AssignPegOutputsNT(AxisDefs.ACSC_AXIS_1, outputIndex, outputBitCode);
%Asynchronous call to AssignPegOutputNT
wb = Ch.AssignPegOutputsNTAsync(AxisDefs.ACSC_AXIS_1,...
outputIndex, outputBitCode);
4.33.3 AssignFastInputsNT
Description
The method is used to switch MARK_1 physical inputs to ACSPL+ variables as fast general purpose
inputs.
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, inputIndex, bitCode);
Async Syntax
wb = object. AssignFastInputsNTAsync(axis, inputIndex, bitCode);
Arguments
For bit code for engine outputs to physical outputs mapping see the
bitCode
SPiiPlus NT PEG and MARK Operations Application Notes.
Return Value
None.
Return Value (async call)
Remarks
The function is not related to PEG activity. It is included for the sake of completeness, since many
times fast inputs are used in applications that use PEG functionality.
Example
inputIndex = 1;
bitCode = 7;
%Synchronous call to AssignFastInputsNT
Ch.AssignFastInputsNT(AxisDefs.ACSC_AXIS_1, inputIndex, bitCode);
%Asynchronous call to AssignFastInputsNT
wb = Ch.AssignFastInputsNTAsync(AxisDefs.ACSC_AXIS_1,...
inputIndex, bitCode);
4.33.4 PegIncNT
Description
The method is used for setting the parameters for the Incremental PEG mode for SPiiPlus NT family
controllers. Incremental PEG is defined by first point, last point and the interval.
Syntax
object.PegIncNT(flags, axis, width, firstPoint, interval, lastPoint, tbNumber, tbPeriod);
Async Syntax
wb = object.PegIncNTAsync(flags, axis, width, firstPoint, interval, lastPoint, tbNumber,
tbPeriod);
Arguments
Return Value
None.
Return Value (async call)
Example
%Parameters:
flags = MotionFlags.ACSC_NONE;
axis = AxisDefs.ACSC_AXIS_1;
width = 0.5;
firstPoint = 0;
interval = 200;
lastPoint = 10000;
tbNumber = -1;
tbPeriod = -1;
4.33.5 PegRandomNT
Description
The method is used for setting the parameters for the Random PEG mode for SPiiPlus NT family
controllers. Random PEG function specifies an array of points where position-based events should
be generated.
Syntax
object.PegRandomNT(flags, axis, width, mode, firstIndex, lastIndex, pointArray, stateArray,
tbNumber, tbPeriod);
Async Syntax
wb = object.PegRandomNTAsync(flags, axis, width, mode, firstIndex, lastIndex, pointArray,
stateArray, tbNumber, tbPeriod);
Arguments
For the output signal configuration, see SPiiPlus NT PEG and MARK
mode
Operations Application Notes.
Vector of charcters specifying the name of the real array that stores
positions at which PEG pulse should be generated.
pointAray
The array must be declared as a global variable by an ACSPL+ program or
by the DeclareVariable method.
Vector of charcters specifying the name of the integer array that stores
the desired output state at each position.
stateArray The array must be declared as a global variable by an ACSPL+ program or
by the DeclareVariable method.
If output state change is not desired, this parameter should be [ ].
Return Value
None.
Example
%Parameters:
flags = MotionFlags.ACSC_NONE;
axis = AxisDefs.ACSC_AXIS_1;
width = 1.745;
mode = hex2dec('444');
firstIndex = 0;
lastIndex = 4;
pointArray = 'Points';
stateArray = 'States';
tbNumber = -1;
tbPeriod = -1;
4.33.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 NT family controllers.
The method can be used in both the Incremental and Random PEG modes.
Syntax
object.WaitPegReadyNT (axis, timeout);
Arguments
Return Value
None.
Example
4.33.7 StartPegNT
Description
The method is used to initiate the PEG process on the specified axis for SPiiPlus NT family
controllers.
Syntax
object.StartPegNT(axis);
Async Syntax
wb = object.StartPegNTAsync(axis);
Arguments
Return Value
None.
Example
4.33.8 StopPegNT
Description
The method is used to terminate the PEG process immediately on the specified axis for SPiiPlus NT
family controllers.
The method can be used in both the Incremental and Random PEG modes.
Syntax
object.StopPegNT(axis);
Async Syntax
wb = object.StopPegNTAsync(axis);
Arguments
Return Value
None.
Return Value (async call)
Example
Method Description
Method Description
4.34.1.1 ApplicationFileInfo
Description
This structure describes data file header, attributes array and file sections array.
Syntax
ApplicationFileInfo(filename, description, isNewFile, errCode, attributes, sections);
Properties
4.34.1.2 ACSC_APPSL_SECTION
Description
This structure describes any sections (or controller files).
Syntax
ACSC_APPSL_SECTION(type, filename, description, size, offset, crc, inuse, error, pData);
Properties
1 - In use
inuse
0 - Not in use
4.34.1.3 ACSC_APPSL_ATTRIBUTE
Description
This structure defines an attribute key-value pair.
Syntax
ACSC_APPSL_ATTRIBUTE(key, value);
Properties
4.34.1.4 ACSC_APPSL_STRING
Description
This structure used for Application Saver / Loader functions.
Syntax
ACSC_APPSL_STRING(value);
Properties
4.34.2 Enumerations
The Application Loader methods employ the following enums:
4.34.2.1 ACSC_APPSL_FILETYPE
Description
Describes possible file types.
Values
4.34.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
appFileInfo = object.AnalyzeApplication(fileName);
Arguments
Return Value
Example
4.34.4 LoadApplication
Description
The method loads user application file from a host PC to the controller flash.
Syntax
data = object.LoadApplication (string fileName, ApplicationFileInfo info)
Async Syntax
object.LoadApplicationAsync (string fileName, ApplicationFileInfo info);
Arguments
Return Value
Example
fileName = 'neededFile';
% Analyze Application file
appFileInfo = Ch.AnalyzeApplication(fileName);
%Load application components from a file
data = Ch.LoadApplication(fileName,appFileInfo);
%Asynchronuously load application components from a file
wb = Ch.LoadApplication(fileName,appFileInfo);
data = Ch.GetResult(wb, 2000);
4.34.5 SaveApplication
Description
The method saves user application from the controller to a file on host PC.
Syntax:
data = object.SaveApplication (fileName, info);
Async Syntax:
wb = object.SaveApplicationAsync (fileName, info);
Arguments
Return Value
Example
fileName = 'neededFile';
% Analyze Application file
appFileInfo = Ch.AnalyzeApplication(fileName);
%Save application components from a file
data = Ch.SaveApplication(fileName,appFileInfo);
%Asynchronuously svae application components from a file
wb = Ch.SaveApplication(fileName,appFileInfo);
data = Ch.GetResult(wb, 2000);
4.34.6 FreeApplication
Description
The method frees memory, previously allocated by the AnalyzeApplication method.
Syntax:
object.FreeApplication(info);
Arguments
Return Value
None
Example
Method Description
4.35.1 LoadDataToController
Description
This method writes value(s) from text file to SPiiPlus controller (variable or file).
Syntax:
object.LoadDataToController(dest, destName, from1, to1, from2, to2, srcFilename,
srcNumFormat, bTranspose);
Async Syntax:
wb = object.LoadDataToControllerAsync(dest, destName, from1, to1, from2, to2, srcFilename,
srcNumFormat, bTranspose);
Arguments
Return Value
None
Return Value (async call)
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 -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 -1 (-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 -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 -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.35.2 UploadDataFromController
Description
This method writes value(s) from SPiiPlus controller (variable or file) to text file.
Syntax
object.UploadDataFromController(src, srcName, srcNumFormat, from1, to1, from2, to2,
destFilename, destNumFormat, bTranspose);
Async Syntax
wb = object.UploadDataFromControllerAsync(src, srcName, srcNumFormat, from1, to1, from2,
to2, destFilename, destNumFormat, bTranspose);
Arguments
Return Value
None
Return Value (async call)
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 an ACSPL+ controller variable, user global or
user local.
ACSPL+ and user global variables have global scope. Therefore src must have the value of -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 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 -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 -1. The method writes the values from the specified variable from index from1 to index to1
inclusively, to the file specified by destFileName.
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 retrieves to2- 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 next 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
Method Description
4.36.1 RegisterEmergencyStop
Description
This method initiates the “Emergency Stop” functionality for the calling application.
Syntax
object.RegisterEmergencyStop;
Return Value
None
Remarks
SPiiPlus UMD and Library provide the user application with the ability to open/close the Emergency
Stop button (shown in Figure 3-1). 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, it is recommended
placing a call of RegisterEmergencyStop after each call of any of OpenComm*** functions.
Example
4.36.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 Emergency Stop
functionality, the button will disappear.
Calling UnregisterEmergencyStop more than once per application is meaningless, but method will
succeed anyway.
Example
Method Description
4.37.1 ControllerReboot
Description
This method reboots controller and waits for process completion.
Syntax
object.ControllerReboot(timeout);
Arguments
Return Value
None
Example
4.37.2 ControllerFactoryDefault
Description
The method reboots the controller, restores factory default settings and waits for process
completion.
Syntax
object.ControllerFactoryDefault(timeout);
Arguments
Return Value
None.
Example
Method Description
4.38.1 CopyFileToController
Description
The function copies file from host PC to controller’s non-volatile memory.
Syntax
object.CopyFileToController(sourceFileName, destinationFileName);
Async Syntax
wb = object.CopyFileToControllerAsync(sourceFileName, destinationFileName);
Arguments
Return Value
None.
Return Value (async call)
Example
4.38.2 DeleteFileFromController
Description
The function deletes user files from controller's non-volatile memory.
Syntax
object.DeleteFileFromController(fileName);
Async Syntax
wb = object.DeleteFileFromControllerAsync(fileName);
Arguments
Return Value
None.
Return Value (async call)
Example
Method Description
4.39.1 ControllerSaveToFlash
Description
The function saves user application to the controller's non-volatile memory.
Syntax
object.ControllerSaveToFlash (parameters, buffers, sPPrograms, userArrays);
Arguments
Return Value
Example
%The following code sample saves all axes parameters and buffers to
%flash, with two user arrays: 'MyArray' and 'MyArray2'.
parameters = Axis.ToNetArray(AxisDefs.ACSC_AXIS_0, AxisDefs.ACSC_AXIS_1);
buffers = ProgramBuffer.ToNetArray(ProgramBuffer.ACSC_BUFFER_0,...
ProgramBuffer.ACSC_BUFFER_1);
sPPrograms = ServoProcessor.ToNetArray(ServoProcessor.ACSC_SP_0,...
ServoProcessor.ACSC_SP_1);
userArrays = 'MyArray\rMyArray2';
Ch.ControllerSaveToFlash(parameters, buffers, sPPrograms, userArrays);
Method Description
4.40.1 StartSPiiPlusSC
Description
The function starts the SPiiPlusSC controller.
Syntax
object.StartSPiiPlusSC;
Arguments
None
Return Value
None
Example
4.40.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_BUFFERS_MAX_
65 Maximum number of Program buffers
NUMBER
ACSC_DC_VAR_MAX_
10
NUMBER
ACSC_NONE 0
ACSC_ALL -1
Description
The general format for any buffer definition is:
ACSC_BUFFER_index
Where index is a number that ranges between 0 and 64, such as ACSC_BUFFER_0, ACSC_BUFFER_1,
ACSC_BUFFER_64, etc. The buffer constant contains the value associated with the index, that is,
ACSC_BUFFER_0 has a value of 0, ACSC_BUFFER_1 has a value of 1, and so forth. ACSC_BUFFER_ALL
stands for all buffers.ACSC_NONE has a value of -1 and serves as buffer array terminator.
ACSC_ETHERCAT_1BYTE 0x00000001
ACSC_ETHERCAT_2BYTES 0x00000002
ACSC_ETHERCAT_4BYTES 0x00000004
ACSC_ETHERCAT_FLOAT 0x00000008
ACSC_DEFAULT_REMOTE_PORT 9999
ACSC_AMF_
0x00000020 The slaved motion uses velocity lock.
VELOCITYLOCK
ACSC_AMF_
0x00010000 Decelerate to corner.
JUNCTIONVELOCITY
ACSC_AMF_INVERT_
0x00080000 The PEG pulse output is inverted.
OUTPUT
Syntax:
RotationDirection
Table 4-6. Rotation Directrion Flags
Syntax:
GlobalDirection
ACSC_AST_
0x00000001 Axis is leading in a group.
LEAD
ACSC_AST_
0x00000002 Axis data collection is in progress.
DC
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_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
ACSC_SAFETY_
0x00000200 Driver Alarm Motor fault
DRIVE
ACSC_SAFETY_
0x40000000 Integrity Violation System fault
INTGR
See the SPiiPlus ACSPL+ Programmer’s Guide for detailed explanations of faults.
ACSPL+ program
has generated the
ACSC_INTR_ACSPL_PROGRAM 22 interrupt by
INTERRUPT
command.
Communication
ACSC_INTR_COMM_CHANNEL_
32 channel has been
CLOSED
closed.
A line of ACSPL+
commands has
ACSC_INTR_COMMAND 21
been executed in a
dynamic buffer.
EMERGENCY STOP
ACSC_INTR_EMERGENCY 15 signal has been
generated.
EtherCAT error
ACSC_INTR_ETHERCAT_ERROR 29
occurred.
AST.#NEWSEGM bit
ACSC_INTR_NEWSEGM 27
went high.
ACSPL+ program
ACSC_INTR_PROGRAM_END 20
has finished.
System error
ACSC_INTR_SYSTEM_ERROR 28
occurred.
AST.#TRIGGER bit
ACSC_INTR_TRIGGER 26
went high
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_AXIS_63 63 Axis 63 MOTION_
FAILURE, ACSC_
INTR_MOTOR_
FAILURE, ACSC_
INTR_MOTION_
START, ACSC_
INTR_MOTION_
PHASE_CHANGE,
ACSC_INTR_
TRIGGER
ACSC_CONF _WORD1_ Bit 6 defines HSSI route, bit 7 defines source for
1
KEY interrupt generation.
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_
229 Controls brake method.
OUT_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
Default_Type 0
String_Type 0
Buffer_Type 1
Integer_Type 2
Real_Type 3
Scalar_Type 4
Vector_Type 5
Matrix_Type 6
Typeless_Type 7
Binary_Type 8
Syntax:
public enum AcsplVariableType
Table 4-19. ACSPL+ Variables Types
Syntax:
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
Syntax:
public enum ACSC_LOG_DATA_PRESENTATION
Table 4-22. Log Presentation Definitions
No more than the first ten bytes of each data string will be
Compact 0 logged. Non-printing characters will be represented in
HexASCII code.
6. Events
SPiiPlus MATLAB 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
ExCOMMCHANNELCLOSED ACSC_INTR_COMM_CHANNEL_CLOSED
ExEMERGENCY ACSC_INTR_EMERGENCY
ExETHERCATERROR ACSC_INTR_ETHERCAT_ERROR
ExNEWSEGM ACSC_INTR_NEWSEGM
ExSOFTWAREESTOP ACSC_INTR_SOFTWARE_ESTOP
ExSYSTEMERROR ACSC_INTR_SYSTEM_ERROR
ExSYSTEMERROR ACSC_INTR_ACSPL_PROGRAM_EX
7. Error Handling
The SPiiPlus MATLAB Library throws ACSException when API function fails to complete the
requested operation successfully. The exception object contains an error code and an error
description that can be used to evaluate the error occurred.
> Error code, received from GetLastError function (see Error Codes).
> A string with a description of the error.
For example: Communication Initialization failure. Error – 132
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 COM methods. Upgrade the FW of the controller.
Library version.
Invalid
Specified communication handle must be a handle
134 communication
returned 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 parameters
139
are invalid.
History buffer is
140
closed.
Name of variable
141
must be specified.
Function is not
145 supported in
current version
Unsolicited
150 messages buffer is
closed.
Error
Error Message Remarks
Code
Checksum of the
153 controller response
is incorrect.
Internal error:
Queue of
160
transmitted
commands is full.
Error
Error Message Remarks
Code
Specified IP address
165
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
Application Saver
175 Loader Unknown
File Error
Application Saver
176 Loader Format
Version Error
Error
Error Message Remarks
Code
Application Saver
177 Loader Section Size
is Zero
Pointer to the
buffer is invalid or
Null pointer
185
received instead of
user allocated
object
Cannot access
DPRAM directly Returned by DPRAM access methods, when
190 through any attempting to call them with Serial or Ethernet
channel but PCI and channels.
Direct.
Invalid DPRAM
Returned by DPRAM access methods, when
192 address was
attempting to access illegal address
specified
This version of
Returned by DPRAM access methods, when
simulator does not
193 attempting to access old version Simulator that does
support work with
not support DPRAM.
DPRAM.
Error
Error Message Remarks
Code
Communication
602 channel is already
open
Error
Error Message Remarks
Code
Argument Value is
604
not initialized