SPiiPlus COM Library Programmer's Guide
SPiiPlus COM Library Programmer's Guide
Programmer's Guide
April 2021
Document Revision: 3.10
SPiiPlus COM Library Programmer's Guide
COPYRIGHT
Changes are periodically made to the information in this document. Changes are published as release notes and later
incorporated into revisions of this document.
No part of this document may be reproduced in any form without prior written permission from ACS Motion Control.
TRADEMARKS
ACS Motion Control, SPiiPlus, PEG, MARK, ServoBoost, NetworkBoost and NanoPWN are trademarks of ACS Motion Control Ltd.
EtherCAT is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
Any other companies and product names mentioned herein may be the trademarks of their respective owners.
www.acsmotioncontrol.com
NOTICE
The information in this document is deemed to be correct at the time of publishing. ACS Motion Control reserves the right to
change specifications without notice. ACS Motion Control is not responsible for incidental, consequential, or special damages of
any kind in connection with using this document.
Version 3.10 2
SPiiPlus COM Library Programmer's Guide
Revision History
Date Revision Description
September
3.02 New Release
2020
September
01 First Release
2014
Version 3.10 3
SPiiPlus COM Library Programmer's Guide
Format Description
Blue Hyperlink
Flagged Text
Version 3.10 4
SPiiPlus COM Library Programmer's Guide
Related Documents
Documents listed in the following table provide additional information related to this document.
The most updated version of the documents can be downloaded by authorized users from
www.acsmotioncontrol.com/downloads.
Online versions for all ACS software manuals and SPiiPlus ADK suite Release Notes are available to
authorized users at ACS Motion Control Knowledge Center.
Document Description
SPiiPlus Command & Command and variables of high level language for
Variable Reference Guide programming SPiiPlus controllers.
ACSPL+ Programmer's Guide for using ACSPL+ command set for programming
Guide SPiiPlus controllers.
Version 3.10 5
SPiiPlus COM Library Programmer's Guide
Table of Contents
1. Introduction 20
1.1 Scope 20
2. General Information 21
2.1 General 21
2.2 Operating Environment 21
2.3 Communication Channels 21
2.4 Controller Simulation 21
2.5 Supported Programming Languages 21
2.6 Installation and Supplied Components 22
2.7 Asynchronous Calls Support 22
2.8 Standard (SPiiPlus C Library) Features 22
2.9 Specific COM Library Features 23
2.10 Communication Scenarios 24
3. Using the SPiiPlus COM Library 27
3.1 Redistribution 27
3.2 Visual Basic 27
3.3 LabView 27
3.4 VBScript (HTML) Example 28
3.5 Visual Studio .NET 29
4. COM Methods 30
4.1 Communication Methods 31
4.1.1 CancelOperation 32
4.1.2 Command 33
4.1.3 CloseComm 33
4.1.4 FlushLogFile 34
4.1.5 GetBinary 35
4.1.6 GetConnectionsList 36
4.1.7 GetEthernetCards 37
4.1.8 GetPCICards 38
4.1.9 GetString 39
4.1.10 OpenCommSimulator 39
4.1.11 CloseSimulator 40
Version 3.10 6
SPiiPlus COM Library Programmer's Guide
4.1.12 OpenCommEthernetTCP 41
4.1.13 OpenCommEthernetUDP 41
4.1.14 OpenCommPCI 42
4.1.15 OpenCommSerial 43
4.1.16 GetConnectionInfo 44
4.1.16.1 CONNECTION_TYPE 45
4.1.16.2 CONNECTION_INFO 45
4.1.17 SetServerExtLogin 46
4.1.18 TerminateConnection 47
4.1.19 Transaction 48
4.2 EtherCAT® Methods 48
4.2.1 GetEtherCATState 49
4.2.2 GetEtherCATError 50
4.2.3 MapEtherCATInput 52
4.2.4 MapEtherCATOutput 53
4.2.5 UnmapEtherCATInputsOutputs 54
4.2.6 GetEtherCATSlaveIndex 55
4.2.7 GetEtherCATSlaveOffset 56
4.2.8 GetEtherCATSlaveVendorID 57
4.2.9 GetEtherCATSlaveProductID 58
4.2.10 GetEtherCATSlaveRevision 59
4.2.11 GetEtherCATSlaveType 60
4.2.12 GetEtherCATSlaveState 61
4.3 Service Communication Methods 62
4.3.1 GetACSCHandle 63
4.3.2 GetCOMLibraryVersion 64
4.3.3 GetCommOptions 64
4.3.4 GetDefaultTimeout 65
4.3.5 GetErrorString 66
4.3.6 GetLibraryVersion 67
4.3.7 GetTimeout 68
4.3.8 SetIterations 68
4.3.9 SetCommOptions 69
4.3.10 SetTimeout 70
Version 3.10 7
SPiiPlus COM Library Programmer's Guide
Version 3.10 8
SPiiPlus COM Library Programmer's Guide
Version 3.10 9
SPiiPlus COM Library Programmer's Guide
Version 3.10 10
SPiiPlus COM Library Programmer's Guide
Version 3.10 11
SPiiPlus COM Library Programmer's Guide
Version 3.10 12
SPiiPlus COM Library Programmer's Guide
Version 3.10 13
SPiiPlus COM Library Programmer's Guide
Version 3.10 14
SPiiPlus COM Library Programmer's Guide
Version 3.10 15
SPiiPlus COM Library Programmer's Guide
Version 3.10 16
SPiiPlus COM Library Programmer's Guide
List Of Figures
Figure 3-1. LabView Automation Open 28
Figure 4-1. Emergency Stop Button 323
Figure 7-1. Communication not Established Message - Visual Basic 344
Figure 7-2. Error Handling Example in LabView 7 345
Figure 7-3. LabVIEW Error Message 345
Figure 7-4. C# Error Message 346
Version 3.10 17
SPiiPlus COM Library Programmer's Guide
List of Tables
Table 4-1. Communication Methods 31
Table 4-2. EtherCAT Methods 48
Table 4-3. EtherCAT States 50
Table 4-4. EtherCAT Error Codes 51
Table 4-5. Service Communication Methods 63
Table 4-6. ACSPL+ Program Management Methods 71
Table 4-7. Read and Write Variables Methods 80
Table 4-8. Value Dimension Indices 93
Table 4-9. History Buffer Management Methods 96
Table 4-10. Unsolicited Messages Buffer Management Methods 98
Table 4-11. Log File Management Methods 101
Table 4-12. SPiiPlusSC Log File Management Methods 104
Table 4-13. Shared Memory Methods 107
Table 4-14. System Configuration Methods 111
Table 4-15. Setting and Reading Motion Parameters Methods 119
Table 4-16. Axis/Motor Management Methods 139
Table 4-17. Motion Management Methods 148
Table 4-18. Point-to-Point Motion Methods 161
Table 4-19. Track Motion Control Method 169
Table 4-20. Jog Methods 170
Table 4-21. Slaved Motion Methods 173
Table 4-22. Multi-Point Motion Methods 178
Table 4-23. Arbitrary Path Motion Methods 182
Table 4-24. PVT Methods 187
Table 4-25. Segmented Motion Methods 193
Table 4-26. Points and Segments Manipulation Methods 228
Table 4-27. Data Collection Methods 236
Table 4-28. Status Report Methods 239
Table 4-29. Inputs/Outputs Access Methods 244
Table 4-30. Safety Control Methods 257
Table 4-31. Wait-for-Condition Methods 273
Version 3.10 18
SPiiPlus COM Library Programmer's Guide
Version 3.10 19
SPiiPlus COM Library Programmer's Guide
1. Introduction
1. Introduction
1.1 Scope
The SPiiPlus COM Library supports the creation of a user application that operates in a PC host
computer and communicates with SPiiPlus motion controllers. The SPiiPlus COM Library implements
a rich set of controller operations and conceals from the application the complexity of low-level
communication and synchronization with the controller.
This document is intended for the use of software engineers.
Version 3.10 20
SPiiPlus COM Library Programmer's Guide
2. General Information
2. General Information
2.1 General
The COM (Component Object Model) has become the most widely used component software
model in the world. COM provides a software architecture that enables components from different
programming languages and platforms to be combined into a variety of applications.
The SPiiPlus COM Library provides the easiest way to incorporate SPiiPlus motion control
functionality.
Version 3.10 21
SPiiPlus COM Library Programmer's Guide
2. General Information
The SPiiPlus COM Library has been tested with Visual C++, Visual Basic, VBScript, LabView and .NET
applications.
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the controller response
is received.
variant *pWait A pointer that is initialized by an asynchronous function call and should be
passed to GetString() / GetBinary() function.
The methods can also be called synchronously through the IAsyncChannel interface.
The IChannel interface is also supported but its methods can only be called
synchronously
Version 3.10 22
SPiiPlus COM Library Programmer's Guide
2. General Information
Version 3.10 23
SPiiPlus COM Library Programmer's Guide
2. General Information
Dim Ch As Channel
Set Ch =new Channel 'create communication channel object
Call Ch.OpenComxxx(…) 'open communication through any channel
…
FPosition = Ch.GetFPosition(Ch.ACSC_AXIS_0)
'get motor feedback position
…
Ch.CloseCommunication 'close communication
'in VB there is no need to destroy
'communication channel
> 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 COM 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.
Dim Ch As Channel
Set Ch =new Channel 'create communication channel
Call Ch.OpenCommPCI(Ch.ACSC_NONE) 'open communication with 1st controller
…
Fposition1 = Ch.GetFPosition(Ch.ACSC_AXIS_0)
'get motor feedback position from 1st
'controller
Version 3.10 24
SPiiPlus COM Library Programmer's Guide
2. General Information
…
Ch.CloseCommunication 'close communication
Call Ch.OpenCommSerial(1, 115200) 'open communication with 2nd
'controller
…
Fposition2 = Ch.GetFPosition(Ch.ACSC_AXIS_0)
'get motor feedback position from
…
Ch.CloseCommunication 'close communication
Call Ch.OpenCommSerial(2, 115200) 'open communication with 3rd
'controller
…
Fposition3 = Ch.GetFPosition(Ch.ACSC_AXIS_0)
'get motor feedback position from
…
Ch.CloseCommunication 'close communication
'in VB there is no need to destroy
'communication channel
Version 3.10 25
SPiiPlus COM Library Programmer's Guide
2. General Information
Version 3.10 26
SPiiPlus COM Library Programmer's Guide
3. Using the SPiiPlus COM Library
3.1 Redistribution
Follow these steps to register the SPiiPlus COM Library using the REGSVR32.EXE utility that is
supplied with the Microsoft Windows OS:
1. Click the Windows Start button and choose Run.
2. Enter regsvr32 and then SPiiPlusCOM660_x86.dll (for 32-bit environments) or
SPiiPlusCOM660_x64.dll (for 64-bit environments) with the full path. The path and DLL
name should be in quotation marks. For example:
regsvr32 “C:\MyProjects\SPiiPlusCOM660_x86.dll”
The SPiiPlus COM Library requires the SpiiPlus C Library and drivers. See the SPiiPlus C Library
Programmer’s Guide for details of how to redistribute the SPiiPlus C Library.
Public Ch As Channel
5. Now you can call SPiiPlus COM Library methods. For example,
Call ch.OpenCommPCI(-1)
3.3 LabView
This procedure applies for LabView version 7.
Version 3.10 27
SPiiPlus COM Library Programmer's Guide
3. Using the SPiiPlus COM Library
For example:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub button1_onclick
Ch.OpenCommPCI(-1)
End Sub
//-->
</SCRIPT>
</HEAD>
Version 3.10 28
SPiiPlus COM Library Programmer's Guide
3. Using the SPiiPlus COM Library
<BODY>
<OBJECT classid=clsid: 73C1FDD7-7A9F-45cb-AC12-73AC50F9A3C8 height=1
id=Ch
VIEWASTEXT></OBJECT>
<INPUT id=button1 name=button1 style="HEIGHT: 28px; WIDTH: 127px"
type=button value=Button>
</BODY>
</HTML>
Public Ch As SPIIPLUSCOM660Lib.Channel
C#:
Ch = New SPIIPLUSCOM660Lib.Channel
Now you can call SPiiPlus COM Library methods. For example,
Ch.OpenCommPCI(-1)
Version 3.10 29
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4. COM Methods
This chapter details the methods available in the SPiiPlus COM Library. For each method there is a:
> Brief description
> Syntax in the form of: object.method_name(argument, argument, …), where object is a
placeholder for a valid object name, and each argument is of the form: type argument_
name.
> Description of the arguments and their function.
> Return Value
> Remarks
> Example - A short Visual Basic 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 30
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Version 3.10 31
SPiiPlus COM Library Programmer's Guide
4. COM Methods
OpenCommPCI Opens communication with the SPiiPlus PCI via PCI Bus.
4.1.1 CancelOperation
Description
Cancels all operations.
Syntax
object.CancelOperation()
Arguments
None.
Return Value
None.
Remarks
The method waits for the controller response.
If the method fails, the Error object is filled with the error description.
Example
Sub CancelOperation_Sample()
On Error GoTo except
'The method cancels all the operations
Call Ch.CancelOperation
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Version 3.10 32
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.2 Command
Description
The method sends a command to the controller and analyzes the controller response.
Syntax
object.Command(string CommandName)
Arguments
Return Value
None.
Remarks
The method sends a string containing one or more ACSPL+ commands to the controller. The
method verifies that the controller receives the command but does not return the controller
response. The method is intended for commands where the controller response does not include
any information except the prompt.
For commands where the controller response includes some information, use
Transaction.
If the method fails, the Error object is filled with the error description.
Example
Sub Command_Sample()
On Error GoTo except
'Executed controller's command
'Call Ch.Command("enable 0")
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.1.3 CloseComm
Description
The method closes communication via the specified communication channel.
Syntax
object.CloseComm()
Arguments
None
Version 3.10 33
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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
Sub CloseComm_Sample()
On Error GoTo except
'Closes the communication channel
Call Ch.CloseComm
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.1.4 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(string FileName)
Arguments
FileName String specifying the text file into which the buffer is to be flushed
Return Value
None.
Remarks
If Continuous Log is active, the function will fail.
Example
Sub FlushLogFile()
Dim
On Error GoTo except
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Version 3.10 34
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.5 GetBinary
Description
The method waits for completion of an asynchronous call and retrieves a binary data.
Syntax
object.GetBinary(long Timeout, object pWait)
Arguments
The same pointer that was specified for asynchronous call of a SPiiPlus COM
pWait
method (see Asynchronous Calls Support).
Return Value
Variant - The type of return value is real or integer, depending on the type of controller variable.
The return value can be scalar, vector (one-dimensional array) or matrix (two-dimensional array)
depending on data that the controller retrieves.
Remarks
The method waits for completion of asynchronous call, corresponding to pWait, and retrieves the
controller response as VARIANT. pWait must be the same pointer passed to the SPiiPlus COM
method when the asynchronous call was initiated.
If the call of SPiiPlus COM method was successful, the function retrieves controller response as
VARIANT.
If the SPiiPlus COM method has not been completed in Timeout milliseconds or has been aborted
by the CancelOperation, the Error object is filled with the error description.
Example
Sub GetBinary_Sample()
Dim Var
Dim pWait
On Error GoTo except
'Reading whole variable, if the variable is scalar
'Parameters: "FPOS" - controller variable name.
' Ch.ACSC_NONE - ACSPL+ variable
Call Ch.ReadVariableAsVector("FPOS(0)", Ch.ACSC_NONE, Ch.ACSC_
ASYNCHRONOUS, pWait)
'Wait for binary result during 10 sec
Var = Ch.GetBinary(10000, pWait)
'Now Var is a vector of size 1
'Reading whole variable, if the variable is one-dimensional array
'Parameters: "VEL" - controller variable name.
' Ch.ACSC_NONE - ACSPL+ variable
Call Ch.ReadVariableAsVector ("VEL", Ch.ACSC_NONE, Ch.ACSC_
ASYNCHRONOUS, pWait)
'Wait for binary result during 10 sec
Version 3.10 35
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.6 GetConnectionsList
Description
This method retrieves all currently opened on active server connections and its details.
Syntax
object.GetConnectionsList(variant HandlesList, variant AppNamesList, variant ProcessIdList)
Arguments
Return Value
Long.
The method returns the number of connections found or zero if there are no connections on
active server.
Remarks
Each connection is described by its handle, application name and process ID, therefore, all
arguments will have the same size and order, after the method returns.
This method can be used to check if there are some unused connections that remain from
applications that did not close the communication channel or were not gracefully closed
(terminated or killed).
Each returned connection can be terminated only by the TerminateConnection method.
Using any method of the SetServer family makes previously returned connections irrelevant
because it changes the active server.
Example
{
object handlesList = null;
object appNamesList = null;
object processIdList = null;
long numOfConnections;
string name = "neededApplication.exe";
numOfConnections=channel.GetConnectionsList(out handlesList,out
appNamesList,out processIdList);
Version 3.10 36
SPiiPlus COM Library Programmer's Guide
4. COM Methods
handlesList=(object[])handlesList;
appNamesList=(object[])appNamesList;
processIdList =(object[])processIdList;
for (int index = 0; index < numOfConnections; index++)
{
if (name.CompareTo((string)appNamesList[index])==0)
channel.TerminateConnection((long)handlesList[index],
(string)appNamesList[index]);
}
}
catch (Exception ex)
{
ShowException(ex);
}
4.1.7 GetEthernetCards
Description
The method retrieves all SPiiPlus controller IP addresses within a local domain through a standard
Ethernet communication protocol.
Syntax
object.GetEthernetCards(out variant arrIPAddress, [string BroadcastAddress])
Arguments
Return Value
Long.
The method returns the number of cards found or zero if no cards are detected.
Remarks
If more than one controller card is detected, the method initializes arrIPAddress as an array, where
each element is a string that specifies the IP address returned by a controller card. If no controller
card is detected, the method returns zero and does not assign values to the arrIPAddress
parameters.
Example
Sub GetEthernetCards()
object ipAddresses = null;
Channel.GetEthernetCards(out ipAddresses, "255.255.255.255");
foreach (object ipAddress in (object[])ipAddresses) {
string address = ipAddress.ToString();}
On Error GoTo except
except:
Version 3.10 37
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.8 GetPCICards
Description
This method retrieves information about the controller cards inserted in the computer PCI Bus.
Syntax
object.GetPCICards( variant arrBusNumber, variant arrSlotNumber, variant arrFunction)
Arguments
Return Value
Long.
The method returns the number of cards found.
Remarks
If no controller cards are detected, the method returns zero and does not assign values to the
parameters.
The method also fills the parameters with information about the detected cards.
Parameters arrSlotNumber can be used in the OpenCommPCI call to open communication with a
specific card. Other parameters have no use in the SPiiPlus COM Library.
For example, if there are two cards, the method will fill in two rows in arrSlotNumber,
arrBusNumber, arrFunction.
If the method fails, the Error object is filled with the error description.
Example
Sub GetPCICards_Sample()
Dim BusNumber As Variant
Dim SlotNumber As Variant
Dim MethodV As Variant
Dim CardsNumber As Long
On Error GoTo except
'Retrieves information about the controller
'cards
CardsNumber = Ch.GetPCICards(BusNumber, SlotNumber, MethodV)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Version 3.10 38
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.9 GetString
Description
The method waits for completion of asynchronous call and retrieves a string data.
Syntax
object.GetString(long Timeout, object pWait)
Arguements
The same pointer that was specified for asynchronous call of a SPiiPlus COM
pWait
method (see Asynchronous Calls Support).
Return Value
String.
Remarks
This method waits for completion of an asynchronous call, corresponding to pWait, and retrieves
the controller response as String. pWait must be the same pointer passed to the SPiiPlus COM
method when asynchronous call was initiated.
If the call of the SPiiPlus COM method was successful, function retrieves controller response as
String.
If SPiiPlus COM method has not been completed in Timeout milliseconds or has been aborted by
the CancelOperation, the Error object is filled with the error description.
Example
Sub GetString_Sample()
Dim Str As String
Dim pWait
On Error GoTo except
Call Ch.UploadBuffer(0, Ch.ACSC_ASYNCHRONOUS, pWait)
'Wait for uploading buffer ends during 10 sec
Str = Ch.GetString(10000, pWait)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.1.10 OpenCommSimulator
Description
The method executes the SPiiPlus stand-alone simulator via SPiiPlus User Mode Driver in the case
that it is not running.
The function connects to the simulator via TCP/IP protocol.
Version 3.10 39
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Syntax
object.OpenCommSimulator()
Error codes (in case of failure)
Code 133 – if the ports set for simulator in SPiiPlus User Mode Driver are taken by another
application.
Code 136 – in case a simulator execution attempt was made without setting a simulator executable
and default simulator executable was not found.
Example
Sub OpenCommSimulator_Sample()
On Error GoTo except
'Open Ethernet with TCP protocol
'communication with the SPiiPlus
simulator
Call Ch.OpenCommSimulator()
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.1.11 CloseSimulator
Description
The method stops the SPiiPlus simulator via UMD in the case it is running.
Syntax
object.CloseSimulator()
Error codes (in case of failure)
Code 131 - in case an attempt to stop simulator was made without it running in the first place.
Example
Sub CloseSimulator_Sample()
On Error GoTo except
'Open Ethernet with TCP protocol
'communication with the SPiiPlus simulator
Call Ch.CloseSimulator()
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Version 3.10 40
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.12 OpenCommEthernetTCP
Description
The method opens communication with the controller via Ethernet using the TCP protocol.
Syntax
object.OpenCommEthernetTCP(string Address, long Port)
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.
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
Sub OpenCommEthernetTCP_Sample()
On Error GoTo except
'Open Ethernet with TCP protocol
'communication with the controller
'TCP/IP address: 10.0.0.100
Call Ch.OpenCommEthernet("10.0.0.100", Ch.ACSC_SOCKET_STREAM_PORT)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.1.13 OpenCommEthernetUDP
Description
The method opens communication with the controller via Ethernet using the UDP protocol.
Syntax
object.OpenCommEthernetUDP(string Address, long Port)
Arguments
Version 3.10 41
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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.
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
Sub OpenCommEthernetUDP_Sample()
On Error GoTo except
'Open Ethernet with UDP protocol
'communication with the controller
'TCP/IP address: 10.0.0.100
Call Ch.OpenCommEthernetUDP("10.0.0.100", Ch.ACSC_SOCKET_DGRAM_PORT)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.1.14 OpenCommPCI
Description
The method opens a communication channel with the controller via PCI Bus.
Up to 4-communication channels can be open simultaneously with the same SPiiPlus card through
the PCI Bus.
Syntax
object.OpenCommPCI(long 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.
Version 3.10 42
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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.
Example
Sub OpenCommPCI_Sample()
On Error GoTo except
'Open communication with the first found
'controller card
Call Ch.OpenCommPCI(Ch.ACSC_NONE)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.1.15 OpenCommSerial
Description
The method opens communication with the controller via a serial port.
Syntax
object.OpenCommSerial(long Channel, long Rate)
Arguments
Rate This parameter must be equal to the controller variable IOBAUD for the
successful link with the controller. If ACSC_AUTO property is passed, the
method will automatically determine the baud rate.
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 43
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Example
Sub OpenCommSerial_Sample()
On Error GoTo except
'Open serial communication through port COM1
'with baud rate 115200
Call Ch.OpenCommSerial(1, 115200)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.1.16 GetConnectionInfo
Description
The method is used to retrieve the details of opened communication channel .
Syntax
object. GetConnectionInfo(CONNECTION_INFO ConnectionInfo);
Arguments
Return Value
None.
Example
SPIIPLUSCOM660Lib.CONNECTION_INFO connectionInfo;
try
{
Ch.GetConnectionInfo(out connectionInfo);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
this.txtLog.AppendText("IP: "+connectionInfo.EthernetIP.ToString());
this.txtLog.AppendText("Ethernet Port:
"+connectionInfo.EthernetPort.ToString());
this.txtLog.AppendText("Ethernet Protocol:
"+connectionInfo.EthernetProtocol.ToString());
this.txtLog.AppendText("PCI Slot: "+connectionInfo.PCISlot.ToString());
this.txtLog.AppendText("Serial Baud Rate:
"+connectionInfo.SerialBaudRate.ToString());
this.txtLog.AppendText("Serial Port: "+connectionInfo.SerialPort.ToString
());
Version 3.10 44
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.16.1 CONNECTION_TYPE
Description
This enum is used for setting communication type. Used in the GetConnectionInfo method
Format
[
uuid(4422883A-7E14-4F86-A68C-2112D7D6FF0B)
]
enum CONNECTION_TYPE
{
4.1.16.2 CONNECTION_INFO
Description
The structure provides information about specified controller connection for an application. Used in
the GetConnectionInfo method.
Format
[
uuid(7BD37EE9-6A8D-459E-ABF7-032273E29802)
]
struct CONNECTION_INFO
{
CONNECTION_TYPE Type;
int SerialPort;
int SerialBaudRate;
int PCISlot;
int EthernetProtocol;
BSTR EthernetIP;
int EthernetPort;
}
Members
Version 3.10 45
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.17 SetServerExtLogin
Description
The method sets the remote User-Mode Driver (UMD) with a specified IP address, port number, and
user login.
Syntax
object.SetServerExtLogin(string IPAddress, string User, string Password, string Domain)
Arguments
IP address of the remote UMD. This address should be the same address
IPAddress
displayed in the remote UMD dialog.
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
Sub SetServerExtLogin()
Dim
On Error GoTo except
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Version 3.10 46
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.18 TerminateConnection
Description
This method terminates specified communication channel (connection) on active server.
Syntax
object.TerminateConnection(long Handle, string AppName)
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). Both arguments
should be passed as these were retrieved by GetConnectionsList method.
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
try
{
object handlesList = null;
object appNamesList = null;
long numOfConnections;
string name = "neededApplication.exe";
numOfConnections=channel.GetConnectionsList(out handlesList, out
appNamesList);
handlesList=(object[])handlesList;
appNamesList=(object[])appNamesList;
for (int index = 0; index < numOfConnections; index++)
{
if (name.CompareTo((string)appNamesList[index])==0)
channel.TerminateConnection((long)handlesList[index],
(string)appNamesList[index]);
}
}
catch (Exception ex)
{
ShowException(ex);
}
Version 3.10 47
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.1.19 Transaction
Description
The method executes one transaction with the controller, i.e., it sends a command and receives a
controller response.
Syntax
object.Transaction (string Command)
Arguments
Return Value
String.
Remarks
The full operation of transaction includes the following steps:
1. Send Command to the controller.
2. Wait until the controller response is received or the timeout occurs.
3. Return a controller response.
4. If the method fails, the Error object is filled with the error description.
Example
Sub Transaction_Sample()
Dim Cmd As String
Cmd = "?SN" 'get controller serial number
On Error GoTo except
'The method executes one transaction with the controller
reply = Ch.Transaction(Cmd)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Version 3.10 48
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.2.1 GetEtherCATState
Description
The method is used to retrieve the EtherCAT state.
Syntax
object. GetEtherCATState (int* State, ULONGLONG CallType, VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the controller response
is received.
variant *pWait A pointer that is initialized by an asynchronous function call and should be
passed to GetString() / GetBinary() function.
Return Value
None.
Remarks
The EtherCAT State contained in the variable designated by the State argument is defined by the
following bits:
Version 3.10 49
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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.
Return Value
None
Example
4.2.2 GetEtherCATError
Description
The method is used to retrieve the last EtherCAT error code.
Version 3.10 50
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Syntax
object. GetEtherCATError (int* Error, ULONGLONG CallType, VARIANT *pWait);
Arguments
Error Pointer to a variable that receives the last EtherCAT error that has occurred.
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the controller response
is received.
variant *pWait A pointer that is initialized by an asynchronous function call and should be
passed to GetString() / GetBinary() function.
Remarks
The EtherCAT error codes are:
Table 4-4. EtherCAT Error Codes
Error Description
Version 3.10 51
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Return Value
None.
Example
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 (int Flags, int Offset, BSTR VariableName, ULONGLONG CallType, VARIANT
*pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the controller
ulonglong response is received.
CallType
ACSC_ASYNCHRONOUS - The function returns immediately. The calling
thread must then call the GetString() / GetBinary() function to retrieve
the operation result.
Version 3.10 52
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Return Value
None.
Example
In the following example, network variable of EtherCAT node 0 at offset 43 is being mapped to the
global variable: I0.
try
{
Ch.MapEtherCATInput(0, 43, "I0");
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
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 (int Flags, int Offset, BSTR VariableName, ULONGLONG CallType,
VARIANT *pWait);
Arguments
Version 3.10 53
SPiiPlus COM Library Programmer's Guide
4. COM Methods
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the controller
response is received.
Return Value
None.
Example
In the following example, network variable of EtherCAT node 0 at offset 26 is being mapped to
global variable: I1.
try
{
Ch.MapEtherCATOutput(0, 26, "I1");
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
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.
Version 3.10 54
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Syntax
object. UnmapEtherCATInputsOutputs (ULONGLONG CallType, VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the controller response
is received.
Return Value
None.
Example
try
{
Ch.UnmapEtherCATInputsOutputs();
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.2.6 GetEtherCATSlaveIndex
Description
The method retrieves the index of an EtherCAT slave according to provided parameters.
Syntax
object. GetEtherCATSlaveIndex (int VendorID, int ProductID, int Count, double* SlaveIndex,
ULONGLONG CallType, VARIANT *pWait);
Arguments
Version 3.10 55
SPiiPlus COM Library Programmer's Guide
4. COM Methods
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
4.2.7 GetEtherCATSlaveOffset
Description
The method retrieves the offset of a network variable of a specified EtherCAT slave in EtherCAT
telegram.
Syntax
object. GetEtherCATSlaveOffset (BSTR VariableName, int SlaveIndex, double* SlaveOffset,
ULONGLONG CallType, VARIANT *pWait);
Arguments
Version 3.10 56
SPiiPlus COM Library Programmer's Guide
4. COM Methods
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
4.2.8 GetEtherCATSlaveVendorID
Description
The method retrieves the Vendor ID of a specified EtherCAT slave.
Syntax
object. GetEtherCATSlaveVendorID (int SlaveIndex, double* VendorID, ULONGLONG CallType,
VARIANT *pWait);
Arguments
Version 3.10 57
SPiiPlus COM Library Programmer's Guide
4. COM Methods
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
4.2.9 GetEtherCATSlaveProductID
Description
The method retrieves the Product ID of a specified EtherCAT slave.
Syntax
object. GetEtherCATSlaveProductID (int SlaveIndex, double* ProductID, ULONGLONG CallType,
VARIANT *pWait);
Arguments
Version 3.10 58
SPiiPlus COM Library Programmer's Guide
4. COM Methods
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
4.2.10 GetEtherCATSlaveRevision
Description
The method retrieves the revision of a specified EtherCAT slave.
Syntax
object. GetEtherCATSlaveRevision (int SlaveIndex, double* Revision, ULONGLONG CallType, VARIANT
*pWait);
Arguments
Version 3.10 59
SPiiPlus COM Library Programmer's Guide
4. COM Methods
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
4.2.11 GetEtherCATSlaveType
Description
The method retrieves the type of a specified EtherCAT slave.
Syntax
object. GetEtherCATSlaveType (int VendorID, int ProductID, double* SlaveType, ULONGLONG
CallType, VARIANT *pWait);
Arguments
Version 3.10 60
SPiiPlus COM Library Programmer's Guide
4. COM Methods
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
4.2.12 GetEtherCATSlaveState
Description
The method retrieves the EtherCAT state of a specified EtherCAT slave.
Syntax
object. GetEtherCATSlaveState (int SlaveIndex, double* SlaveState, ULONGLONG CallType, VARIANT
*pWait);
Version 3.10 61
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
Version 3.10 62
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.3.1 GetACSCHandle
Description
The method retrieves the SPiiPlus C Library communication handle.
Syntax
object.GetACSCHandle()
Arguments
None.
Return Value
Long.
Remarks
The method retrieves the SPiiPlus C Library communication handle.
If the method fails, the Error object is filled with the error description.
Example
Sub GetACSCHandle_Sample()
Dim Handle
On Error GoTo except
'Retrieves communication handle
Handle = Ch.GetACSCHandle()
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Version 3.10 63
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.3.2 GetCOMLibraryVersion
Description
The method retrieves the SPiiPlus COM Library version number.
Syntax
object.GetCOMLibraryVersion()
Arguments
None.
Return Value
Long.
The method retrieves the SPiiPlus COM Library version number.
Remarks
The SPiiPlus COM 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
Sub GetCOMLibraryVersion_Sample()
Dim LVersion As Double
On Error GoTo except
'Retrieves the SPiiPlus COM Library version
'number.
LVersion = Ch.GetCOMLibraryVersion
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.3.3 GetCommOptions
Description
The method retrieves the communication options.
Syntax
object.GetCommOptions()
Version 3.10 64
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Arguments
None.
Return Value
Long.
The method retrieves the current communication options.
Remarks
To set the communication options call SetCommOptions.
The return value is bit-mapped to represent the current communication options. Currently only the
following option flag is supported:
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
Sub GetCommOptions_Sample()
Dim Options As Double
On Error GoTo except
'Retrieves the current communication options
Options = Ch.GetCommOptions
Options = Options Or Ch.ACSC_COMM_USE_CHECKSUM
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.3.4 GetDefaultTimeout
Description
The method retrieves default communication timeout.
Syntax
object.GetDefaultTimeout()
Arguments
None.
Return Value
Long.
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.
Version 3.10 65
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Example
Sub GetDefaultTimeout_Sample()
Dim TimeOut As Double
On Error GoTo except
'Retrieves default communication timeout
TimeOut = Ch.GetDefaultTimeout
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.3.5 GetErrorString
Description
The method retrieves the explanation of an error code.
Syntax
object.GetErrorString(long ErrorCode)
Arguments
Return Value
String.
The method retrieves the string that contains the text explanation of the error code returned by
the ParseCOMErrorCode, GetMotorError, GetMotionError, and GetProgramError methods.
Remarks
If the error relates to SPiiPlus COM 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.
Version 3.10 66
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Example
Sub GetErrorString_Sample()
Dim Str As String
On Error GoTo except
'The method retrieves the explanation of
'an error code 3260.
Str = Ch.GetErrorString(3260)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.3.6 GetLibraryVersion
Description
The method retrieves the legacy SPiiPlus C Library version number.
Syntax
object.GetLibraryVersion()
Arguments
None.
Return Value
Long.
The method retrieves the legacy SPiiPlus C Library version number.
Remarks
The SPiiPlus C Library version consists of four (or less) numbers separated by points: #.#.#.#. The
binary version number is represented by 32-bit unsigned integer value. Each byte of this value
specifies one number in the following order: high byte of high word – first number, low byte of
high word – second number, high byte of low word – third number and low byte of low word –
forth number. For example the version “2.10” has the following binary representation (hexadecimal
format): 0x020A0000.
The first two numbers in the string form are obligatory. Any release version of the library consists
of two numbers. The third and fourth numbers specify an alpha or beta version, special or private
build, etc.
If the method fails, the Error object is filled with the error description.
Example
Sub GetLibraryVersion_Sample()
Dim LVersion As Double
On Error GoTo except
'Retrieves the SPiiPlus C Library version number.
LVersion = Ch.GetLibraryVersion
Exit Sub
except:
Version 3.10 67
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.3.7 GetTimeout
Description
The method retrieves communication timeout.
Syntax
object.GetTimeout()
Arguments
None.
Return Value
Long.
The method retrieves communication timeout.
Remarks
If the method succeeds, the return value is the current timeout value in milliseconds.
If the method fails, the Error object is filled with the error description.
Example
Sub GetTimeout_Sample()
Dim TimeO As Long
On Error GoTo except
'Retrieves communication timeout
TimeO = Ch.GetTimeout
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.3.8 SetIterations
Description
The method sets the number of iterations in one transaction.
Syntax
object.SetIterations(long Iterations)
Arguments
Return Value
None.
Version 3.10 68
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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 COM methods perform communication with the controller by transactions (i.e.
they send commands and wait for responses) that are based on the Transaction method.
Therefore, the changing of the number of iterations can have an influence on the behavior of the
user application.
The default number of iterations for all communication channels is 2.
If the method fails, the Error object is filled with the error description.
Example
Sub SetIterations_Sample()
On Error GoTo except
'Sets the number of iterations in one
'transaction number of iterations for all
'communication channels is 2.
Call Ch.SetIterations(2)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.3.9 SetCommOptions
Description
The method sets the communication options.
Syntax
object.SetCommOptions(long Options)
Arguments
Return Value
None.
Version 3.10 69
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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 has been
filled in by a call to GetCommOptions. This ensures that the other communication options will have
same values.
If the method fails, the Error object is filled with the error description.
Example
Sub SetCommOptions_Sample()
'The example sets the mode with checksum
Dim Options As Long
On Error GoTo except
Options = Ch.GetCommOptions
Options = Options Or Ch.ACSC_COMM_USE_CHECKSUM
Call Ch.SetCommOptions(Options)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.3.10 SetTimeout
Description
The method sets the communication timeout.
Syntax
object.SetTimeout(long Timeout)
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 COM
methods return with zero value. In this case, the the Error object is assigned ACSC_TIMEOUT.
If the method fails, the Error object is filled with the error description.
Version 3.10 70
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Example
Sub SetTimeout_Sample()
Dim TimeO As Double
On Error GoTo except
'Sets the communication timeout of 2000
Call Ch.SetTimeout(2000)
TimeO = Ch.GetTimeout
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.4.1 AppendBuffer
Description
The method appends one or more ACSPL+ lines to the program in the specified buffer.
Syntax
object.AppendBuffer(long Buffer, string Program, long Count)
Version 3.10 71
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Arguments
Return Value
None.
Remarks
The method appends one or more ACSPL+ lines to the program in the specified buffer. If the buffer
already contains any program, the new text is appended to the end of the existing program.
No compilation or syntax check is provided during downloading. In fact, any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy, the
compile command must be executed after downloading.
If the method fails, the Error object is filled with the error description.
Example
Sub AppendBuffer_Sample()
Dim StringBuf As String
StringBuf = "enable 0;jog 0;stop" & Chr$(10)
On Error GoTo except
'The method appends one ACSPL+ line to
'buffer 0
Call Ch.AppendBuffer(0, StringBuf(1))
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual BasicEnd Sub
4.4.2 ClearBuffer
Description
Deletes the specified ACSPL+ program lines in the specified program buffer.
Syntax
object.ClearBuffer(long Buffer, long FromLine, long ToLine)
Arguments
Version 3.10 72
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Return Value
None.
Remarks
The method deletes the specified ACSPL+ program lines in the specified program buffer.
If the method fails, the Error object is filled with the error description.
Example
Sub ClearBuffer_Sample()
Dim StringBuf(1) As String
StringBuf(0) = "enable 0;jog 0;stop" & Chr$(10)
On Error GoTo except
'Appends the line "enable 0;jog 0;stop" to
'buffer 0
Call Ch.AppendBuffer(0, StringBuf(1))
'Delete buffer 0 from line 1 to 1000
Call Ch.ClearBuffer(0, 1, 1000)
StringBuf(1) = Ch.UploadBuffer(0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual BasicEnd Sub
4.4.3 CompileBuffer
Description
The method compiles the ACSPL+ program in the specified program buffer(s).
Syntax
object.CompileBuffer(long Buffer)
Arguments
Return Value
None.
Remarks
The method compiles an ACSPL+ program in the specified program buffer or all programs in all
buffers if Buffer is ACSC_NONE.
If attempting to compile the D-Buffer, all other buffers will be stopped and put in a
non-compiled state.
Version 3.10 73
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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
Sub CompileBuffer_Sample()
Dim StringBuf(1) As String
StringBuf(1) = "!Compiled buffer;stop" & Chr$(10)
On Error GoTo except
'Append a line to buffer 0
Call Ch.AppendBuffer(0, StringBuf(1))
'The method compiles ACSPL+ program in
'buffer 0
Call Ch.CompileBuffer(0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual BasicEnd Sub
4.4.4 LoadBuffer
Description
The method clears the specified program buffer and then loads ACSPL+ program to this buffer.
Syntax
object.LoadBuffer(long Buffer, string Program, long Count)
Arguments
Return Value
None.
Remarks
The method clears the specified program buffer and then loads ACSPL+ program to this buffer.
Version 3.10 74
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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
Sub LoadBuffer_Sample()
Dim Str As String
Str = "!This is a test ACSPL+ program;Stop" & Chr$(10)
On Error GoTo except
'Load a line to buffer 0
Call Ch.LoadBuffer(0, Str)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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.
Before calling the function LoadBuffersFromFile, the buffers must be reset or cleared.
> To reset the buffers use the command: Api.Transaction("##SR").
> To clear the buffer use the function: Api.(long Buffer, long FromLine, long
ToLine).
Syntax
object.LoadBuffersFromFile(string Filename)
Arguments
Return Value
None.
Remarks
The method analyzes the file, determines which program buffers should be loaded, clears them
and then loads ACSPL+ programs to those buffers.
Version 3.10 75
SPiiPlus COM Library Programmer's Guide
4. COM 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
Sub LoadBuffersFromFile_Sample()
Dim FileP As String
FileP = "C:\\ACSPLFile.txt"
On Error GoTo except
'Opens a file to load
Call Ch.LoadBuffersFromFile(FileP)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.4.6 RunBuffer
Description
The method starts up ACSPL+ program in the specified buffer.
Syntax
object.RunBuffer(long Buffer, [string Label])
Arguments
Label
If NULL (“” - the default) is specified instead of a pointer, the
execution starts from the first line.
Return Value
None.
Version 3.10 76
SPiiPlus COM Library Programmer's Guide
4. COM 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
Sub RunBuffer_Sample()
Dim Index As Long
Dim PState As Long
'Appends and runs buffers 0 to 8
On Error GoTo except
For Index = 0 To 8
Call Ch.AppendBuffer(Index, "ST:")
Call Ch.AppendBuffer(Index, "!an empty loop")
Call Ch.AppendBuffer(Index, "goto ST")
Call Ch.RunBuffer(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.4.7 StopBuffer
Description
The method stops the execution of ACSPL+ program in the specified buffer(s).
Syntax
object.StopBuffer(long Buffer)
Arguments
Return Value
None.
Version 3.10 77
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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
Sub StopBuffer_Sample()
Dim Index As Long
On Error GoTo except
For Index = 0 To 8
'Appends a line to all buffers
Call Ch.AppendBuffer(Index, "ST:;! Empty buffer;goto ST")
'Run all buffers
Call Ch.RunBuffer(Index)
'Stop running all the buffers
Call Ch.StopBuffer(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.4.8 SuspendBuffer
Description
The method suspends the execution of ACSPL+ program in the specified program buffer(s).
Syntax
object.SuspendBuffer(long Buffer)
Arguments
Return Value
None.
Remarks
The method suspends ACSPL+ program execution in the specified buffer or in all buffers if Buffer is
ACSC_NONE. The method has no effect if the program in the specified buffer is not running.
To resume execution of the program in the specified buffer, call the RunBuffer method.
If the method fails, the Error object is filled with the error description.
Version 3.10 78
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Example
Sub SuspendBuffer_Sample()
Dim Index As Long
On Error GoTo except
For Index = 0 To 8
'Appends all buffers
Call Ch.AppendBuffer(Index, "ST:;! Empty buffer;goto ST")
'Run all buffers
Call Ch.RunBuffer(Index)
'Suspends all buffers
Call Ch.SuspendBuffer(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.4.9 UploadBuffer
Description
The method uploads ACSPL+ program from the specified program buffer.
Syntax
object.UploadBuffer(long Buffer)
Arguments
Return Value
String.
Remarks
The method uploads ACSPL+ program from the specified program buffer.
If the method fails, the Error object is filled with the error description.
Example
Sub UploadBuffer_Sample()
Dim Str(1) As String
Str(1) = "!This is an empty buffer" & Chr$(10)
On Error GoTo except
'Appends buffer 0 with Str(1)
Call Ch.AppendBuffer(0, Str(1))
'Uploading buffer 0 from line 0
Str(0) = Ch.UploadBuffer(0)
Exit Sub
except:
Version 3.10 79
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.5.1 ReadVariable
Description
The method reads a variable from the controller.
Syntax
object.ReadVariable(string Variable, long NBuf, [long From1], [long To1], [long From2], [long To2])
Arguments
Return Value
VARIANT.
The type of return value is real or integer, depending on the type of controller variable..
The return value can be scalar, vector (one-dimensional array) or matrix (two-dimensional array)
depending on data that the controller retrieves.
Version 3.10 80
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Remarks
The method reads scalar variables, vectors, rows of matrix, columns of matrix or matrices from a
controller and retrieves data as VARIANT. 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 a ACSPL+ controller variable, a user global variable, or a user local variable.
ACSPL+ and user global variables have global scope; therefore NBuf must be 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 ACSC_NONE. The
method returns all elements of Variable as VARIANT 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
Reading one element from vector (one-dimensional array)
The From1 and To1 should be equal and specify the index of the element. From2 and To2
should be omitted or specified as ACSC_NONE. The method returns the element value as
VARIANT, initialized as scalar.
2. 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 VARIANT, initialized as
scalar method
3. 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 ACSC_NONE. The method returns
data as VARIANT, initialized as a vector with the number of elements equal to To1–From1+1.
4. 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 VARIANT, initialized as a vector with the number of elements equal
To2–From2+1.
Version 3.10 81
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Sub ReadVariable_Sample()
Dim Var
On Error GoTo except
'Reading whole variable, if the variable is scalar
'Parameters: "BAUD " - controller variable name
' Ch.ACSC_NONE - ACSPL+ variable
Var = Ch.ReadVariable ("BAUD ", Ch.ACSC_NONE)
'Now Var is a scalar value
'Reading whole variable, if the variable is one-dimensional array
'Parameters: "VEL" - controller variable name
' Ch.ACSC_NONE - ACSPL+ variable
Var = Ch.ReadVariable("VEL", Ch.ACSC_NONE)
'Now Var is a vector of size 8
'Reading whole Variable, if the Variable is two-dimensional array
'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the
'controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
Var = Ch.ReadVariable ("MyMatrix", Ch.ACSC_NONE)
'Now Var is a matrix of size 3x4
'Reading one element from vector (one-dimensional array)
'Reading one element with index 3
'Parameters: "VEL" - controller variable name
' Ch.ACSC_NONE - ACSPL+ variable
' 3 – From1
' 3 – To1
Var = Ch.ReadVariable("VEL", Ch.ACSC_NONE, 3,3)
'Now Var is a scalar value
Version 3.10 82
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Version 3.10 83
SPiiPlus COM Library Programmer's Guide
4. COM Methods
in the
'controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 0 – From1
' 1 – To1
' 0 – From2
' 2 – To2
Var = Ch.ReadVariable ("MyMatrix ", Ch.ACSC_NONE, 0,1,0,2)
'Now Var is a matrix 2x3
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.5.2 ReadVariableAsScalar
Description
The method reads the variable from a controller and returns as a scalar.
Syntax
object.ReadVariableAsScalar (string Variable, long NBuf, [long Ind1], [long Ind2])
Arguments
Return Value
VARIANT.
The return value is scalar, that is, the type of return value is real or integer, corresponding to the
type of controller variable.
Remarks
Reads a scalar variable, one element of a vector or one element of a matrix from a controller and
returns the value as scalar.
If you require a method return value as one vector element, use the ReadVariableAsVector
method. If you require a method return value as one matrix element, use the
ReadVariableAsMatrix method.
Version 3.10 84
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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 ACSC_NONE (–1) for
these classes of variables.
User-defined local variables exist only within a buffer. The buffer number must be specified for
user-defined local variables.
The following explains how to read indexes in several typical cases.
1. Reading a scalar variable:
The Ind1 and Ind2 indexes should be omitted or specified as ACSC_NONE.
2. Reading one element from a vector (one-dimensional array):
Ind1 should specify index of the element in the vector. Ind2 should be omitted or specified
as ACSC_NONE.
3. Reading one element from a matrix (two-dimensional array):
Ind1 should specify a row number and Ind2 should specify a column number of the
element in the matrix.
If the method fails, the Error object is filled with the error description.
Example
Sub ReadVariableAsScalar_Sample()
'Var in the next 3 examples is returned as scalar
Dim Var
Dim Str As String
On Error GoTo except
'Reading scalar variable
'Parameters: "BAUD" - controller variable name.
' Ch.ACSC_NONE - ACSPL+ variable
Var = Ch.ReadVariableAsScalar ("BAUD", Ch.ACSC_NONE)
'Reading one element from vector (one-dimensional array)
'Reading one element with index 2
'Parameters: "VEL" - controller variable name.
' Ch.ACSC_NONE - ACSPL+ variable
' 2 – Ind1
Var = Ch.ReadVariableAsScalar ("VEL", Ch.ACSC_NONE,2)
'Reading one element from matrix (two-dimensional array)
'Reading one element of matrix from row 1,column 2)
'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 1 – row number
' 2 – column number
Var = Ch.ReadVariableAsScalar ("MyMatrix", Ch.ACSC_NONE,1,2)
Exit Sub
except:
Version 3.10 85
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.5.3 ReadVariableAsVector
Description
The method reads a variable from a controller and returns it as vector.
Syntax
object.ReadVariable(string Variable, long NBuf, [long From1], [long To1], [long From2], [long To2])
Arguments
Return Value
VARIANT.
The return value is a one-dimensional array (vector). The type of return value is real or integer,
corresponding to the type of controller variable.
Remarks
If you want a return value as scalar or matrix use ReadVariableAsScalar or ReadVariableAsMatrix
methods correspondingly.
The variable can be an ACSPL+ variable, a user global variable, or a user local variable.
ACSPL+ and user global variables have global scope; therefore NBuf must be 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 ACSC_NONE.
The method returns all elements of Variable as VARIANT 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 86
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.5.4 ReadVariableAsMatrix
Description
The method reads the variable from a controller and returns it as matrix.
Syntax
object.ReadVariableAsMatrix(string Variable, long NBuf, [long From1], [long To1], [long From2], [long
To2])
Version 3.10 87
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Arguments
Return Value
VARIANT.
The return value is a two-dimensional array (matrix). The type of return value is real or integer,
corresponding to the type of controller variable.
Remarks
If you want a return value as scalar or vector use ReadVariableAsScalar or ReadVariableAsVector
methods correspondingly.
The variable can be an ACSPL+ controller variable, a user global variable, or a user local variable.
ACSPL+ variables and user global variables have a global scope; therefore NBuf must be 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 ACSC_NONE. The
method returns all elements of Variable as VARIANT 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 ACSC_NONE. The method
returns data as VARIANT, 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
Version 3.10 88
SPiiPlus COM Library Programmer's Guide
4. COM Methods
or equal to To2. The method returns data as VARIANT, 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.
Version 3.10 89
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Example
Sub ReadVariableAsVector_Sample()
'Var in the next 3 examples is returned as vector
Dim Var
Dim Str As String
On Error GoTo except
'Reading whole variable, if the variable is scalar
'Parameters: "BAUD" - controller variable name.
' Ch.ACSC_NONE - ACSPL+ variable
Var = Ch.ReadVariableAsVector("BAUD ", Ch.ACSC_NONE)
'Now Var is a vector of size 1
'Reading whole variable, if the variable is one-dimensional array
'Parameters: "VEL" - controller variable name.
' Ch.ACSC_NONE - ACSPL+ variable
Var = Ch.ReadVariableAsVector ("VEL", Ch.ACSC_NONE)
'Now Var is a vector of size 8
'Reading sub-vector from vector
'Reading sub-vector with indexes from 1 to 5
'Parameters: "VEL" - controller variable name
' Ch.ACSC_NONE - ACSPL+ variable
' 1 – From1
' 5 – To1
Var = Ch.ReadVariableAsVector("VEL", Ch.ACSC_NONE,1,5)
'Now Var is a vector of size 5
'Reading row or part of row from matrix
'Reading a part of row 1 from element with index 0 till element with
' index 2
'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
'in the controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 1 – From1
' 1 – To1
' 0 – From2
' 2 – To2
Var = Ch.ReadVariableAsVector("MyMatrix", Ch.ACSC_NONE, 1,1,0,2)
'Now Var is a vector of size 3
Sub ReadVariableAsMatrix_Sample()
'Var in the next 3 examples is returned as matrix
Dim Var
On Error GoTo except
'Reading whole variable, if the variable is scalar
'Read the controller scalar variable BAUD to variable Var
'Parameters: "BAUD " - controller variable name.
' Ch.ACSC_NONE - ACSPL+ variable
Var = Ch.ReadVariableAsMatrix ("BAUD ", Ch.ACSC_NONE)
'Now Var is a matrix of size 1x1
'Reading whole variable, if the variable is one-dimensional array
'Parameters: "VEL" - controller variable name.
' Ch.ACSC_NONE - ACSPL+ variable
Version 3.10 90
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.5.5 WriteVariable
Description
The method writes a value defined as VARIANT to the controller variable(s).
Syntax
object.WriteVariable(variant Value, string Variable, long NBuf, [long From1], [long To1], [long From2],
[long To2])
Version 3.10 91
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Arguments
Return Value
None.
Remarks
This method writes Value to the specified Variable. Variable can be scalar, vector (one-dimensional
array) or matrix (two-dimensional array).
Variable can be either an ASCPL+ variable, user global variable or a user local variable.
ASCPL+ and user global variables have global scope; therefore NBuf must be 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 ACSC_NONE.
The Value dimension should correspond to the Variable dimension as follows:
If Variable is scalar, Value should be scalar, or vector of size 1, or matrix of size 1x1
If Variable is vector of size N, Value should be vector of size N, or matrix of size 1xN, or
matrix of size Nx1
If Variable is matrix of size NxM, Value should be matrix of size NxM
> Writing a value to one element of vector (one-dimensional array)
The From1 and To1 should be equal and specify index of the element. From2 and To2
should be omitted or specified as ACSC_NONE.
> Writing value to one element of matrix (two-dimensional array)
Version 3.10 92
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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 ACSC_NONE.
> Writing a value to row or part of row of matrix
The From1 and To1 should be equal and specify row number. The From2 and To2 should
specify elements range within the specified row, From2 should be less then To2.
> Writing a value to column or part of column of matrix
The From1 and To1 should specify rows range within the specified column, From1 should be
less than To1. The From2 and To2 should be equal and specify column number.
> Writing a value to sub-matrix of matrix
The From1 and To1 should specify rows range, From1 should be less then To1. The From2
and To2 should specify columns range, From2 should be less then To2.
If indexes (From1, To1, From2, To2) are specified, their values must correspond to Value dimensions
described below.
Table 4-8. Value Dimension Indices
Value type is not required to be the same as Variable type. The library provides automatic
conversion from integer to real and from real to integer.
If the method fails, the Error object is filled with the error description.
Example
Sub WriteVariable_Sample()
Dim Scalar, Vector(7), Matrix(2, 3), SubVector(1), SubMatrix(1, 1)
On Error GoTo except
'Initialize Scalar
Scalar = 57600
'Initialize Vector
For Index = 0 To 7
Vector(Index) = 1.1
Next Index
'Initialize Matrix
For Row = 0 To 2
For Colomn = 0 To 3
Version 3.10 93
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Matrix(Row, Colomn) = 2
Next Colomn
Next Row
'Initialize SubVector
SubVector(0) = 3
SubVector(1) = 3
'Initialize SubMatrix
For Row = 0 To 1
For Colomn = 0 To 1
SubMatrix(Row, Colomn) = 4
Next Colomn
Next Row
'Writing scalar to whole variable
'Parameters: Scalar - Value to be assigned to the Variable
' "BAUD " - controller variable name
' Ch.ACSC_NONE - ACSPL+ variable
Call Ch.WriteVariable(Scalar, "BAUD", Ch.ACSC_NONE)
'Writing vector(one-dimensional array)
'to the whole variable
'Parameters: Vector - Value to be assigned to the Variable
' "VEL" - controller variable name
' Ch.ACSC_NONE - ACSPL+ variable
Call Ch.WriteVariable(Vector, "VEL", Ch.ACSC_NONE)
'Writing matrix to whole variable
'Assumed that MyMatrix variable is
'declared as global MyMatrix(3)(4) in
'the controller
'Parameters: Matrix - Value to be assigned to the Variable
' "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
Call Ch.WriteVariable(Matrix, "MyMatrix", Ch.ACSC_NONE)
'Writing value to one element of vector (one-
'dimensional array)
'Parameters: Scalar - Value to be assigned to the Variable
' "VEL" - controller variable name
' Ch.ACSC_NONE - ACSPL+ variable
Call Ch.WriteVariable(Scalar, "VEL", Ch.ACSC_NONE, 2,2)
'Writing value to one element of matrix
'(two-dimensional array)
'Assumed that MyMatrix variable is
'declared as global MyMatrix(3)(4) in
'the controller
'Parameters: Scalar - Value to be assigned to the Variable
' "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 1 – From1
' 1 – To1
' 2 – From2
' 2 – To2
Call Ch.WriteVariable(Scalar, "MyMatrix", Ch.ACSC_NONE, 1, 1, 2, 2)
Version 3.10 94
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Version 3.10 95
SPiiPlus COM Library Programmer's Guide
4. COM Methods
4.6.1 OpenHistoryBuffer
Description
The method opens a history buffer.
Syntax
object.OpenHistoryBuffer(long 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
Sub OpenHistoryBuffer_Sample()
On Error GoTo except
'The method opens a history buffer
'size of the buffer is 5000
Call Ch.OpenHistoryBuffer(5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.6.2 CloseHistoryBuffer
Description
The method closes the history buffer and discards all stored history.
Version 3.10 96
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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.
Example
Sub CloseHistoryBuffer_Sample()
On Error GoTo except
'The method closes the history buffer
'and discards all stored history
Call Ch.CloseHistoryBuffer
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.6.3 GetHistory
Description
The method retrieves the contents of the history buffer.
Syntax
object.GetHistory(Boolean bClear)
Arguments
Return Value
String
The method retrieves the communication history from the history buffer.
Remarks
The communication history includes all commands sent to the controller and all responses and
unsolicited messages from the controller. The amount of history data is limited by the size of the
history buffer. The history buffer works as a cyclic buffer: when the amount of the stored data
exceeds the buffer size, the newly stored data overwrites the earliest data in the buffer.
Version 3.10 97
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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
Sub GetHistory_Sample()
Dim Str As String
On Error GoTo except
'The method opens a history buffer
'size of the buffer is 5000
Call Ch.OpenHistoryBuffer(5000)
'Sending the command "enable 0"
Call Ch.Send("enable 0")
'The method retrieves the contents of the
'history buffer.
Str = Ch.GetHistory(False)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.7.1 OpenMessageBuffer
Description
The method opens an unsolicited messages buffer.
Syntax
object.OpenMessageBuffer(long Size)
Arguments
Version 3.10 98
SPiiPlus COM Library Programmer's Guide
4. COM Methods
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
Sub OpenMessageBuffer_Sample()
On Error GoTo except
'The method opens an unsolicited messages
'buffer size of the opened buffer is 5000
Call Ch.OpenMessageBuffer(5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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.
Version 3.10 99
SPiiPlus COM Library Programmer's Guide
4. COM Methods
Example
Sub CloseMessageBuffer_Sample()
On Error GoTo except
'The method closes the messages buffer
'and discards all stored unsolicited
'messages
Call Ch.CloseMessageBuffer
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Timeout )
Arguments
Return Value
String.
Remarks
The method retrieves single unsolicited message from the message buffer.
If no, unsolicited message is received the method waits until a message arrives.
If the timeout expires, the method exits with ACSC_TIMEOUT error.
If the method fails, the Error object is filled with the error description.
Example
Sub GetSingleMessage_Sample()
Dim Str As String
Dim Cmd As String
Cmd = "?FPOS0"
On Error GoTo except
'The method opens an unsolicited messages
'buffer, size of the opened buffer is 5000
Call Ch.OpenMessageBuffer(5000)
'Sending the command "?FPOS0"
Call Ch.Send(Cmd)
'The method retrieves unsolicited message
4.8.1 OpenLogFile
Description
The method opens a log file.
Syntax
object.OpenLogFile(long FileName)
Arguments
Return Value
None.
Remarks
The method opens a binary file that stores all communication history.
Only one log file can be open for each communication channel.
If the log file has been open, the library writes all incoming and outgoing messages to the specified
file. The messages are written to the file in binary format, i.e., exactly as they are received and sent,
including all service bytes.
Unlike the history buffer, the log file cannot be read within the library. The main usage of the log
file is for debug purposes.
If the method fails, the Error object is filled with the error description.
Example
Sub OpenLogFile_Sample()
On Error GoTo except
'Opens log file
Call Ch.OpenLogFile("C:\COMLogFile.log")
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.8.2 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
Sub CloseLogFile_Sample()
On Error GoTo except
'The method opens the log file
'"COMLogFile.log"
Call Ch.OpenLogFile("C:\COMLogFile.log")
'The method closes the log file
'"COMLogFile.log"
Call Ch.CloseLogFile
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.8.3 WriteLogFile
Description
The method writes to log file.
Syntax
object.WriteLogFile(string Buf, long Count)
Arguments
Return Value
None.
Remarks
The method writes data from a buffer to log file. The log file should be previously opened by the
OpenLogFile method.
The method adds its arguments to the internal UMD binary buffer. In previous C Library versions,
the log file had to be explicitly opened by the OpenLogFile method, otherwise the function would
return an error. Starting with 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
Sub WriteLogFile_Sample()
On Error GoTo except
'Opens a log file
Call Ch.OpenLogFile("C:\COMLogFile.log")
'Write to log file
Call Ch.WriteLogFile("Writing to log file")
'Close the log file
Call Ch.CloseLogFile
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.8.4 GetLogData
Description
The method is used to retrieve the data of firmware log.
Syntax
object. GetLogData (BSTR* Buf, int Count, int* Recevied, ULONGLONG CallType, VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
These methods can only be used with the SPiiPlusSC Motion Controller.
4.9.1 OpenSCLogFile
Description
The method opens the SPiiPlusSC log file.
Syntax
object. OpenSCLogFile(BSTR FileName);
Arguments
FileName Pointer to a buffer containing 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
try
{
Ch.OpenSCLogFile("C:\\SCLogFile2.txt");
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
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
try
{
Ch.CloseSCLogFile();
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.9.3 WriteSCLogFile
Description
The method writes to the SPiiPlusSC log file.
Syntax
object. WriteSCLogFile(BSTR Buf, int Count);
Arguments
Return Value
None.
Remarks
The method writes data from a buffer to the SPiiPlusSC log file.
Example
try
{
Ch.WriteSCLogFile("Hello World!", ("Hello World!").Length);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.9.4 FlushSCLogFile
Description
The method enables flushing the SPiiPlusSC internal buffer to a specified text file from the COM
Library application.
Syntax
object. FlushSCLogFile (BSTR FileName, BOOL bClear);
Arguments
Return Value
None.
Remarks
If Continuous Log is active, the function will fail.
Example
try
{
Ch.FlushSCLogFile("C:\\SCLogFile3.txt", 1);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
The Shared Memory methods have been added in support of SPiiPlus SC to enable
accessing memory addresses. They cannot be used with any other SPiiPlus family
product.
4.10.1 GetSharedMemoryAddress
Description
The method reads the address of shared memory variable.
Syntax
object. GetSharedMemoryAddress (long NBuf, BSTR Var, long* Address, ULONGLONG CallType,
VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
4.10.2 ReadSharedMemoryInteger
Description
The method reads value(s) from an integer shared memory variable.
Syntax
object. ReadSharedMemoryInteger (long Address, VARIANT* Values, long From1, long To1, long
From2, long To2,);
Arguments
Return Value
None.
Example
See Shared Memory Program Example.
4.10.3 WriteSharedMemoryInteger
Description
The method writes value(s) to the integer shared memory variable.
Syntax
object. WriteSharedMemoryInteger (long Address, VARIANT Values, long From1, long To1, long
From2, long To2);
Arguments
Return Value
None.
Example
See Shared Memory Program Example.
4.10.4 ReadSharedMemoryReal
Description
The method reads value(s) from a real shared memory variable.
Syntax
object. ReadSharedMemoryReal (long Address, VARIANT* Values ,long From1, long To1, long From2,
long To2,);
Arguments
Return Value
None.
Example
See Shared Memory Program Example.
4.10.5 WriteSharedMemoryReal
Description
The method writes value(s) to the real shared memory variable.
Syntax
object. WriteSharedMemoryInteger (long Address, VARIANT Values ,long From1, long To1, long
From2, long To2,);
Arguments
Return Value
None.
Example
See Shared Memory Program Example.
try
{
int address1 = new int();
int address2 = new int();
double[,] Values1 = new double[2,2];
int[,] Values2 = new int[2,2];
object Result1,Result2;
Values1[0,0] = 666.66;
Values1[0,1] = 777.77;
Values1[1,0] = 888.88;
Values1[1,1] = 999.99;
Values2[0,0] = 1;
Values2[0,1] = 2;
Values2[1,0] = 3;
Values2[1, 1] = 4;
Ch.GetSharedMemoryAddress(Ch.ACSC_NONE, "realVariable", out address1);
Ch.WriteSharedMemoryReal(address1, Values1, 0, 1, 0, 1);
Ch.ReadSharedMemoryReal(address1, out Result1, 0, 1, 0, 1);
Ch.GetSharedMemoryAddress(Ch.ACSC_NONE,” intVariable”, out address2);
Ch.WriteSharedMemoryInteger(address2, Values2, 0, 1, 0, 1);
Ch.ReadSharedMemoryReal(address2, out Result2, 0, 1, 0, 1);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.11.1 SetConf
Description
The method writes system configuration data.
Syntax
object.SetConf(long Key, long Index, double Value)
Arguments
Return Value
None.
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 Command and Variable Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetConf_Sample()
On Error GoTo except
'Writes system configuration data of axis 0
'to 1 with key 205
Call Ch.SetConf(Ch.ACSC_CONF_DIGITAL_SOURCE_KEY, Ch.ACSC_AXIS_0, 1)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.11.2 GetConf
Description
The method reads system configuration data.
Syntax
object.GetConf(long Key, long Index)
Arguments
Return Value
Double.
The method reads system configuration data.
Remarks
Key specifies the feature number and Index defines axis or buffer to which it should be applied. For
detailed description of system configuration see SPiiPlus Commmand & Variable Reference Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetConf_Sample()
Dim GetC As Double
On Error GoTo except
'Reads system configuration data of axis 0
'with key 205
GetC = Ch.GetConf(Ch.ACSC_CONF_DIGITAL_SOURCE_KEY, Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.11.3 GetVolatileMemoryUsage
Description
The function retrieves the volatile memory load in percentage.
Syntax
object.GetVolatileMemory(double* Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None
Example
object waitObject = 0;
Double Value = new Double();
try
{
Ch. GetVolatileMemoryUsage(0, out Value,Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.11.4 GetVolatileMemoryTotal
Description
The function retrieves the amount of total volatile memory.
Syntax
object.GetVolatileMemoryTotal(double* Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None
Example
object waitObject = 0;
Double Value = new Double();
try
{
Ch. GetVolatileMemoryTotal(0, out Value,Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.11.5 GetVolatileMemoryFree
Description
The function retrieves the amount of free volatile memory.
Syntax
object.GetVolatileMemoryFree(double* Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ulonglong CallType ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
Return Value
None
Example
object waitObject = 0;
Double Value = new Double();
try
{
Ch. GetVolatileMemoryFree (0, out Value,Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.11.6 GetNonVolatileMemoryUsage
Description
The function retrieves the non-volatile memory load in percentage.
Syntax
object.GetNonVolatileMemoryUsage(double* Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ulonglong CallType
ACSC_ASYNCHRONOUS - The function returns immediately.
The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
Return Value
None
Example
object waitObject = 0;
Double Value = new Double();
try
{
Ch. GetNonVolatileMemoryUsage (0, out Value,Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.11.7 GetNonVolatileMemoryTotal
Description
The function retrieves the amount of total non-volatile memory.
Syntax
object.GetNonVolatileMemoryTotal(double* Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ulonglong CallType
ACSC_ASYNCHRONOUS - The function returns immediately.
The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
Return Value
None
Example
object waitObject = 0;
Double Value = new Double();
try
{
Ch. GetNonVolatileMemoryTotal (0, out Value,Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
4.11.8 GetNonVolatileMemoryFree
Description
The function retrieves the amount of free non-volatile memory.
Syntax
object.GetNonVolatileMemoryFree(double* Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ulonglong CallType
ACSC_ASYNCHRONOUS - The function returns immediately.
The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
Return Value
None
Example
object waitObject = 0;
Double Value = new Double();
try
{
Ch. GetNonVolatileMemoryFree (0, out Value,Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.12.1 SetVelocity
Description
The method defines a value of motion velocity.
Syntax
object.SetVelocity(long Axis, double Velocity)
Arguments
Return Value
None.
Remarks
The method writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects the 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
Sub SetVelocity_Sample()
Dim Index As Long
Dim Axes(8)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = Ch.ACSC_AXIS_3
Axes(4) = Ch.ACSC_AXIS_4
Axes(5) = Ch.ACSC_AXIS_5
Axes(6) = Ch.ACSC_AXIS_6
Axes(7) = Ch.ACSC_AXIS_7
Axes(8) = -1
On Error GoTo except
'Sets the velocity to 10000 to all axes
For Index = 0 To 7
Call Ch.SetVelocity(Axes(Index), 10000)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis, doubleVelocity)
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
Sub SetVelocityImm_Sample()
On Error GoTo except
'Writes the specified value of velocity to
'the controller
Call Ch.SetVelocityImm(Ch.ACSC_AXIS_0, 80000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.3 GetVelocity
Description
The method retrieves a value of motion velocity.
Syntax
object.GetVelocity(long 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
Sub GetVelocity_Sample()
Dim Velocity As Double
On Error GoTo except
'Retrieves a value of motion velocity of
'the 0 axis
Velocity = Ch.GetVelocity(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.4 SetAcceleration
Description
The method defines a value of motion acceleration.
Syntax
object.SetAcceleration(long Axis, double Acceleration)
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. 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
Sub SetAcceleration_Sample()
On Error GoTo except
'Defines a value of motion acceleration to
'200000
Call Ch.SetAcceleration(Ch.ACSC_AXIS_0, 200000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis, double Acceleration)
Arguments
Return Value
None.
Remarks
The method writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:
> The currently executed motion.
> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call.
The method has no effect on the master-slave motions.
If the method fails, the Error object is filled with the error description.
Example
Sub SetAccelerationImm_Sample()
On Error GoTo except
'Writes the specified acceleration value to
'the controller
Call Ch.SetAccelerationImm(Ch.ACSC_AXIS_0, 300000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.6 GetAcceleration
Description
The method retrieves a value of motion acceleration.
Syntax
object.GetAcceleration(long Axis)
Arguments
Return Value
Long.
The method retrieves the value of the motion acceleration.
Remarks
The retrieved value is either the value defined by a previous call of the SetAcceleration method or
the default value if there was no previous call of SetAcceleration.
If the method fails, the Error object is filled with the error description.
Example
Sub GetAcceleration_Sample()
Dim Acceleration As Double
On Error GoTo except
'Get acceleration of axis 0
Acceleration = Ch.GetAcceleration(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.7 SetDeceleration
Description
The method defines a value of motion deceleration.
Syntax
object.SetDeceleration(long Axis, double Deceleration)
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. 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
Sub SetDeceleration_Sample()
On Error GoTo except
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(long Axis, double Deceleration)
Arguments
Return Value
None.
Remarks
The method writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:
> The currently executed motion.
> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call.
The method has no effect on the master-slave motions.
If the method fails, the Error object is filled with the error description.
Example
Sub SetDecelerationImm_Sample()
On Error GoTo except
'Writes the specified deceleration value
4.12.9 GetDeceleration
Description
The method retrieves a value of motion deceleration.
Syntax
object.GetDeceleration(long Axis)
Arguments
Return Value
Double.
The method retrieves the value of the motion deceleration.
Remarks
The retrieved value is either the value defined by a previous call of the SetDeceleration method or
the default value if SetDeceleration was not previously called.
If the method fails, the Error object is filled with the error description.
Example
Sub GetDeceleration_Sample()
Dim Deceleration As Double
On Error GoTo except
'Retrieves a value of motion deceleration
Deceleration = Ch.GetDeceleration(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.10 SetJerk
Description
The method defines a value of motion jerk.
Syntax
object.SetJerk(long Axis, double Jerk)
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. 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
Sub SetJerk_Sample()
Dim Index As Long
On Error GoTo except
'Sets jerk value of 2e7 to all axes
For Index = 0 To 7
Call Ch.SetJerk(Index, 20000000)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis, double Jerk)
Arguments
Return Value
None.
Remarks
The method writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:
> The currently executed motion.
> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call.
The method has no effect on the master-slave motions.
If the method fails, the Error object is filled with the error description.
Example
Sub SetJerkImm_Sample()
On Error GoTo except
'Writes the specified jerk value to the
'controller
Call Ch.SetJerkImm(Ch.ACSC_AXIS_0, 2000000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.12 GetJerk
Description
The method retrieves a value of motion jerk.
Syntax
object.GetJerk(long Axis)
Arguments
Return Value
Double.
The method retrieves the value of the motion jerk.
Remarks
The retrieved value is a value defined by a previous call of SetJerk, or the default value if the
method was not called before.
If the method fails, the Error object is filled with the error description.
Example
Sub GetJerk_Sample()
Dim Index As Long
Dim Jerk(7) As Double
On Error GoTo except
'Retrieves the value of the motion jerk
For Index = 0 To 7
Jerk(Index) = Ch.GetJerk(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.13 SetKillDeceleration
Description
The method defines a value of motion kill deceleration.
Syntax
object.SetKillDeceleration(long Axis, double 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
Sub SetKillDeceleration_Sample()
Dim Index As Long
Dim Axes(8)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = Ch.ACSC_AXIS_3
Axes(4) = Ch.ACSC_AXIS_4
Axes(5) = Ch.ACSC_AXIS_5
Axes(6) = Ch.ACSC_AXIS_6
Axes(7) = Ch.ACSC_AXIS_7
Axes(8) = -1
On Error GoTo except
'Sets kill deceleration value of 100000
'to all axes
For Index = 0 To 7
Call Ch.SetKillDeceleration(Axes(Index), 100000)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis, double 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 currently executed motion.
> The waiting motions that were planned before the method call.
> The motions that will be commanded after the method call.
The method has no effect on the master-slave motions.
If the method fails, the Error object is filled with the error description.
Example
Sub SetKillDecelerationImm_Sample()
On Error GoTo except
'Defines a value of motion kill deceleration of 200000
Call Ch.SetKillDecelerationImm(Ch.ACSC_AXIS_0, 200000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.15 GetKillDeceleration
Description
The method retrieves a value of motion kill deceleration.
Syntax
object.GetKillDeceleration(long Axis)
Arguments
Return Value
Double.
The method retrieves the value of the motion kill deceleration.
Remarks
The retrieved value is a value defined by a previous call of SetKillDeceleration, or the default value
if the method was not previously called.
If the method fails, the Error object is filled with the error description.
Example
Sub GetKillDeceleration_Sample()
Dim Index As Long
Dim KDec(7) As Double
On Error GoTo except
'Retrieves a value of motion kill
'deceleration
For Index = 0 To 7
KDec(Index) = Ch.GetKillDeceleration(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.16 SetFPosition
Description
The method assigns a current value of feedback position.
Syntax
object.SetFPosition(long Axis, double FPosition)
Arguments
Return Value
None.
Remarks
The method assigns a current value to the feedback position. No physical motion occurs. The motor
remains in the same position; only the internal controller offsets are adjusted so that the periodic
calculation of the feedback position will provide the required results.
For more information see the explanation of the SET command in the ACSPL+ Programmer’s
Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetFPosition_Sample()
Dim Index As Long
On Error GoTo except
'Sets feedback position value of 0 to all
'axes
For Index = 0 To 7
Call Ch.SetFPosition(Ch.ACSC_AXIS_0, 0)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.17 GetFPosition
Description
The method retrieves the current value of the motor feedback position.
Syntax
object.GetFPosition(long Axis)
Arguments
Return Value
Double.
The method retrieves an instant value of the motor feedback position.
Remarks
The feedback position is a measured position of the motor transferred to user units.
If the method fails, the Error object is filled with the error description.
Example
Sub GetFPosition_Sample()
Dim FPosition As Double
On Error GoTo except
'Retrieves an instant value of the motor
'feedback position
FPosition = Ch.GetFPosition(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.18 SetRPosition
Description
The method assigns a current value of reference position.
Syntax
object.SetRPosition(long Axis, long RPosition)
Arguments
Return Value
None.
Remarks
The method assigns a current value to the reference position. No physical motion occurs. The
motor remains in the same position; only the internal controller offsets are adjusted so that the
periodic calculation of the reference position will provide the required results.
For more information see explanation of the SET command in the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetRPosition_Sample()
Dim Index As Long
Dim Axes(8)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = Ch.ACSC_AXIS_3
Axes(4) = Ch.ACSC_AXIS_4
Axes(5) = Ch.ACSC_AXIS_5
Axes(6) = Ch.ACSC_AXIS_6
Axes(7) = Ch.ACSC_AXIS_7
Axes(8) = -1
On Error GoTo except
'Assigns a current value of 0 to reference
'position to all axes.
For Index = 0 To 7
Call Ch.SetRPosition(Axes(Index), 0)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.19 GetRPosition
Description
The method retrieves an instant value of the motor reference position.
Syntax
object.GetRPosition(long Axis)
Arguments
Return Value
Double.
The method retrieves the current value of the motor reference position.
Remarks
The method retrieves the current value of the motor reference position. The reference position is
a value calculated by the controller as a reference for the motor.
If the method fails, the Error object is filled with the error description.
Example
Sub GetRPosition_Sample()
Dim RPosition As Double
On Error GoTo except
'Retrieves an instant value of the motor
'reference position
RPosition = Ch.GetRPosition(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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
object.GetFVelocity(long Axis)
Arguments
Return Value
Double.
Remarks
The feedback velocity is a measured velocity of the motor transferred to user units.
If the method fails, the Error object is filled with the error description.
Example
Sub GetFVelocity_Sample()
Dim FVelocity As Double
On Error GoTo except
'Retrieves an instant value of the motor
'feedback velocity
FVelocity = Ch.GetFVelocity(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.12.21 GetRVelocity
Description
The method retrieves an instant value of the motor reference velocity.
Syntax
object.GetRVelocity(long Axis)
Arguments
Return Value
Double.
The method retrieves the current value of the motor reference velocity.
Remarks
The reference velocity is a value calculated by the controller in the process of motion generation.
If the method fails, the Error object is filled with the error description.
Example
Sub GetRVelocity_Sample()
Dim RVelocity As Double
On Error GoTo except
'Retrieves an instant value of the motor
'reference velocity
RVelocity = Ch.GetRVelocity(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.13.1 CommutExt
Description
The function initiates motor commutation.
Syntax
object.CommutExt(long Axis, float Current, int Settle, int Slope, ULONGLONG CallType, VARIANT
*pWait)
Arguments
Specifies the time it takes for the current to rise to the desired
Slope
value, ACSC_NONE for default value.
Return Value
None
Comments
The function activates a motor. After the activation, the motor begins to follow the reference and
physical motion is available.
Settle can only be set if Current is set. Similarly Slope can only be set if Settle is set.
Example
4.13.2 Enable
Description
The method activates an axis.
Syntax
object.Enable(long Axis)
Arguments
Return Value
None.
Remarks
The method activates an axis. After activation, the axis begins to follow the reference and physical
motion is available.
If the method fails, the Error object is filled with the error description.
Example
Sub Enable_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.13.3 EnableM
Description
The method activates several motors.
Syntax
object.EnableM(variant Axes)
Arguments
Return Value
None.
Remarks
The method activates several motors. After the activation, the motors begin to follow the
corresponding reference and physical motions for the specified motors are available.
If the method fails, the Error object is filled with the error description.
Example
Sub EnableM_Sample()
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Enable of axes 0 and Y1
Call Ch.EnableM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.13.4 Disable
Description
The method shuts off an axis.
Syntax
object.Disable(long Axis)
Arguments
Return Value
None.
Remarks
The method shuts off a motor. After shutting off the motor cannot follow the reference and
remains at idle.
If the method fails, the Error object is filled with the error description.
Example
Sub Disable_Sample()
On Error GoTo except
'Disable of axis 0
Call Ch.Disable(Ch.ACSC_AXIS_0)
'Wait for motor 0 to disable for 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 0, 5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.13.5 DisableAll
Description
The method shuts off all axes.
Syntax
object.DisableAll()
Arguments
None.
Return Value
None.
Remarks
The method shuts off all motors. After the shutting off none of motors can follow the
corresponding, reference and all motors remain idle.
If no motors are currently enabled, the method has no effect.
If the method fails, the Error object is filled with the error description.
Example
Sub DisableAll_Sample()
On Error GoTo except
'Disable all motors
Call Ch.DisableAll
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.13.6 DisableExt
Description
The method shuts off an axis and defines the disable reason.
Syntax
object.DisableExt(long Axis, long Reason)
Arguments
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
Sub DisableExt_Sample()
Dim MyCode As Long
My Code = 10
On Error GoTo except
4.13.7 DisableM
Description
The method shuts off several axes.
Syntax
object.DisableM(variant 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
Sub DisableM_Sample()
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_00
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Disable axes 0 and 1
Call Ch.DisableM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.13.8 Group
Description
The method creates a coordinate system for a multi-axis motion.
Syntax
object.Group(variant Axes)
Arguments
Return Value
None.
Remarks
The method creates a coordinate system for a multi-axis motion. The first element of the Axes
array specifies the leading axis. The motion parameters of the leading axis become the default
motion parameters for the group.
An axis can belong 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
Sub Group_Sample()
Dim Axes(3)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = -1
On Error GoTo except
'Create group of axes 0, 1 and 3
Call Ch.Group(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.13.9 Split
Description
The method breaks down a previously created axis group.
Syntax
object.Split(variant Axes)
Arguments
Return Value
None.
Remarks
The method breaks down an axis group created before by the Group method. Axes must specify
the same axes as for the Group method that created the group. After the splitting up, the group no
longer exists.
If the method fails, the Error object is filled with the error description.
Example
Sub Split_Sample()
Dim Axes(4)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = Ch.ACSC_AXIS_3
Axes(4) = -1
On Error GoTo except
'Group axes 0, 1, 2, and 3
Call Ch.Group(Axes)
'Split the group of axes 0, 1, 2, and 3
Call Ch.Split(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.13.10 SplitAll
Description
The method breaks down all axis groups created before.
Syntax
object.SplitAll()
Arguments
None.
Return Value
None.
Remarks
The method breaks down all axis groups created before by the Group method.
The application may call this method to ensure that no axes are grouped. If no groups currently
exist, the method has no effect.
If the method fails, the Error object is filled with the error description.
Example
Sub SplitAll_Sample()
Dim Axes(4)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = Ch.ACSC_AXIS_3
Axes(4) = -1
On Error GoTo except
'Group of axes 0, 1, 2, and 3
Call Ch.Group(Axes)
'Split the group of axes 0, 1, 2, and 3
Call Ch.SplitAll
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis)
Arguments
Return Value
None.
Remarks
A motion that was set with the ACSC_AMF_WAIT flag does not start until the Go method is
executed.The motion waits in the appropriate motion queue.
Each axis has a separate motion queue. A single-axis motion waits in the motion queue of the
corresponding axis. A multi-axis motion waits in the motion queue of the leading axis. The leading
axis is an axis specified first in the motion command.
The Go method initiates the motion waiting in the motion queue of the specified axis. If no motion
waits in the motion queue, the method has no effect.
If the method fails, the Error object is filled with the error description.
Example
Sub Go_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 is enabled for 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Wait till GO command executed on axis 0,
'target position of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_WAIT, Ch.ACSC_AXIS_0, 10000)
'Motion start
Call Ch.Go(Ch.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(variant Axes)
Arguments
Return Value
None.
Remarks
Axes motions that were set with the ACSC_AMF_WAIT flag do not start until the GoM method is
executed. The motions wait in the appropriate motion queue.
Each axis has a separate motion queue. A single-axis motion waits in the motion queue of the
corresponding axis. A multi-axis motion waits in the motion queue of the leading axis. The leading
axis is an axis specified first in the motion command.
The GoM method initiates the motions waiting in the motion queues of the specified axes. If no
motion waits in one or more motion queues, the corresponding axes are not affected.
If the method fails, the Error object is filled with the error description.
Example
Sub GoM_Sample()
Dim Points(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
Points(0) = 10000
Points(1) = 10000
4.14.3 Halt
Description
The method terminates a motion using the full deceleration profile.
Syntax
object.Halt(long Axis)
Arguments
Return Value
None.
Remarks
The method terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the method has no effect.
The terminated motion finishes using the full third-order deceleration profile and the motion
deceleration value.
If the method fails, the Error object is filled with the error description.
Example
Sub Halt_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Relative motion of axis 0, target position
'of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_0, 10000)
'Halt executed to axis 0
Call Ch.Halt(Ch.ACSC_AXIS_0)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.14.4 HaltM
Description
The method terminates several motions using the full deceleration profile.
Syntax
object.HaltM(variant Axes)
Arguments
Return Value
None.
Remarks
The method terminates all executed motions that involve the specified axes. The terminated
motions can be either single-axis or multi-axis. All other motions waiting in the corresponding
motion queues are discarded and will not be executed.
If no executed motion involves a specified axis, the method has no effect on the corresponding
axis.
The terminated motions finish using the full third-order deceleration profile and the motion
deceleration values.
If the method fails, the Error object is filled with the error description.
Example
Sub HaltM_Sample()
Dim Points(1) As Double
Dim Index As Long
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
Points(0) = 10000
Points(1) = 10000
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Relative motion of axes 0 and 1 with
'target position of 10000,10000
Call Ch.ToPointM(Ch.ACSC_AMF_RELATIVE, Axes, Points)
'Halt executed on axes 0 and 1
Call Ch.HaltM(Axes)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.14.5 Kill
Description
The method terminates a motion using reduced deceleration profile.
Syntax
object.Kill(long Axis)
Arguments
Return Value
None.
Remarks
The method terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the method has no effect.
The terminated motion finishes with the reduced second-order deceleration profile and the kill
deceleration value.
If the method fails, the Error object is filled with the error description.
Example
Sub Kill_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Relative motion of axis 0 with target
'position of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_0, 10000)
'Kill axis 0
Call Ch.Kill(Ch.ACSC_AXIS_0)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.14.6 KillAll
Description
The method terminates all currently executed motions.
Syntax
object.KillAll()
Arguments
None.
Return Value
None.
Remarks
The method terminates all currently executed motions. Any other motion waiting in any motion
queue is discarded and will not be executed.
If no motion is currently executed, the method has no effect.
The terminated motions finish with the reduced second-order deceleration profile and the kill
deceleration values.
If the method fails, the Error object is filled with the error description.
Example
Sub KillAll_Sample()
Dim Axes(2)
Dim Points(1) As Double
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
Points(0) = 10000
Points(1) = 10000
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Relative motion of axes 0 and 1 with
'target position of 10000,10000
Call Ch.ToPointM(Ch.ACSC_AMF_RELATIVE, Axes, Points)
'Kill axes 0 and 1
Call Ch.KillAll
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.14.7 KillM
Description
The method terminates several motions using reduced deceleration profile.
Syntax
object.KillM(variant Axes)
Arguments
Return Value
None.
Remarks
The method terminates all executed motions that involve the specified axes. The terminated
motions can be either single-axis or multi-axis. All other motions waiting in the corresponding
motion queues are discarded and will not be executed.
If no executed motion involves a specified axis, the method has no effect on the corresponding
axis.
The terminated motions finish with the reduced second-order deceleration profile and the kill
deceleration values.
If the method fails, the Error object is filled with the error description.
Example
Sub KillM_Sample()
Dim Axes(2)
Dim Points(1) As Double
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
Points(0) = 1000000
Points(1) = 1000000
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Relative motion of axes 0 and 1 with
'target position of 10000,10000
Call Ch.ToPointM(Ch.ACSC_AMF_RELATIVE, Axes, Points)
'Kill axes 0 and 1
Call Ch.KillM(Axes)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.14.8 KillExt
Description
The method terminates a motion using reduced deceleration profile and defines the kill reason.
Syntax
object.KillExt(long Axis, long Reason)
Arguments
Return Value
None.
Remarks
The method terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the method has no effect.
The terminated motion finishes with the reduced second-order deceleration profile and the kill
deceleration value.
If Reason specifies one of the available motor termination codes, the state of the killed motor will
be identical to the state of the motor killed for the corresponding fault. This provides an enhanced
implementation of user-defined fault response.
If the second parameter specifies an arbitrary number, the motor state will be displayed as
“Kill/disable reason: <number> - customer code”. This provides ability to separate different Kill
commands in the application.
If the method fails, the Error object is filled with the error description.
Example
Sub KillExt_Sample()
Dim MyCode As Long
MyCode = 10
On Error GoTo except
' Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
' Wait till 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
' Relative motion of axis 0 with target
' position of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_0, 10000)
' Kill axis 0 with internal customer code
Call Ch.KillExt(Ch.ACSC_AXIS_0, MyCode)
' Finish the motion
' End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
ErrorMsg 'See Error Handling in Visual Basic
End Sub
4.14.9 Break
Description
Terminates a motion immediately and provides a smooth transition to the next motion.
Syntax
object.Break(long Axis)
Arguments
Return Value
None.
Remarks
The method terminates the executed motion that involves the specified axis only if the next
motion is waiting in the corresponding motion queue. The terminated motion can be either single-
axis or multi-axis.
If the motion queue contains no waiting motion, the break command is not executed immediately.
The current motion continues instead until the next motion is planned to the same motion queue.
Only then is the break command executed.
If no executed motion involves the specified axis, or the motion finishes before the next motion is
planned, the method has 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
Sub Break_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait axis 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Start up the motion of axis 0 to point
'10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_0, 10000)
'Executing of break to axis 0
Call Ch.Break(Ch.ACSC_AXIS_0)
'Change the end of the point to point 0
'on the fly
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_0, 0)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.14.10 BreakM
Description
Terminates several motions immediately and provides a smooth transition to the next motions.
Syntax
object.BreakM(variant Axes)
Arguments
Return Value
None.
Remarks
The method terminates the executed motions that involve the specified axes. Only those motions
are terminated that have the next motion waiting in the corresponding motion queue. The
terminated motions can be either single-axis or multi-axis.
If a motion queue contains no waiting motion, the break command does not immediately affect
the corresponding axis. The current motion continues instead until the next motion is planned to
the same motion queue. Only then, the break command is executed.
If no executed motion involves the specified axis, or the corresponding motion finishes before the
next motion is planned, the method does not affect the axis.
When executing the break command, the controller terminates the motion immediately without
any deceleration profile. Instead, the controller builds a smooth third-order transition profile to the
next motion.
Use caution when implementing the break command with a multi-axis motion, because the
controller provides a smooth transition profile of the vector velocity. In a single-axis motion, this
ensures a smooth axis velocity, but in a multi-axis motion, an axis velocity can change abruptly if the
terminated and next motions are not tangent in the junction point. To avoid jerk, the terminated
and next motion must be tangent or nearly tangent in the junction point.
If the method fails, the Error object is filled with the error description.
Example
Sub BreakM_Sample()
Dim Axes(8)
Dim Points(7) As Double
Dim Index As Long
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = Ch.ACSC_AXIS_3
Axes(4) = Ch.ACSC_AXIS_4
Axes(5) = Ch.ACSC_AXIS_5
Axes(6) = Ch.ACSC_AXIS_6
Axes(7) = Ch.ACSC_AXIS_7
Axes(8) = -1
For Index = 0 To 7
Points(Index) = 10000
Next Index
On Error GoTo except
'Enable all axes
Call Ch.EnableM(Axes)
'Start up the motion of axes to point 10000
Call Ch.ToPointM(Ch.ACSC_AMF_RELATIVE, Axes, Points)
'Executing of break to all axes
Call Ch.BreakM(Axes)
For Index = 0 To 7
Points(Index) = -10000
Next Index
'Change the end points to point -10000 on
'thefly
Call Ch.ToPointM(Ch.ACSC_AMF_RELATIVE, Axes, Points)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.15.1 ToPoint
Description
The method initiates a single-axis motion to the specified point.
Syntax
object.ToPoint(long Flags, long Axis, double Point)
Arguments
Return Value
None.
Remarks
The method initiates a single-axis point-to-point motion.
The motion is executed using the required motion velocity and finishes with zero end velocity. The
required motion velocity is the velocity specified by the previous call of the SetVelocity method or
the default velocity if the method was not called.
To execute multi-axis point-to-point motion, use ToPointM. To execute motion with other motion
velocity or non-zero end velocity, use ExtToPoint or ExtToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end. To wait for the motion end, use
WaitMotionEnd method.
The motion builds the velocity profile using the required values of velocity, acceleration,
deceleration, and jerk of the specified axis.
If the method fails, the Error object is filled with the error description.
Sub ToPoint_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait axis 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Relative motion of axis 0 to target point
'of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_0, 10000)
'Wait till motion ends
Call Ch.WaitMotionEnd(Ch.ACSC_AXIS_0, 10000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.15.2 ToPointM
Description
The method initiates a multi-axis motion to the specified point.
Syntax
object.ToPointM(long Flags, variant Axes, variant Point)
Arguments
Return Value
None.
Remarks
The method initiates a multi-axis point-to-point motion.
The motion is executed using the required motion velocity and finishes with zero end velocity. The
required motion velocity is the velocity specified by the previous call of the SetVelocity method, or
the default velocity if the method was not called.
To execute single-axis point-to-point motion, use ToPoint. To execute motion with other motion
velocity or non-zero end velocity, use ExtToPoint or ExtToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end. To wait for the motion end, use
WaitMotionEnd method.
The motion builds the velocity profile using the required values of velocity, acceleration,
deceleration, and jerk of the leading axis. The leading axis is the first axis in the Axes array.
If the method fails, the Error object is filled with the error description.
Example
Sub ToPointM_Sample()
Dim Point(1) As Double
Dim Index As Long
Dim result(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
Point(0) = 10000
Point(1) = 10000
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Immediately start the motion of the axes XY
'to the absolute target points 10000,10000
Call Ch.ToPointM(0, Axes, Point)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Flags, long Axis, double Point, [double Velocity], [double EndVelocity])
Arguments
Return Value
None.
Remarks
The method initiates a single-axis point-to-point motion.
If the ACSC_AMF_VELOCITY flag is specified, the motion is executed using the velocity specified by
Velocity. Otherwise, the required motion velocity is used. The required motion velocity is the
velocity specified by the previous call of SetVelocity, or the default velocity if the method was not
called.
If the ACSC_AMF_ENDVELOCITY flag is specified, the motion velocity at the final point is specified by
the EndVelocity. Otherwise, the motion velocity at the final point is zero.
To execute a multi-axis point-to-point motion with the specified velocity or end velocity, use
ExtAddPointM. To execute motion with default motion velocity and zero end velocity, use ToPoint
or ToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end. To wait for the motion end, use
WaitMotionEnd.
The motion builds the velocity profile using the required values of acceleration, deceleration and
jerk of the specified axis.
If the method fails, the Error object is filled with the error description.
Example
Sub ExtToPoint_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait untill axis 0 is disabled for 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Parameters: Ch.ACSC_AMF_VELOCITY Or
'Ch.ACSC_AMF_ENDVELOCITY -
'Start up the motion with specified velocity
'5000
'Come to the end point with specified
'velocity 1000
'Ch.ACSC_AXIS_0 - axis 0
'10000 - target point
'5000 - motion velocity
'1000 - velocity in the target point
Call Ch.ExtToPoint(Ch.ACSC_AMF_VELOCITY Or Ch.ACSC_AMF_ENDVELOCITY,
Ch.ACSC_AXIS_0, 10000, 5000, 1000)
'Wait motion ends during 20 sec
Call Ch.WaitMotionEnd(Ch.ACSC_AXIS_0, 20000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Flags, variant Axes, variant Point, [double Velocity], [ double EndVelocity])
Arguments
Return Value
None.
Remarks
The method initiates a multi-axis point-to-point motion.
If the ACSC_AMF_VELOCITY flag is specified, the motion is executed using the velocity specified by
Velocity. Otherwise, the required motion velocity is used. The required motion velocity is the
velocity specified by the previous call of SetVelocity, or the default velocity if the method was not
called.
If the ACSC_AMF_ENDVELOCITY flag is specified, the motion velocity at the final point is specified by
the EndVelocity. Otherwise, the motion velocity at the final point is zero.
To execute a single-axis point-to-point motion with the specified velocity or end velocity, use
ExtToPoint. To execute a motion with default motion velocity and zero end velocity, use ToPoint or
ToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait for the motion end. To wait for the motion end, use the
WaitMotionEnd method.
The motion builds the velocity profile using the required values of acceleration, deceleration and
jerk of the leading axis. The leading axis is the first axis in the Axes array.
If the method fails, the Error object is filled with the error description.
Example
Sub ExtToPointM_Sample()
Dim Index As Long
Dim Points(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
Points(0) = 1000
Points(1) = 2000
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Parameters: Ch.ACSC_AMF_VELOCITY Or
'Ch.ACSC_AMF_ENDVELOCITY -
'Start up the motion with specified velocity
'5000
'come to the end point with specified velocity
'1000
'Axes - axes 0 and 1
'Points - target point
'5000 - motion velocity
'1000 - velocity in the target point
Call Ch.ExtToPointM(Ch.ACSC_AMF_VELOCITY Or Ch.ACSC_AMF_ENDVELOCITY,
Axes, Points, 5000, 1000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.16.1 Track
Description
The method initiates a single-axis track motion.
Syntax
object.Track(long Flags, long Axis)
Arguments
Return Value
None.
Remarks
The method initiates a single-axis track motion. After the motion is initialized, PTP motion will be
generated with every change in the TPOS value.
The controller response indicates that the command was accepted and the motion was planned
successfully.
If the method fails, the Error object is filled with the error description.
Example
Sub Track_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait axis 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Start up immediately the motion of the axis
'0
Call Ch.Track(0, Ch.ACSC_AXIS_0)
'Target position to 5000
Call Ch.Transaction("TPOS0=5000")
End If
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.17.1 Jog
Description
The method initiates a single-axis jog motion.
Syntax
object.Jog(long Flags, long Axis, [doubleVelocity])
Arguments
Return Value
None.
Remarks
The method initiates a single-axis jog. To execute multi-axis jog, use JogM.
The jog motion is a motion with constant velocity and no defined ending point. The jog motion
continues until the next motion is planned, or the motion is killed for any reason.
The motion builds the velocity profile using the default values of acceleration, deceleration and jerk
of the specified axis. If the ACSC_AMF_VELOCITY flag is not specified, the default value of velocity is
used as well. In this case, only the sign of Velocity is used in order to specify the direction of motion.
The positive velocity defines a positive direction, the negative velocity defines the negative
direction.
If the ACSC_AMF_VELOCITY flag is specified, the value of Velocity is used instead of the default
velocity. The sign of Velocity defines the direction of the motion.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. No waiting for the motion end is provided.
If the method fails, the Error object is filled with the error description.
Example
Sub Jog_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Initiates a single-axis jog motion to axis
'0 to positive direction with the specified
'velocity 10000
Call Ch.Jog(Ch.ACSC_POSITIVE_DIRECTION, Ch.ACSC_AXIS_0, 10000)
'Finish the motion
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.17.2 JogM
Description
The method initiates a multi-axis jog motion.
Syntax
object.JogM(long Flags, variant Axes, variant Direction, [double Velocity])
Arguuments
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.
Sub JogM_Sample()
Dim Directions(1)
Dim Axes(2)
Directions(0) = Ch.ACSC_POSITIVE_DIRECTION
Directions(1) = Ch.ACSC_POSITIVE_DIRECTION
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Start up immediately the jog motion of axes
'XY to positive directions with the
'specified velocity 5000
Call Ch.JogM(0, Axes, Directions, 5000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.18.1 SetMaster
Description
The method initiates calculating of master value for an axis.
Syntax
object.SetMaster(long Axis, string Formula)
Arguments
Formula ASCII string that specifies a rule for calculating master value.
Return Value
None.
Remarks
The method initiates calculating of master value for an axis.
The master value for each axis is presented in the controller as one element of the MPOS array.
Once the SetMaster method is called, the controller is calculates the master value 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
Sub SetMaster_Sample()
Dim MFormula As String
'Master value is calculated as feedback
'position of the axis T with scale factor
'equal 2
MFormula = "2 * T_FPOS"
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_Z
Axes(1) = Ch.ACSC_AXIS_T
Axes(2) = -1
On Error GoTo except
'Enable axes ZT
Call Ch.EnableM(Axes)
'Set master formula "Z_MPOS=2 * T_FPOS"
Call Ch.SetMaster(Ch.ACSC_AXIS_Z, MFormula)
'Set axis Z to slave
Call Ch.Slave(0, Ch.ACSC_AXIS_Z)
'Relative motion with target position of
'10000
4.18.2 Slave
Description
The method initiates a master-slave motion.
Syntax
object.Slave(long Flags, long Axis)
Arguments
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
Sub Slave_Sample()
Dim MFormula As String
'Master value is calculated as feedback
'position of the axis T with scale factor
'equal 2
MFormula = "2 * T_FPOS"
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_Z
Axes(1) = Ch.ACSC_AXIS_T
Axes(2) = -1
On Error GoTo except
'Enable axes ZT
Call Ch.EnableM(Axes)
'Set master formula "Z_MPOS=2 * T_FPOS"
Call Ch.SetMaster(Ch.ACSC_AXIS_Z, MFormula)
'Set axis Z to slave
Call Ch.Slave(0, Ch.ACSC_AXIS_Z)
'Relative motion with target position of
'10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_T, 10000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.18.3 SlaveStalled
Description
The method initiates master-slave motion within predefined limits.
Syntax
object.SlaveStalled(long Flags, long Axis, double Left, double Right)
Arguments
Return Value
None.
Remarks
The method initiates single-axis master-slave motion within predefined limits. Use Slave to initiate
unlimited motion. For sophisticated forms of master-slave motion, use slaved variants of
segmented and spline motions.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully.
The master-slave motion continues until the Kill command is executed, or the motion fails for any
reason.
The master value for the specified axis must be defined before by the call to SetMaster method.
The SetMaster method can be called again in order to change the formula of master calculation. If
at this moment the master-slave motion is in progress, the slave can come out from synchronism.
The controller then regains synchronism, probably with 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.
Sub SlaveStalled_Sample()
Dim MFormula As String
'Master value is calculated as
‘feedback position of the axis T with
‘scale factor equal 2
MFormula = "2 * T_FPOS"
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_Z
Axes(1) = Ch.ACSC_AXIS_T
Axes(2) = -1
On Error GoTo except
'Enable axes ZT
Call Ch.EnableM(Axes)
'Set master formula "Z_MPOS=2 * T_FPOS"
Call Ch.SetMaster(Ch.ACSC_AXIS_Z, MFormula)
'Left (negative) limit of the following
'area,right (positive) limit of the
'following area
Call Ch.SlaveStalled(0, Ch.ACSC_AXIS_Z, -5000, 5000)
'Relative motion with target position of
'10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_T, 10000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.19.1 MultiPoint
Description
The method initiates a single-axis multi-point motion.
Syntax
object.MultiPoint(long Flags, long Axis, double Dwell)
Arguments
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 AddPoint 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.
Sub MultiPoint_Sample()
Dim Index As Long
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Create multi-point motion of axis 0 with
'default velocity with dwell 1 ms
Call Ch.MultiPoint(0, Ch.ACSC_AXIS_0, 1)
'Add some points
For Index = 0 To 5
Call Ch.AddPoint(Ch.ACSC_AXIS_0, 100 * Index)
Next Index
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.19.2 MultiPointM
Description
The method initiates a multi-axis multi-point motion.
Syntax
object.MultiPointM(long Flags, variant Axes, double Dwell)
Arguments
Return Value
None.
Remarks
The method initiates a multi-axis multi-point motion. To execute single-axis multi-point motion, use
MultiPoint.
The motion executes sequential positioning to each of the specified points, optionally with dwell in
each point.
The method itself does not specify any point, so the created motion starts only after the first point
is specified. The points of motion are specified by using AddPointM or ExtAddPointM, methods that
follow this method.
The motion finishes when the EndSequenceM method is executed. If the call of EndSequenceM is
omitted, the motion will stop at the last point of the sequence and wait for the next point. No
transition to the next motion in the motion queue will occur until the method EndSequenceM
executes.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method cannot wait or validate the end of the motion. To wait for the motion
end, use the WaitMotionEnd method.
During positioning to each point, a vector velocity profile is built using the default values of velocity,
acceleration, deceleration, and jerk of the axis group. If the AFM_VELOCITY flag is not specified, the
default value of velocity is used as well. If the AFM_VELOCITY flag is specified, the value of velocity
specified in subsequent ExtAddPointM methods is used.
If the method fails, the Error object is filled with the error description.
Example
Sub MultiPointM_Sample()
Dim Index As Long
Dim Points(1)
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Create multi-point motion of axes 0 and 1
'with default velocity without dwell in the
'points
Call Ch.MultiPointM(0, Axes, 0)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 100 * Index
Call Ch.AddPointM(Axes, Points)
Next Index
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Flags, long Axis, [double Period])
Arguments
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
Sub Spline_Sample()
Dim Index As Long
Dim Points(1) As Double
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Create the arbitrary path motion to axis 0
'use a cubic interpolation between the
'specified Points with uniform interval 500
'ms
Call Ch.Spline(Ch.ACSC_AMF_CUBIC, Ch.ACSC_AXIS_0, 500)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 20000 * Index
Call Ch.AddPVPoint(Ch.ACSC_AXIS_0, Points(0), Points(1))
Next Index
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Flags, variant Axes, [double Period])
Arguments
Return Value
None.
Remarks
The method initiates a multi-axis spline motion. To execute a single-axis spline motion, use Spline.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method cannot wait or validate the end of the motion. To wait for the motion
end, use the WaitMotionEnd method.
The motion does not use the default values of velocity, acceleration, deceleration, and jerk. The
points and the time intervals between the points define the motion profile completely.
Points for arbitrary path motion are defined by the consequent calls of the AddPVPointM or
ExtAddPointM methods. The EndSequenceM method terminates the point sequence. After
execution of the EndSequenceM method, no AddPointM or ExtAddPointM methods for this motion
are allowed.
The trajectory of the motion follows through the defined points. Each point presents the instant
desired position at a specific moment. Time intervals between the points are uniform, or non-
uniform as defined by the ACSC_AMF_VARTIME flag.
This motion does not use motion profile generation. Typically, the time intervals between the
points are short, so that the array of the points implicitly specifies the desired velocity in each point.
If the time interval does not coincide with the controller cycle, the controller provides interpolation
of the points according to the ACSC_AMF_CUBIC flag.
If the method fails, the Error object is filled with the error description.
Example
Sub SplineM_Sample()
Dim Index As Long
Dim Points(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Create the arbitrary path motion to axes
'0 and 1 with uniform interval 10 ms use a
'cubic interpolation between the specified
'Points
Call Ch.SplineM(Ch.ACSC_AMF_CUBIC, Axes, 10)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 200 * Index
Call Ch.AddPVPointM(Axes, Points, Points)
Next Index
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.21.1 AddPVPoint
Description
The method adds a point to a single-axis PV spline motion and specifies velocity.
Syntax
object.AddPVPoint(long Axis, double Point, double Velocity)
Arguments
Return Value
None.
Remarks
Before this method can be used, initiate PV spline motion by calling Spline with the appropriate
flags.
The method adds a point to a single-axis PV spline motion with a uniform time and specified
velocity at that point
To add a point to a multi-axis PV motion, use AddPVTPointM and ExtAddPointM.
To add a point to a PVT motion with non-uniform time interval, use the AddPVTPoint and
AddPVTPointM methods. The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, call this method
periodically until the method returns a non-zero value.
If the method fails, the Error object is filled with the error description.
Example
Sub AddPVPoint_Sample()
Dim Index As Long
Points(1) As Double
On Error GoTo except 'Create PV motion with uniform time
'interval with uniform interval 500 ms
Call Ch.Spline(Ch.ACSC_AMF_CUBIC, Ch.ACSC_AXIS_0, 500)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 20000 * Index 'Position and velocity for each
'of axis 0
Call Ch.AddPVPoint(Ch.ACSC_AXIS_0, Points(0), Points(1))
Next Index
For Index = 0 To 1000000000: Next Index
'Finish the motion
'The end of the arbitrary path motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
4.21.2 AddPVPointM
Description
The method adds a point to a multiple-axis PV spline motion and specifies velocity.
Syntax
object.AddPVPointM(variant Axes, variant Point, variant Velocity)
Arguments
Return Value
None.
Remarks
Before this method can be used, PVT spline motion must be initiated by calling SplineM with the
appropriate flags.
The method adds a point to a multiple-axis PV spline motion with a uniform time and specified
velocity at that point.
To add a point to a single-axis PV motion, use AddPVPoint. To add a point to a PVT motion with non-
uniform time interval, use the AddPVTPoint and AddPVTPointM methods.
The method waits for the controller response.
The controller response indicates that the 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
Sub AddPVPointM_Sample()
Dim Index As Long
Dim Points(1) As Double
Dim Axes(2) As String
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except 'Enable axes 0 and 1
Call Ch.EnableM(Axes) 'Create PV motion with uniform time
'interval with uniform interval 1000 ms
Call Ch.SplineM(Ch.ACSC_AMF_CUBIC, Axes, 1000)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 200 * Index 'Position and velocity for each point
Call Ch.AddPVPointM(Axes, Points, Points)
Next Index 'Finish the motion
'End of the arbitrary path motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis, double Point, double Velocity, [double TimeInterval])
Arguments
Return Value
None.
Remarks
Before this method can be used, PV spline motion must be initiated by calling Spline with the
appropriate flags.
The method adds a point to a single-axis PVT spline motion with a non-uniform time and specified
velocity at that point.
To add a point to a multi-axis PVT motion, use 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
Sub AddPVTPoint_Sample()
Dim Index As Long
Dim Points(1) As Double
On Error GoTo except 'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0) 'Wait axis 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'PVT motion and uniform interval is
'not used
Call Ch.Spline(Ch.ACSC_AMF_CUBIC Or Ch.ACSC_AMF_VARTIME,
Ch.ACSC_AXIS_0, 0) 'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 200 * Index 'Position, velocity and time
'intervalof 500 ms for each point
Call Ch.AddPVTPoint(Ch.ACSC_AXIS_0, Points(0), Points(1), 500)
Next Index 'Finish the motion
'End of the arbitrary path motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(variant Axes, variant Point, variant Velocity, [double TimeInterval])
Arguments
Return Value
None.
Remarks
Before this method can be used, PVT spline motion must be initiated by calling SplineM with the
appropriate flags.
The method adds a point to a multiple-axis PVT spline motion with a non-uniform time and
specified velocity at that point.
To add a point to a single-axis PVT motion, use AddPVTPoint. To add a point to a PV motion with a
uniform time interval, use the AddPVPoint and AddPVPointM methods.
The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns non-zero value.
If the method fails, the Error object is filled with the error description.
Example
Sub AddPVTPointM_Sample()
Dim Index As Long
Dim Points(1)
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'PVT motion and uniform interval is not
'used
Call Ch.SplineM(Ch.ACSC_AMF_CUBIC Or Ch.ACSC_AMF_VARTIME, Axes, 0)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 200 * Index
'Position, velocity and time interval of
'1000 ms for each point
Call Ch.AddPVTPointM(Axes, Points, Points, 1000)
Next Index
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Initiates a multi-
axis extended
ExtendedSegmentedMotionExt
segmented
motion.
Adds an arc
segment to a
segmented
motion and
specifies the
ExtendedSegmentArc1 coordinates of
center point,
coordinates of
the final point,
and the direction
of rotation.
Adds an arc
segment to a
segmented
motion and
ExtendedSegmentArc2
specifies the
coordinates of
center point and
rotation angle.
The function
initiates a multi-
axis blended
segmented
BlendedSegmentMotion
motion. Extended
segmented
motion provides
new features.
Provides a
smooth transition
between two
Stopper
segments of
segmented
motion.
Sets a projection
matrix for a
Projection
segmented
motion.
4.22.1 ExtendedSegmentedMotionExt
Description
The method initiates a multi-axis extended segmented motion.
Syntax
object.ExtendedSegmentedMotionExt(long Flags, VARIANT Axes, VARIANT Point, double Velocity,
double EndVelocity, double JunctionVelocity, double Angle, double CurveVelocity, double
Deviation, double Radius, double MaxLength, double StarvationMargin, BSTR Segments,
ULONGLONG CallType, VARIANT *pWait);
Arguments
If the Segments parameter is used, then the starvation margin must also be
defined.
If CALLTYPE is:
ACSC_SYNCHRONOUS - The function returns when the controller
response is received.
ACSC_ASYNCHRONOUS - The function returns immediately. The
ulonglong CallType calling thread must then call the GetString() / GetBinary ()function
to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case, the
operation result is ignored by the library and cannot be retrieved to
the calling thread.
Flags
General Flags
ACSC_AMF_
Plan the motion but do not start it until the function GoMis executed.
WAIT
ACSC_AMF_ The motion will use velocity specified for each segment instead of the
VELOCITY default velocity.
Enable velocity limitations under axis limits. With this flag set, setting the
ACSC_AMF_
ACSC_AMF_VELOCITY flag will result in the requested velocity being
AXISLIMIT
restrained by the velocity limits of all involved axes.
Decelerate to corner.
This flag requires an additional parameter that specifies corner
velocity. The controller detects corners on the path and
decelerates to the specified velocity before the corner. The
specified value should be less than the required velocity;
ACSC_AMF_ otherwise the parameter is ignored.
JUNCTIONVELOCITY If ACSC_AMF_JUNCTIONVELOCITY flag is not specified while ACSC_
AMF_ANGLE flag is specified, a value of zero is assumed for the
corner velocity.
If none of the ACSC_AMF_JUNCTIONVELOCITY and ACSC_AMF_
ANGLE flags are specified, the controller provides automatic
calculation as described in Automatic corner processing.
Return Value
None
Remarks
The function itself does not specify any segments, so the created motion starts only after the first
segment is specified.
4.22.2 SegmentLineExt
Description
The function adds a linear segment that starts at the current point and ends at the destination
point of segmented motion.
Syntax
object.SegmentLineExt(long Flags, VARIANT Axes, VARIANT Point, double Velocity, double
EndVelocity, double Time, BSTR Values, BSTR Variables, int Index, BSTR Masks, ULONGLONG CallType,
VARIANT* pWait);
Arguments
Bit-mapped argument that can include one or more of the flags defined
Flags
in the flags table below.
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last
Axes axis, one additional element must be located that contains –1 which
marks the end of the array.
For axis constants see Axis Definitions
Array of the final point coordinates. The number and order of values
Point must correspond to the Axes array. The Point must specify a value for
each element of Axes except the last –1 element.
Flags
ACSC_AMF_ The motion will use velocity specified for each segment instead of
VELOCITY the default velocity.
Return Value
None
Comments
The function adds a linear segment that starts at the current point and ends at the destination
point to segmented motion.
All axes specified in the Axes array must be specified before the call of the SegmentedMotion or
SegmentLineExt function. The number and order of the axes in the Axes array must correspond
exactly to the number and order of the axes of the SegmentedMotion or
ExtendedSegmentedMotionExt functions.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
ACSC_AMF_VELOCITY and ACSC_AMF_VARTIME are mutually exclusive, meaning they cannot be
used together.
The method can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can call
this function periodically until the function returns a non-zero value.
Example
);
// add line segment with final point (1000, -1000), vector velocity 25000
Point[0] = 1000; Point[1] = -1000;
Ch.SegmentLineExt(
Ch.ACSC_AMF_VELOCITY, // Velocity is specified
Axes, // Axes 0 and 1
Point, // Final point
25000, // Vector velocity
Ch.ACSC_NONE, // End velocity is not specified
Ch.ACSC_NONE, // Time is not specified
null, // Values array is not specified
null, // Variables array is not specified
Ch.ACSC_NONE, // Index is not specified
null // Masks array is not specified
);
// finish the motion
Ch.EndSequenceM(Axes);
4.22.3 ExtendedSegmentArc1
Description
The function adds to the motion path an arc segment that starts at the current point and ends at
the destination point with the specified center point.
Syntax
object. ExtendedSegmentArc1 (long Flags, VARIANT Axes, VARIANT Center, VARIANT FinalPoint, int
Rotation, double Velocity, double EndVelocity, double Time, BSTR Values, BSTR Variables, int Index,
BSTR Masks, ULONGLONG CallType, VARIANT* pWait);
Arguments
Bit-mapped argument that can include one or more of the flags defined
Flags
in the flags table below.
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last
Axes axis, one additional element must be located that contains –1 which
marks the end of the array.
For axis constants see Axis Definitions
Array of the center coordinates. The number and order of values must
Center correspond to the Axes array. The Center must specify a value for each
element of the Axes except the last –1 element.
Array of the final point coordinates. The number and order of values
FinalPoint must correspond to the Axes array. The FinalPoint must specify a value
for each element of Axes except the last –1 element.
Flags
ACSC_AMF_ The motion will use velocity specified for each segment instead of
VELOCITY the default velocity.
Return Value
None
Comments
All axes specified in the Axes array must be specified before the call of the SegmentedMotion or
ExtendedSegmentedMotion function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the SegmentedMotion or
ExtendedSegmentedMotionExt function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
ACSC_AMF_VELOCITY and ACSC_AMF_VARTIME are mutually exclusive, meaning they cannot be
used together.
Example
);
Ch.EndSequenceM(Axes);
4.22.4 ExtendedSegmentArc2
Description
The function adds an arc segment to a segmented motion and specifies the coordinates of the
center point and the rotation angle.
Syntax
object. ExtendedSegmentArc2 (long Flags, VARIANT Axes, VARIANT Center, double Angle, VARIANT
FinalPoints, double Velocity, double EndVelocity, double Time, BSTR Values, BSTR Variables, int
Index, BSTR Masks, ULONGLONG CallType, VARIANT* pWait);
Arguments
Bit-mapped argument that can include one or more of the flags defined
Flags
in the flags table below.
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last
Axes axis, one additional element must be located that contains –1 which
marks the end of the array.
For axis constants see Axis Definitions
Array of the center coordinates. The number and order of values must
Center correspond to the Axes array. The Center must specify a value for each
element of the Axes except the last –1 element.
Array indicating the final points of the secondary axes, array size must be
FinalPoints number of secondary axes (size of Axes – 2).
Set this argument to NULL if not used.
Flags
ACSC_AMF_ The motion will use velocity specified for each segment instead of
VELOCITY the default velocity.
Return Value
None
Comments
All axes specified in the ExtendedSegmentedMotion function. The number and order of the axes in
the Axes array must correspond exactly to the number and order of the axes of the
SegmentedMotion or ExtendedSegmentedMotionExt function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
4.22.5 BlendedSegmentMotion
Description
The function initiates a multi-axis blended segmented motion. Extended segmented motion
provides new features.
Syntax
object.BlendedSegmentMotion(long Flags, VARIANT Axes, VARIANT Point, double SegmentTime,
double AccelerationTime, double JerkTime, double DwellTime, ULONGLONG CallType, VARIANT
*pWait)
Arguments
JerkTime This parameter will set the default Jerk time in milliseconds.
Flags
ACSC_AMF_ Plan the motion but do not start it until the function acsc_GoM is
WAIT executed.
Return Value
None
Comments
Blended segmented motion is a type of segmented motion that doesn’t provide look-ahead
capabilities, unlike extended segmented motion. Both type of motions are intended for processing
a complex multi-axis trajectory and smoothing corners between segments, but do it in different
ways. The extended segmented motion (XSEG) maximizes throughput within the defined axis
limitations and the defined accuracy. The blended segmented motion (BSEG) allows traversal of the
trajectory with the defined timing constraints.
The function itself does not specify any movement, so the created motion starts only after the first
segment is specified.
The segments of motion are specified by using BlendedLine, BlendedArc1, BlendedArc2 functions
that follow this function. The motion finishes when the ENDSEQUENCEMfunction is executed. If the
call to ENDSEQUENCEM is omitted, the motion will stop at the last segment of the sequence and
wait for the next segment. No transition to the next motion in the motion queue will occur until the
function ENDSEQUENCEM is executed.
Example
4.22.6 BlendedLine
Description
The function adds a linear segment that starts at the current point and ends at the destination
point of segmented motion.
Syntax
Int acsc_BlendedLine (long Flags, VARIANT Axes, VARIANT Point, double SegmentTime, double
AccelerationTime, double JerkTime, double DwellTime, ULONGLONG CallType, VARIANT* pWait);
Arguments
Flags
ACSC_AMF_ This flag requires an additional parameter that defines the required
BSEGTIME segment time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that defines the required
BSEGACC segment acceleration time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that defines the required jerk
BSEGJERK time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that specifies the dwell time, in
DWELLTIME milliseconds, at the final point of the segment.
Return Value
None
Comments
The function adds a linear segment that starts at the current point and ends at the destination
point to segmented motion.
All axes specified in the Axes array must be specified in a previous call to the
BlendedSegmentMotion function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the call to the BlendedSegmentMotion
function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane. The function can wait for the controller response or can return immediately as specified by
the WAIT argument.
Example
4.22.7 BlendedArc1
Description
The function adds to the motion path an arc segment that starts at the current point and ends at
the destination point with the specified center point.
Syntax
object.BlendedArc1 (long Flags, VARIANT Axes, VARIANT Center, VARIANT FinalPoint, int Rotation,
double SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ULONGLONG
CallType, VARIANT* pWait);
Arguments
Flags
ACSC_AMF_ This flag requires an additional parameter that defines the required
BSEGTIME segment time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that defines the required
BSEGACC segment acceleration time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that defines the required jerk
BSEGJERK time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that specifies the dwell time, in
DWELLTIME milliseconds, at the final point of the segment.
Return Value
None
Comments
All axes specified in the Axes array must be specified in a previous call to the
BlendedSegmentMotion function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the call to the BlendedSegmentMotion
function.
The FinalPoint argument specifies the coordinates of the final point. The coordinates are absolute
in the plane. The function can wait for the controller response or can return immediately as
specified by the Wait argument.
Example
4.22.8 BlendedArc2
Description
The function adds an arc segment to a segmented motion and specifies the coordinates of the
center point and the rotation angle.
Syntax
object.BlendedArc2 (long Flags, VARIANT Axes, VARIANT Center, double Angle, double
SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ULONGLONG CallType,
VARIANT* pWait);
Arguments
Flags
ACSC_AMF_ This flag requires an additional parameter that defines the required
BSEGTIME segment time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that defines the required
BSEGACC segment acceleration time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that defines the required jerk
BSEGJERK time in milliseconds.
ACSC_AMF_ This flag requires an additional parameter that specifies the dwell time, in
DWELLTIME milliseconds, at the final point of the segment.
Return Value
None
Comments
All axes specified in the Axes array must be specified in a previous call to the
BlendedSegmentMotion function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the call to the BlendedSegmentMotion
function.
The Center argument specifies the coordinates of the Center point. The coordinates are absolute in
the plane.
The function can wait for the controller response or can return immediately as specified by the
Wait argument.
Example
4.22.9 Stopper
Description
The method provides a smooth transition between two segments of segmented motion.
Syntax
object.Stopper(variant Axes)
Arguments
Return Value
None.
Remarks
The controller builds the motion so that the vector velocity follows a smooth velocity diagram. The
segments define the projection of the vector velocity to axis velocities. If all segments are
connected smoothly, axis velocity is also smooth. However, if the user defined a path 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
Sub Stopper_Sample()
Dim Points(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Create segmented motion, coordinates of
'the initial point are(1000,1000)
Points(0) = 1000
Points(1) = 1000
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
Call Ch.Segment(0, Axes, Points)
'Add line segment with final point
'(1000, -1000), vector velocity 25000
Points(0) = 1000
Points(1) = -1000
Call Ch.ExtLine(Axes, Points, 25000)
Call Ch.Stopper(Axes)
'Add line segment with final point (-1000,
'-1000), vector velocity 25000
Points(0) = -1000
Points(1) = -1000
Call Ch.ExtLine(Axes, Points, 25000)
Call Ch.Stopper(Axes)
'Add line segment with final point (-1000,
'1000), vector velocity 25000
Points(0) = -1000
Points(1) = 1000
Call Ch.ExtLine(Axes, Points, 25000)
Call Ch.Stopper(Axes)
'Add line segment with final point (1000,
'1000), vector velocity 25000
Points(0) = 1000
Points(1) = 1000
Call Ch.ExtLine(Axes, Points, 25000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Call Ch.EnableM(Axes)
Call Ch.Segment(0, Axes, Points)
'Add line segment with final point (1000,
'-1000), vector velocity 25000
Points(0) = 1000
Points(1) = -1000
Call Ch.ExtLine(Axes, Points, 25000)
Call Ch.Stopper(Axes)
'Add line segment with final point (-1000,
'-1000), vector velocity 25000
Points(0) = -1000
Points(1) = -1000
Call Ch.ExtLine(Axes, Points, 25000)
Call Ch.Stopper(Axes)
'Add line segment with final point (-1000,
'1000), vector velocity 25000
Points(0) = -1000
Points(1) = 1000
Call Ch.ExtLine(Axes, Points, 25000)
Call Ch.Stopper(Axes)
'Add line segment with final point (1000,
'1000), vector velocity 25000
Points(0) = 1000
Points(1) = 1000
Call Ch.ExtLine(Axes, Points, 25000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.22.10 Projection
Description
The method sets a projection matrix for segmented motion.
Syntax
object.Projection(variant Axes, string Matrix)
Arguments
Return Value
None.
Remarks
The method sets a projection matrix for segmented motion.
The projection matrix connects the plane coordinates and the axis values in the axis group. The
projection can provide any transformation as rotation or scaling. The number of the matrix rows
must be equal to the number of the specified axes. The number of the matrix columns must equal
two.
The matrix must be declared before as a global variable by an ACSPL+ program or by the
DeclareVariable method and must be initialized by an ACSPL+ program or by the method.
For more information about projection, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub Projection_Sample()
Dim Axes(3)
Dim Point(2) As Double
Dim Center(2) As Double
Dim Matrix(0 To 2, 0 To 1) As Double
'Prepare the projection matrix
Matrix(0, 0) = 1
Matrix(0, 1) = 0
Matrix(1, 0) = 0
Matrix(1, 1) = 1.41421
Matrix(2, 0) = 0
Matrix(2, 1) = 1.41421
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = -1
Point(0) = 10000
Point(1) = 10000
On Error GoTo except
'Declare the matrix that will contain the
'projection
Call Ch.DeclareVariable(Ch.ACSC_REAL_TYPE, "ProjectionMatrix(3)(2)")
'Initialize the projection matrix
Call Ch.WriteVariable(Matrix, "ProjectionMatrix", Ch.ACSC_NONE)
Call Ch.EnableM(Axes)
'Create a group of the involved axes
Call Ch.Group(Axes)
'Create segmented motion, coordinates of
‘the initial point are(10000,10000)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
Call Ch.Segment(0, Axes, Point)
'Incline the working plane XY by 45°
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = Ch.ACSC_AXIS_2
Axes(3) = -1
Call Ch.Projection(Axes, "ProjectionMatrix")
'Describe circle with center (1000, 0),
'clockwise rotation
'Although the circle was defined, really
‘on the plane XY we will get the Ellipse
'stretched along the Y axis
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
Center(0) = 1000
Center(1) = 0
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(long Axis, double Point)
Arguments
Return Value
None.
Remarks
The method adds a point to a single-axis multi-point or spline motion. To add a point to a multi-axis
motion, use AddPVPointM. To add a point with a specified non-default velocity 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
Sub AddPoint_Sample()
Dim Str(1) As String
On Error GoTo except 'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 enabled during 5 secCall Ch.WaitMotor
(Ch.ACSC_AXIS_0, 1, 5000)
'Create multi-point motion with
'default velocity and dwell 1 ms
Call Ch.MultiPoint(0, Ch.ACSC_AXIS_0, 1)
For Index = 0 To 5 'Add points to axis 0
Call Ch.AddPoint(Ch.ACSC_AXIS_0, 100 * Index)
Next Index 'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.23.2 AddPointM
Description
The method adds a point to a multi-axis multi-point or spline motion.
Syntax
object.AddPointM(variant Axes, variant Point)
Arguments
Return Value
None.
Remarks
The method adds a point to a multi-axis multi-point or spline motion. To add a point to a single-axis
motion, use AddPoint. To add a point with a specified non-default velocity or time interval use
ExtAddPoint or ExtAddPointM.
The method waits for the controller response.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
method periodically until the method returns non-zero value.
All axes specified in the Axes array must be specified before the call of the MultiPointM or SplineM
method. The number and order of the axes in the Axes array must correspond exactly to the
number and order of the axes of MultiPointM or SplineM methods.
If the method fails, the Error object is filled with the error description.
Example
Sub AddPointM_Sample()
Dim Index As Long
Dim Points(1) As Double
Dim Axes(2) As String
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except 'Enable axes 0 and 1
Call Ch.EnableM(Axes) 'Create multi-point motion with
'default velocity without dwell in
'the points
Call Ch.MultiPointM(0, Axes, 0)
'Add some points to axes 0 and 1
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 100 * Index
Call Ch.AddPointM(Axes, Points)
Next Index 'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis, double Point, double Rate)
Arguments
Return Value
None.
Remarks
The method adds a point to a single-axis multi-point motion with specific velocity or to single-axis
spline motion with a non-uniform time.
To add a point to a multi-axis motion, use ExtAddPointM. To add a point to a motion with default
velocity or uniform time interval, the AddPoint and AddPointM methods 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
Sub ExtAddPoint_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Create multi-point motion uses the
'velocity specified with each point with
'dwell 1 ms
Call Ch.MultiPoint(Ch.ACSC_AMF_VELOCITY, Ch.ACSC_AXIS_0, 1)
'Add some points
For Index = 0 To 5
'Adds points to axis 0, defines a motion
'velocity of 5000
Call Ch.ExtAddPoint(Ch.ACSC_AXIS_0, 100 * Index, 5000)
Next Index
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(variant Axes, variant Point, double Rate)
Arguments
Return Value
None.
Remarks
The method adds a point to a multi-axis multi-point or spline motion. To add a point to a single-axis
motion, useExtAddPoint. 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
Sub ExtAddPointM_Sample()
Dim Index As Long
Dim Points(1)
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Create multi-point motion uses the
'velocity specified with each point without
'dwell in the points
Call Ch.MultiPointM(Ch.ACSC_AMF_VELOCITY, Axes, 0)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 100 * Index
'Adds points to axes 0 and 1, defines a
'motion velocity of 5000
Call Ch.ExtAddPointM(Axes, Points, 5000)
Next Index
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis)
Arguments
Return Value
None.
Remarks
The motion finishes when the EndSequence method is executed. If the call of EndSequence is
omitted, the motion will stop at the last point of the sequence and wait for the next point. No
transition to the next motion in the motion queue will occur until the EndSequence method
executes.
The method waits for the controller response.
This method applies to the single-axis multi-point or spline (arbitrary path) motions.
If the method fails, the Error object is filled with the error description.
Example
Sub EndSequence_Sample()
Dim Index As Long
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
'Create multi-point motion with default
'velocity and dwell 1 ms
Call Ch.MultiPoint(0, Ch.ACSC_AXIS_0, 1)
'Add some points
For Index = 0 To 5
Call Ch.AddPoint(Ch.ACSC_AXIS_0, 100 * Index)
Next Index
'Finish the motion
'End of the multi-point motion of axis 0
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
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(variant Axes)
Arguments
Return Value
None.
Remarks
The motion finishes when the EndSequenceM method is executed. If the call of EndSequenceM is
omitted, the motion will stop at the last point or segment of the sequence and wait for the next
point. No transition to the next motion in the motion queue will occur until the EndSequenceM
method executes.
The method waits for the controller response.
This method applies to the multi-axis multi-point, spline (arbitrary path) and segmented motions.
If the method fails, the Error object is filled with the error description.
Example
Sub EndSequenceM_Sample()
Dim Index As Long
Dim Points(1)
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Enable axes 0 and 1
Call Ch.EnableM(Axes)
'Create multi-point motion with default
'velocity without dwell in the points
Call Ch.MultiPointM(0, Axes, 0)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 100 * Index
Call Ch.AddPointM(Axes, Points)
Next Index
'Finish the motion
'End of the multi-point motion of axes 0
'and 1
Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.24.1 DataCollectionExt
Description
The function initiates data collection.
Syntax
object.DataCollectionExt (long Flags, [long Axis,] string Array, long Nsample, double Period, string
vars, ULONGLONG CallType, VARIANT *pWait)
Arguments
Bit-mapped argument that can include one or more of the flags defined in
Flags
the flags table below.
Name of the array that stores the collected samples. The array must be
Array declared as a global variable by an ACSPL+ program or by the
DECLAREVARIABLE method.
Flags
ACSC_DCF_
Start data collection synchronously with motion.
SYNC
ACSC_DCF_ Create the synchronous data collection, but do not start until the Go
WAIT method is called. This flag can only be used with the ACSC_DCF_SYNC flag.
Cyclic data collection uses the collection array as a cyclic buffer and
ACSC_DCF_
continues infinitely. When the array is full, each new sample overwrites
CYCLIC
the oldest sample in the array.
Return Value
None
Comments
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
try
{
channel. DataCollectionExt (Flags, Axis, "MyArrayForDC", 100, 100, "FPOS
(0)\rFVEL(0)\rFACC(0)");
}
catch (Exception ex)
{
ShowException(ex);
}
4.24.2 StopCollect
Description
The method terminates data collection.
Syntax
object.StopCollect()
Arguments
None.
Return Value
None.
Remarks
The usual system data collection finishes when the required number of samples is collected or the
StopCollect method is executed. The application can wait for data collection end with the 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
Sub StopCollect_Sample()
'Matrix consisting of two rows with 1000
'columns each
Dim ArrayName As String
ArrayName = "DCA(2)(1000)"
'Positions of axes 0 and 1 will be
'collected
Dim Vars As String
Vars = "FPOS(0)” & Chr$(13)& FPOS(1)"
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait till axis 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
Call Ch.ExtToPoint(Ch.ACSC_AMF_VELOCITY Or Ch.ACSC_AMF_ENDVELOCITY,
Ch.ACSC_AXIS_0, 10000, 5000, 1000)
'Array to collect
Call Ch.DeclareVariable(Ch.ACSC_REAL_TYPE, ArrayName)
Call Ch.CollectB(0, ArrayName, 1000, 1, Vars)
'Stop to collect
Call Ch.StopCollect
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
GetIndexState Retrieves the current state of the index and mark variables.
4.25.1 GetMotorState
Description
The method retrieves the current motor state.
Syntax
object.GetMotorState(long Axis)
Arguments
Return Value
Long.
The method retrieves 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
Sub GetMotorState_Sample()
Dim State As Long
On Error GoTo except
'Retrieves the current motor state of 0
State = Ch.GetMotorState(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.25.2 GetAxisState
Description
The method retrieves the current axis state.
Syntax
object.GetAxisState(long Axis)
Arguments
Return Value
Long.
The method retrieves the current axis 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, Axis State Flags.
If the method fails, the Error object is filled with the error description.
Example
Sub GetAxisState_Sample()
Dim State As Long
On Error GoTo except
'Retrieves the current axis state
State = Ch.GetAxisState(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.25.3 GetIndexState
Description
The method retrieves the current set of bits that indicate the index and mark state.
Syntax
object.GetIndexState(long Axis)
Arguments
Return Value
Long.
The method retrieves the current set of bits that indicate the index and mark 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
Sub GetIndexState_Sample()
'Retrieves the current set of bits that
'indicate the index and mark state
Dim IState As Long
On Error GoTo except
IState = Ch.GetIndexState(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.25.4 ResetIndexState
Description
The method resets the specified bit of the index/mark state.
Syntax
object.ResetIndexState(long Axis, long Mask)
Arguments
Return Value
None.
Remarks
The method resets the specified bit of the index/mark state. Mask contains a bit that must be
cleared, i.e., the method resets only that bit of the index/mark state, which corresponds to non-
zero bit of Mask. To get the current index/mark state, use the GetIndexState method.
If the method fails, the Error object is filled with the error description.
Example
Sub ResetIndexState_Sample()
Dim IState As Long
On Error GoTo except
'Resets the specified bit of the
'index/mark state
Call Ch.ResetIndexState(Ch.ACSC_AXIS_0, Ch.ACSC_IST_IND)
Call Ch.ResetIndexState(Ch.ACSC_AXIS_0, Ch.ACSC_IST_IND2)
Call Ch.ResetIndexState(Ch.ACSC_AXIS_0, Ch.ACSC_IST_MARK)
Call Ch.ResetIndexState(Ch.ACSC_AXIS_0, Ch.ACSC_IST_MARK2)
IState = Ch.GetIndexState(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.25.5 GetProgramState
Description
The method retrieves the current state of the program buffer.
Syntax
object.GetProgramState(long Buffer)
Arguments
Return Value
Long.
The method retrieves the current state of the program buffer.
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
Sub GetProgramState_Sample()
Dim PState As Long
On Error GoTo except
'Appends 1 line to buffer 0
Call Ch.AppendBuffer(0, "!Empty buffer;stop")
'Run buffer 0
Call Ch.RunBuffer(0)
'Retrieves the current state of the
'program buffer
PState = Ch.GetProgramState(0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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.
GetExtInputPort Retrieves the current state of the specified extended input port.
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
object.GetInput(long Port, long Bit)
Arguments
Return Value
Long.
The method retrieves the current state of the specified digital input.
Remarks
To get values of all inputs of the specific port, use the GetInputPort method.
Digital inputs are represented in the controller variable IN. For more information about digital
inputs, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetInput_Sample()
'The method reads input 0 of port 0 ( IN(0).0 )
Dim Port As Long
On Error GoTo except
Port = Ch.GetInput(0, 0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.2 GetInputPort
Description
The method retrieves the current state of the specified digital input port.
Syntax
object.GetInputPort(long Port)
Arguments
Return Value
Long.
The method retrieves 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 ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetInputPort_Sample()
'The method reads input port 0 to 15( IN(0) to IN(15) )
Dim Index As Long
Dim Port(15) As Long
On Error GoTo except
For Index = 0 To 15
Port(Index) = Ch.GetInputPort(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.3 GetOutput
Description
The method retrieves the current state of the specified digital output.
Syntax
object.GetOutput(long Port, long Bit)
Arguments
Return Value
Long.
The method retrieves the current state (0 or 1) 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 ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetOutput_Sample()
'The method reads output 0 of port 0 ( OUT(0).0 )
Dim Port As Long
On Error GoTo except
Port = Ch.GetOutput(0, 0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.4 GetOutputPort
Description
The method retrieves the current state of the specified digital output port.
Syntax
object.GetOutputPort(long Port)
Arguments
Return Value
Long.
The method retrieves the current state (0 or 1)of the specified digital output port.
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 ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetOutputPort_Sample()
'The method reads output port 0 to 15
'( OUT(0)to OUT(15) )
Dim Index As Long
Dim Port(15) As Double
4.26.5 SetOutput
Description
The method sets the specified digital output to the specified value.
Syntax
object.SetOutput(long Port, long Bit, long Value)
Arguments
Return Value
None.
Remarks
The method sets the specified digital output to the specified value. To set values of all outputs of a
specific port, use the SetOutputPort method.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetOutput_Sample()
'The method sets output 0 of port 0 to 1
'( ACSPL+ equivalent: OUT(0).0 = 1 )
On Error GoTo except
Call Ch.SetOutput(0, 0, 1)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.6 SetOutputPort
Description
The method sets the specified digital output port to the specified value.
Syntax
object.SetOutputPort(long Port, long Value)
Arguments
Return Value
None.
Remarks
The method sets the specified digital output port to the specified value. To set the value of the
specific output of the specific port, use the SetOutput method.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetOutputPort_Sample()
'The method sets outputs 0 to 15 to 100
Dim Index As Long
On Error GoTo except
For Index = 0 To 15
Call Ch.SetOutputPort(Index, 100)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.7 GetAnalogInputNT
Description
The function retrieves the current value of the specified analog input.
Syntax
object.GetAnalogInputNT(int Port, double* Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None
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 ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
object waitObject = 0;
Double Value = new Double();
try
{
Ch.GetAnalogInputNT(0, out Value,Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.26.8 GetAnalogOutputNT
Description
The function retrieves the current value of the specified analog output.
Syntax
object.GetAnalogOutputNT(int Port, double* Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
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 ACSPL+ Programmer’s Guide.
Example
object waitObject = 0;
Double Value = new Double();
try
{
Ch.GetAnalogOutputNT(0, out Value,Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.26.9 SetAnalogOutputNT
Description
The function writes the specified value to the specified analog output.
Syntax
object.SetAnalogOutputNT(int Port, double Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Remarks
The function writes the specified value to the specified analog outputs. To get a value of the
specific analog output, use the GetAnalogOutputNT method.
Analog outputs are represented in the controller variable AOUT. For more information about
analog outputs, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetAnalogOutput_Sample()
'The method writes the value 100 to the analog outputs of port 0 to 15
Dim Index As Long
On Error GoTo except
For Index = 0 To 15
Call Ch.SetAnalogOutput(Index, 100)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.10 GetExtInput
Description
The method retrieves the current state of the specified extended input.
Syntax
object.GetExtInput(long Port, long Bit)
Arguments
Return Value
Long.
The method retrieves the current state (0 or 1) of the extended input specified by Port and Bit.
Remarks
To get that states for all the inputs of the specific extended Port, use the GetExtInputPort method.
Extended inputs are represented in the controller variable EXTIN. For more information about
extended inputs, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetExtInput_Sample()
'The method reads extended input 0 of port 0
'( EXTIN(0).0 )
Dim Port As Long
On Error GoTo except
Port = Ch.GetExtInput(0, 0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.11 GetExtInputPort
Description
The method retrieves the current state of the specified extended input port.
Syntax
object.GetExtInputPort(long Port)
Arguments
Return Value
Long.
The method retrieves 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 ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetExtInputPort_Sample()
'The method reads extended input port 0 to 15
'( EXTIN(0) to EXTIN(15) )
Dim Index As Long
Dim Port(15) As Long
On Error GoTo except
For Index = 0 To 15
Port(Index) = Ch.GetExtInputPort(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.12 GetExtOutput
Description
The method retrieves the current state of the specified extended output.
Syntax
object.GetExtOutput(long Port, long Bit)
Arguments
Return Value
Long.
The method retrieves the current state (0 or 1) of the specified extended output.
Remarks
To get values of all outputs of the specific extended port, use the GetExtOutputPort method.
Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetExtOutput_Sample()
'The method reads extended output 0 of port 0 ( EXTOUT(0).0 )
Dim Port As Long
On Error GoTo except
Port = Ch.GetExtOutput(0, 0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.13 GetExtOutputPort
Description
The method retrieves the current state of the specified extended output port.
Syntax
object.GetExtOutputPort(long Port)
Arguments
Return Value
Long.
The method retrieves the current state (0 or 1) of the specified extended output port.
Remarks
To get the value of the specific output of the specific extended port, use the GetExtOutput
method.
Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetExtOutputPort_Sample()
'The method reads extended output port 0 ( EXTOUT(0) )
Dim Index As Long
4.26.14 SetExtOutput
Description
The method sets the specified extended output to the specified value.
Syntax
object.SetExtOutput(long Port, long Bit, long Value)
Arguments
Return Value
None.
Remarks
The method sets the specified extended output to the specified value. To set values of all outputs
of the specific extended port, use the SetExtOutputPort method.
Extended outputs are represented in the controller EXTOUT variable. For more information about
extended outputs, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetExtOutput_Sample()
'The method sets output 0 of extended
'port 0 to 1
'(ACSPL+ equivalent: EXTOUT(0).0 = 1)
On Error GoTo except
Call Ch.SetExtOutput(0, 0, 1)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.26.15 SetExtOutputPort
Description
The method sets the specified extended output port to the specified value.
Syntax
object.SetExtOutputPort(long Port, long Value)
Arguments
Return Value
None.
Remarks
The method sets the specified extended output port to the specified value. To set the value of the
specific output of the specific extended port, use the SetExtOutput method.
Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetExtOutputPort_Sample()
'The method sets outputs of extended
'port 0 to 15 to 100
Dim Index As Double
On Error GoTo except
For Index = 0 To 15
Call Ch.SetExtOutputPort(Index, 100)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Sets the mask that defines for which axis or system faults the
SetResponseMask
controller provides default response.
Retrieves the mask that defines for which axis or system faults
GetResponseMask
the controller provides default response.
GetSafetyInputPort Retrieves the current state of the specified safety input port.
Retrieves the set of bits that define inversion for the specified
GetSafetyInputPortInv
safety input port.
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
object.GetFault(long Axis)
Arguments
Return Value
Long.
The method retrieves the set of bits that indicate motor or system faults.
Remarks
The motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, or Driver Alarm.
The system faults are not related to any specific motor. For example: Emergency Stop or Memory
Fault.
The parameter Fault receives the set of bits that indicates the controller faults. To recognize the
specific fault, properties ACSC_SAFETY_*** can be used. See Safety Control Masks for a detailed
description of these properties.
For more information about the controller faults, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetFault_Sample()
Dim Fault As Long
On Error GoTo except
'Retrieves the set of bits that indicate the
'motor or system faults
Fault = Ch.GetFault(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis, long Mask)
Arguments
Return Value
None.
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 ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetFaultMask_Sample()
On Error GoTo except
'Enable all faults of axis 0
Call Ch.SetFaultMask(Ch.ACSC_AXIS_0, ACSC_NONE)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.3 GetFaultMask
Description
The method retrieves the mask that defines which controller faults are examined and processed.
Syntax
object.GetFaultMask(long Axis)
Arguments
Return Value
Long.
The method retrieves the mask that defines which controller faults are examined and processed.
Remarks
If a bit of the mask is zero, the corresponding fault is disabled.
Use the ACSC_SAFETY_*** properties to examine a specific bit. See Safety Control Masks for a
detailed description of these properties.
Controller faults are of two types: motor faults and system faults.
The motor faults are related to a specific motor, the power amplifier or the Servo processor. For
example: Position Error, Encoder Error or Driver Alarm.
The system faults are not related to any specific motor, for example: Emergency Stop or Memory
Fault.
For more information about the controller faults, see the ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetFaultMask_Sample()
Dim Mask As Long
On Error GoTo except
'Retrieves the mask that defines which
'controller Faults are examined
'and processed of axis 0
Mask = Ch.GetFaultMask(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.4 EnableFault
Description
The method enables the specified axis or system fault.
Syntax
object.EnableFault(long Axis, long Fault)
Arguments
Return Value
None.
Remarks
The method enables the examination and processing of the specified motor or system fault by
setting the specified bit of the fault mask to one.
The motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, and Driver Alarm.
The system faults are not related to any specific motor. For example: Emergency Stop, Memory
Fault.
For more information about the controller faults, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub EnableFault_Sample()
On Error GoTo except
'Enable fault Right Limit of axis 0
Call Ch.EnableFault(Ch.ACSC_AXIS_0, Ch.ACSC_SAFETY_RL)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.5 DisableFault
Description
The method disables the specified axis or system fault.
Syntax
object.DisableFault(long Axis, long Fault)
Arguments
Return Value
None.
Remarks
The method disables the examination and processing of the specified motor or system fault by
setting the specified bit of the fault mask to zero.
The motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, and Driver Alarm.
The system faults are not related to any specific motor, for example: Emergency Stop, Memory
Fault.
For more information about the controller faults, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub DisableFault_Sample()
On Error GoTo except
'Disable fault Software Right Limit in axis 0
Call Ch.DisableFault(Ch.ACSC_AXIS_0, Ch.ACSC_SAFETY_RL)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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(long Axis, long Mask)
Arguments
Return Value
None.
Remarks
The method retrieves the mask that defines the motor or the system faults for which the
controller provides the default response.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see the ACSPL+ Programmer’s
Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetResponseMask_Sample()
On Error GoTo except
'Enable all default responses
Call Ch.SetResponseMask(Ch.ACSC_AXIS_0, ACSC_NONE)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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
object.GetResponseMask(long Axis)
Arguments
Return Value
Long.
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.
If a bit of the parameter Mask is zero, it deactivates the default controller response for the
corresponding fault.
For more information about the controller faults and default, responses see the ACSPL+
Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetResponseMask_Sample()
Dim Mask As Long
On Error GoTo except
'Retrieves the mask of axis 0
Mask = Ch.GetResponseMask(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.8 EnableResponse
Description
The method enables the response to the specified axis or system fault.
Syntax
object.EnableResponse(long Axis, long Response)
Arguments
Return Value
None.
Remarks
The method enables the default response to the specified axis or system fault by setting the
specified bit of the response mask to one.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub EnableResponse_Sample()
On Error GoTo except
'Enable the default response to the
'Position Error fault of axis 0
Call Ch.EnableResponse(Ch.ACSC_AXIS_0, Ch.ACSC_SAFETY_PE)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.9 DisableResponse
Description
The method disables the default response to the specified axis or system fault.
Syntax
object.DisableResponse(long Axis, long Response)
Arguments
Return Value
None.
Remarks
The method disables the default response to the specified motor or system fault by setting the
specified bit of the response mask to zero.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub DisableResponse_Sample()
On Error GoTo except
'Disable the default response to the
'Right Limit fault
Call Ch.DisableResponse(Ch.ACSC_AXIS_0, Ch.ACSC_SAFETY_RL)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.10 GetSafetyInput
Description
The method retrieves the current state of the specified safety input.
Syntax
object.GetSafetyInput(long Axis, long Input)
Arguments
Return Value
Long.
The method retrieves the current state of the specified safety input.
Remarks
To get values of all safety inputs of the specific axis, use GetSafetyInputPort.
Safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more information
about safety inputs, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetSafetyInput_Sample()
'The method reads Emergency Stop system
'safety input
Dim SInput As Long
On Error GoTo except
'Reads right Limit Safety input of axis 0
SInput = Ch.GetSafetyInput(Ch.ACSC_AXIS_0, Ch.ACSC_SAFETY_RL)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.11 GetSafetyInputPort
Description
The method retrieves the current state of the specified safety input port.
Syntax
object.GetSafetyInputPort(long Axis)
Arguments
Return Value
Long.
The method retrieves the current state of the specified safety input port.
To recognize a specific motor safety input, only one of the following properties can be used:
> ACSC_SAFETY_RL
> ACSC_SAFETY_LL
> ACSC_SAFETY_NETWORK
> ACSC_SAFETY_HOT
> ACSC_SAFETY_DRIVE
To recognize a specific system safety input, only the ACSC_SAFETY_ES property can be used.
See Safety Control Masks, Safety Control Masks for a detailed description of these properties.
Remarks
To get the state of the specific safety input of a specific axis, use GetSafetyInput.
Safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more information
about safety inputs, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetSafetyInputPort_Sample()
Dim SInput As Long
On Error GoTo except
'The method reads safety input port of the
'axis 0
SInput = Ch.GetSafetyInputPort(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.12 GetSafetyInputPortInv
Description
The method retrieves the set of bits that define inversion for the specified safety input port.
Syntax
object.GetSafetyInputPortInv(long Axis)
Arguments
Return Value
Long.
The method retrieves the set of bits that define inversion for the specified safety input port.
To recognize a specific bit, use the following properties:
> ACSC_SAFETY_RL
> ACSC_SAFETY_LL
> ACSC_SAFETY_NETWORK
> ACSC_SAFETY_HOT
> ACSC_SAFETY_DRIVE
Use the ACSC_SAFETY_ES property to recognize an inversion for the specific system safety input
port,.
See Safety Control Masks for a detailed description of these properties.
Remarks
To set the specific inversion for the specific safety input port, use GetSafetyInputPortInv.
If a bit of the retrieved set is zero, the corresponding signal is not inverted and therefore high
voltage is considered an active state. If a bit is raised, the signal is inverted and low voltage is
considered an active state.
Inversions of safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more
information about safety inputs, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub GetSafetyInputPortInv_Sample()
'The method reads an inversion of safety
'input port of the axis 0
Dim State As Long
On Error GoTo except
State = Ch.GetSafetyInputPortInv(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.13 SetSafetyInputPortInv
Description
The method sets the set of bits that define inversion for the specified safety input port.
Syntax
object.SetSafetyInputPortInv(long Axis, long Value)
Arguments
Return Value
Long.
The method retrieves the current state of the specified safety input.
Remarks
The method sets the bits that define inversion for the specified safety input port. To retrieve an
inversion for the specific safety input port, use the GetSafetyInputPortInv method.
If a bit of the set is zero, the corresponding signal will not be inverted and therefore high voltage is
considered an active state. If a bit is raised, the signal will be inverted and low voltage is considered
an active state.
The inversions of safety inputs are represented in the controller variables SAFIN and S_SAFIN. For
more information about safety inputs, see ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.
Example
Sub SetSafetyInputPortInv_Sample()
'The method sets the inversion for safety
'input port of the axis 0 to 100
On Error GoTo except
Call Ch.SetSafetyInputPortInv(Ch.ACSC_AXIS_0, 100)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.14 FaultClear
Description
The method clears the current faults and the result of the previous fault stored in the MERR
variable.
Syntax
object.FaultClear(long Axis)
Arguments
Return Value
None.
Remarks
The method clears the current faults of the specified axis and the result of the previous fault
stored in the MERR variable.
If the method fails, the Error object is filled with the error description.
Example
Sub FaultClear_Sample()
Dim result As Long
On Error GoTo except
'Clears the current faults and results of
'previous faults stored in the MERR
'variable of axis 0
Call Ch.FaultClear(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.27.15 FaultClearM
Description
The method clears the current faults and results of previous faults stored in the MERR variable for
multiple axis.
Syntax
object.FaultClearM(variant Axes)
Arguments
Return Value
None.
Remarks
If the reason for the fault is still active, the controller will set the fault immediately after this
command is performed. If cleared fault is Encoder Error, the feedback position is reset to zero.
If the method fails, the Error object is filled with the error description.
Example
Sub FaultClearM_Sample()
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_0
Axes(1) = Ch.ACSC_AXIS_1
Axes(2) = -1
On Error GoTo except
'Clears the current faults and results of
'previous faults stored in the MERR
'variable of axes 0 and 1
Call Ch.FaultClearM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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 (long Axis, long 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
Sub WaitMotionEnd_Sample()
On Error GoTo except
'Wait for the end of motion of axis 0
'during 10 sec
Call Ch.WaitMotionEnd(Ch.ACSC_AXIS_0, 10000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.28.2 WaitLogicalMotionEnd
Description
The method waits for the logical end of a motion.
Syntax
object.WaitLogicalMotionEnd (long Axis, long 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
Sub WaitLogicalMotionEnd_Sample()
On Error GoTo except
'Wait for the logical end of motion of axis
'0 during 10 sec
Call Ch.WaitLogicalMotionEnd(Ch.ACSC_AXIS_0, 10000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.28.3 WaitCollectEndExt
Description
The function waits for the end of data collection.
Syntax
object.WaitCollectEndExt (long Timeout, long Axis)
Arguments
If using axis data collection – the axis number, otherwise ACSC_NONE. ACSC_
Axis
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1 etc.
Return Value
None
Comments
If using Axis data collection (data collection is synced to axis) set Axis to be the axis number you are
collecting data from, otherwise set Axis to be ACSC_NONE.
The function does not return while data collection is in progress and the correct parameters have
been passed.
Verifies AST<Axis#>.#DC flag for Synced data collection, otherwise verifies S_ST.#DC system flag.
Using the function with the wrong parameters (i.e. calling the function with an axis number while
performing a system data collection) will result in undefined behavior.
Example
Ch.WaitCollectEndExt(2000, // timeout
Ch.ACSC_AXIS_2 // Axis number
);
4.28.4 WaitProgramEnd
Description
The method waits for the program termination in the specified buffer.
Syntax
object.WaitProgramEnd (long Buffer, long 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
Sub WaitProgramEnd_Sample()
Dim Index As Long
On Error GoTo except
For Index = 0 To 8
'Append a line to all buffers
Call Ch.AppendBuffer(Index, "WAIT 5000;STOP")
'Run all buffers
Call Ch.RunBuffer(Index)
'Wait program ends during 10 sec
Call Ch.WaitProgramEnd(Index, 10000)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.28.5 WaitMotorCommutated
Description
The method waits for the specified state of the specified motor.
Syntax
object.WaitMotorCommutated (long Axis, long State, long Timeout)
Arguments
Axis constant: ACSC_AXIS_0 corresponds to the axis 0, ACSC_AXIS_1
Axis
to the axis 1, etc. For the axis constants see Axis Definitions.
State 1 - The method waits for the motor to be commutated.
Maximum waiting time in milliseconds.
Timeout If Timeout is INFINITE, the method's time-out interval never
elapses.
Return Value
None.
Remarks
The method does not 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
Sub WaitMotorCommutated_Sample()
On Error GoTo except
'Commut axis 0
Call Ch.Commut(Ch.ACSC_AXIS_0)
'Wait motor 0 commutated during 5 sec
Call Ch.WaitMotorCommutated(Ch.ACSC_AXIS_0, 1, 5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.28.6 WaitMotorEnabled
Description
The method waits until the specified motor is commutated.
Syntax
object.WaitMotorEnabled (long Axis, long State, long 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
Sub WaitMotorEnabled_Sample()
On Error GoTo except
'Enable axis 0
Call Ch.Enable(Ch.ACSC_AXIS_0)
'Wait motor 0 enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_0, 1, 5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.28.7 WaitInput
Description
The method waits for the specified state of digital input.
Syntax
object.WaitInput (long Port, long Bit, long State, long 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
Sub WaitInput_Sample()
On Error GoTo except
'Wait for IN0.0 = 1 during 5 sec
'Parameters: 0 - IN0
' 0 - IN0.0
' 1 - wait for IN0.0 = 1
' 5000 - during 5 sec
Call Ch.WaitInput(0, 0, 1, 5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
EnableEvent Enables ActiveX event generation for the specified interrupt condition.
DisableEvent Disables ActiveX event generation for the specified interrupt condition.
4.29.1 EnableEvent
Description
The method enables ActiveX event generation for the specified interrupt condition.
Syntax
object. EnableEvent (long Interrupt)
Arguments
Return Value
None.
Remarks
The library generates an event when the specified Interrupt occurs.
SPiiPlus COM Library has events for all types of interrupts:
PEG ([in] long Param), MARK1 ([in] long Param) etc. For full list of SPiiPlus COM Library events see
Events, 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 Interrupt argument equal to the
specified interrupt type.
Before the PEG interrupts can be detected, the AssignPins method must be called.
If the method fails, the Error object is filled with the error description.
Example
'Sub EnableEvent_Sample()
Private Sub ChWithEvents_ACSPLPROGRAM(ByVal Param As Long)
MsgBox "Parameter=" & Param, vbExclamation, "ACSPLPROGRAM"
End Sub
Private Sub ChWithEvents_PROGRAMEND(ByVal Param As Long)
MsgBox "Parameter=" & Param, vbExclamation, "PROGRAMEND"
End Sub
Sub EnableEvent_Sample()
On Error GoTo except
'Enable event ACSC_INTR_ACSPL_PROGRAM
Call ChWithEvents.EnableEvent(ChWithEvents.ACSC_INTR_ACSPL_PROGRAM)
'Enable event ACSC_INTR_PROGRAM_END
Call ChWithEvents.EnableEvent(ChWithEvents.ACSC_INTR_PROGRAM_END)
'Delete all lines in buffer 5
Call ChWithEvents.Transaction("#5D1,100000")
'Appends a line to buffer 5
Call ChWithEvents.AppendBuffer(5, "interrupt stop")
'Execute buffer 5
ChWithEvents.Transaction ("#5X")
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.29.2 DisableEvent
Description
The method disables ActiveX event generation for the specified interrupt condition.
Syntax
object. DisableEvent (long Interrupt)
Arguments
Return Value
None.
Remarks
The method disables ActiveX event generation, that was enabled with method EnableEvent
If the method fails, the Error object is filled with the error description.
Example
Sub DisableEvent_Sample()
On Error GoTo except
'Disable event PROGRAM_END
Ch. DisableEvent (Ch.ACSC_INTR_PROGRAM_END)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.29.3 SetEventMask
Description
The method sets the mask for specified interrupt.
Syntax
object.SetEventMask(long Interrupt, long Mask)
Arguments
Return Value
None.
Remarks
The method sets the bit mask for specified interrupt. To get current mask for specified interrupt,
call GetEventMask.
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
Sub SetEventMask_Sample()
On Error GoTo except
'Sets the mask for specified interrupt only
'for axis 0
Call Ch.SetEventMask(Ch.ACSC_INTR_PROGRAM_END, Ch.ACSC_MASK_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.29.4 GetEventMask
Description
The method retrieves the mask for specified interrupt.
Syntax
object.GetEventMask(long Interrupt)
Arguments
Return Value
Long.
The method retrieves the bit mask for the specified interrupt.
Remarks
To set the mask for a specified interrupt, call SetEventMask.
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,
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
Sub GetEventMask_Sample()
'The example shows how to get the mask for specific interrupt
Dim Mask As Long
On Error GoTo except
'An ACSPL+ program has finished
Mask = Ch.GetEventMask(Ch.ACSC_INTR_PROGRAM_END)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.30.1 DeclareVariable
Description
The method creates a persistent global variable.
Syntax
object.DeclareVariable (long Type, string Name)
Arguments
Return Value
None.
Remarks
The method creates the persistent global variable specified by Name of type specified by Type. The
variable can be used as any other ACSPL+ or global variable.
If it is necessary to declare one or two-dimensional array, Name should also contains the
dimensional size in brackets.
The lifetime of a persistent global variable is not connected with any program buffer. The
persistent variable survives any change in the program buffers and can be erased only by the
ClearVariables method.
The method waits for the controller response.
If the method fails, the Error object is filled with the error description.
Example
Sub DeclareVariable_Sample()
On Error GoTo except
'The method creates the persistent global
'variable "MyVar" as integer type.
Call Ch.DeclareVariable(Ch.ACSC_INT_TYPE, "MyVar")
Exit Sub
Sexcept:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
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 theDeclareVariable method.
The method waits for the controller response.
If the method fails, the Error object is filled with the error description.
Example
Sub ClearVariables_Sample()
On Error GoTo except
'The method declare global variable "MyVar"
'as integer type.
Call Ch.DeclareVariable(Ch.ACSC_INT_TYPE, "MyVar")
'The method deletes all persistent global
'variables.
Call Ch.ClearVariables
Exit Sub
except:
4.31.1 GetFirmwareVersion
Description
The method retrieves the firmware version of the controller.
Syntax
object.GetFirmwareVersion()
Arguments
None.
Return Value
String.
The method retrieves the controller firmware version.
Remarks
If the method fails, the Error object is filled with the error description.
Example
Sub GetFirmwareVersion_Sample()
Dim Firm As String
On Error GoTo except
'Retrieves the firmware version of the
'controller
Firm = Ch.GetFirmwareVersion()
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.31.2 GetSerialNumber
Description
The method retrieves the controller serial number.
Syntax
object.GetSerialNumber()
Arguments
None.
Return Value
String.
The method retrieves the character string that contains the controller serial number.
Remarks
If the method fails, the Error object is filled with the error description.
Example
Sub GetSerialNumber_Sample()
'Retrieves the character string that
'contains the controller serial number
Dim SerN As String
On Error GoTo except
SerN = Ch.GetSerialNumber
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.31.3 GetSysInfo
Description
The method returns certain system information based on the argument that is specified (see Table
4-35).
Syntax
object.GetSysInfo(int Key, double *Value, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
EtherCAT support:
ACSC_SYS_ECAT_KEY 16 1 - Yes
0 - No
4.31.4 GetBuffersCount
Description
The method returns the number of available ACSPL+ programming buffers.
Syntax
object.GetBuffersCount(double* Value, ULONGLONG CallType,VARIANT *pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
4.31.5 GetAxesCount
Description
The method returns the number of available axes.
Syntax
object.GetAxesCount(double* Value, ULONGLONG CallType,VARIANT *pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
ErorMsg(Ex);
}
4.31.6 GetDBufferIndex
Description
The method returns the index of the D-Buffer.
Syntax
object.GetDBufferIndex(double* Value, ULONGLONG CallType,VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
4.31.7 GetUMDVersion
Description
The method retrieves the SPiiPlus User Mode Driver version number.
Syntax
object.GetUMDVersion()
Arguments
None.
Return Value
Long.
The method retrieves the SPiiPlus User Mode Driver version number.
Remarks
The User Mode Drivewr 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 version.
If the method fails, the Error object is filled with the error description.
Example
Sub GetLibraryVersion_Sample()
Dim LVersion As Double
On Error GoTo except
'Retrieves the UMD version number.
LVersion = Ch.GetUMDVersion
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.32.1 GetMotorError
Description
The method retrieves the reason for motor disabling.
Syntax
object.GetMotorError(long Axis)
Arguments
Return Value
Long.
The method retrieves the reason for the motor becoming disabled.
Remarks
If the motor is enabled the method returns zero. If the motor was disabled, the method returns
the reason for the disabling. To get the error explanation, use the GetErrorString method.
See 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
Sub GetMotorError_Sample()
Dim MError As Long
On Error GoTo except
'Retrieves the reason for motor disabling
MError = Ch.GetMotorError(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.32.2 GetMotionError
Description
The method retrieves the termination code of the last executed motion of the specified axis.
Syntax
object.GetMotionError(long Axis)
Arguments
Return Value
Long.
The method retrieves the termination code of the last executed motion of the specified axis.
Remarks
If the motion is in progress, the method returns zero. If the motion terminates for any reason, the
method returns the termination code. To get the error explanation, use the method
GetErrorString.
See the 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
Sub GetMotionError_Sample()
Dim MError As Long
On Error GoTo except
'Retrieves the termination code of the last
'executed motion of axis 0
MError = Ch.GetMotionError(Ch.ACSC_AXIS_0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.32.3 GetProgramError
Description
The method retrieves the error code of the last program error encountered in the specified buffer.
Syntax
object.GetProgramError(long Buffer)
Arguments
Return Value
Long.
The method retrieves the error code of the last program error encountered in the 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
Sub GetProgramError_Sample()
Dim PError As Long
On Error GoTo except
'Appends buffer 0 with 1 line
Call Ch.AppendBuffer(0, "!The program finished without STOP command")
'Run buffer 0
Call Ch.RunBuffer(0)
'Retrieves error 3114
PError = Ch.GetProgramError(0)
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.32.4 ParseCOMErrorCode
Description
The method is used to parse the SPiiPlus error code and components of HRESULT.
Syntax
object.ParseCOMErrorCode (long COMErrorCode, [long Code,] [long Facility,] [long Severity])
Arguments
Return Value
Long.
The function returns the SPiiPlus error codes (see Error Codes) parsed from COMErrorCode (which is
HRESULT).
Remarks
In Visual Basic Script the method can only be used to retrieve the SPiiPlus error code. It cannot be
used to retrieve values for Code, Facility, or Severity.
Example
The COM Library DPRAM methods are not supported in SPiiPlus products.
4.33.1 ReadDPRAMInteger
Description
The method reads 32-bit integer from the DPRAM.
Syntax
object. ReadDPRAMInteger(long Address)
Arguments
Return Value
Long.
The method reads 32-bit integer from the DPRAM.
Remarks
Address has to be even number in the range of 128 to 508, because of 16-bit alignment when
working with DPRAM. Addresses less than 128 are used for internal purposes.
The method can be used only with the PCI and Simulator communication channels.
If the method fails, the Error object is filled with the error description.
Example
Sub ReadDPRAMInteger_Sample()
Dim DPRint As Long
On Error GoTo except
'Reads 32-bit integer from the DPRAM from
'address 0xA0
DPRint = Ch.ReadDPRAMInteger(160)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.33.2 WriteDPRAMInteger
Description
The method writes 32-bit integer to the DPRAM.
Syntax
object.WriteDPRAMInteger(long address, long Value)
Arguments
Return Value
The method returns non-zero on success.
Remarks
Address has to be even number in the range of 128 to 508, because we use 16-bit alignment when
working with DPRAM. Addresses less than 128 are used for internal purposes.
If the method fails, the Error object is filled with the error description.
Example
Sub WriteDPRAMInteger_Sample()
On Error GoTo except
4.33.3 ReadDPRAMReal
Description
The method reads 64-bit Real from the DPRAM.
Syntax
object.ReadDPRAMReal(long Address)
Arguments
Return Value
Double.
The method reads 64-bit Real from the DPRAM.
Remarks
Address has to be even number in the range of 128 to 504, because of 16-bit alignment when
working with DPRAM. Addresses less than 128 are used for internal purposes.
If the method fails, the Error object is filled with the error description.
Example
Sub ReadDPRAMReal_Sample()
Dim DPRreal As Double
On Error GoTo except
'Reads 32-bit real from the DPRAM from
'address 0xA0
DPRreal = Ch.ReadDPRAMReal(160)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.33.4 WriteDPRAMReal
Description
The method writes 64-bit Real to the DPRAM.
Syntax
object.WriteDPRAMReal(long address, long Value)
Arguments
Return Value
The method returns non-zero on success.
If the method fails, the Error object is filled with the error description.
Remarks
Address has to be even number in the range of 128 to 504, because we use 16-bit alignment when
working with DPRAM. Addresses less than 128 are used for internal purposes.
If the method fails, the Error object is filled with the error description.
Example
Sub WriteDPRAMReal_Sample()
On Error GoTo except
'Write to DPRAM address 0xA0 the value 100
Call Ch.WriteDPRAMReal(160, 100)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
Waits for the all values to be loaded and the PEG engine to be
WaitPegReadyNT
ready to respond to movement.
4.34.1 PegInc
Description
The method initiates incremental PEG. The Incremental PEG method is defined by the first point,the
last point and the interval.
Syntax
object.PegInc(long Flags, long Axis, double Width, long FirstPoint, long Interval, long LastPoint, long
TbNumber, double TbPeriod)
Arguments
Return Value
None.
Remarks
The method initiates incremental PEG generation. See details in the ACSPL+ Programmer’s Guide.
The time-based pulse generation is optional, if it is not used, TbPeriod and TbNumber should be
ACSC_NONE.
If the method fails, the Error object is filled with the error description.
Example
Sub PegInc_Sample()
On Error GoTo except
'Enable axis Z
Call Ch.Enable(Ch.ACSC_AXIS_Z)
'Wait till Z enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_Z, 1, 5000)
'Relative motion with target position of
'10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_Z, 10000)
'Parameters: Ch.ACSC_AMF_SYNCRONOUS -
'synchronous PEG
'Ch.ACSC_AXIS_Z - axis Z
'0.01 - 10 microseconds pulse width
'0 - start from 0
'50 - generate pulse every 50 units
'10000 - stop generating at 10000
'Ch.ACSC_NONE, Ch.ACSC_NONE - with No
'time-based pulse generation
Call Ch.PegInc(Ch.ACSC_AMF_SYNCRONOUS, Ch.ACSC_AXIS_Z, 0.01, 0, 50,
10000, Ch.ACSC_NONE, Ch.ACSC_NONE)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_Z)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.34.2 PegRandom
Description
The method initiates random PEG. Random PEG method specifies an array of points where position-
based events should be generated.
Syntax
object.PegRandom(long Flags, long Axis, double Width, string PointArray, string StateArray, long
TbNumber, double TbPeriod)
Arguments
Return Value
None.
Remarks
The method initiates random PEG generation (see ACSPL+ Programmer’s Guide).
StateArray should be NULL if output state won’t change because of PEG.
The time-based pulse generation is optional, if it is not used, TbPeriod and TbNumber should be
ACSC_NONE.
If the method fails, the Error object is filled with the error description.
Example
Sub PegRandom_Sample()
On Error GoTo except
'Declare variable "PointArr(10)"
4.34.3 AssignPins
Description
Defines whether a digital output is allocated to the corresponding bit of the OUT array (for general
purpose use) or allocated for PEG method use.
Syntax
object.AssignPins(long Axis, short Mask)
Arguments
Return Value
None.
Remarks
The method calls the ACSPL command: SetConf (205, axis, Mask), where Mask is the output mask.
For a description of the output mask, see the description of SetConf in the ACSPL+ programmers
guide.
If the method fails, the Error object is filled with the error description.
Example
Sub AssignPins_Sample()
On Error GoTo except
'Bit 8 is 1 means OUT3 is assigned to the
'pulse output of the 0 PEG
Call Ch.AssignPins(Ch.ACSC_AXIS_0, 256)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.34.4 StopPeg
Description
The method stops PEG.
Syntax
object.StopPeg(long Axis)
Arguments
Return Value
None.
Remarks
If the method fails, the Error object is filled with the error description.
Example
Sub StopPeg_Sample()
On Error GoTo except
'Enable axis Z
Call Ch.Enable(Ch.ACSC_AXIS_Z)
'Wait till axis Z enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_Z, 1, 5000)
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_Z, 1000000)
Call Ch.PegInc(0, Ch.ACSC_AXIS_Z, 1, 0, 50, 10000, Ch.ACSC_NONE,
Ch.ACSC_NONE)
'Stop the peg in axis Z
Call Ch.StopPeg(Ch.ACSC_AXIS_Z)
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_Z)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.34.5 AssignPegNT
Description
The method is used for engine-to-encoder assignment as well as for assigning additional digital
outputs assignment for use as PEG State and PEG Pulse outputs specifically for the SPiiPlus family
controllers.
Syntax
object.AssignPegNT(int Axis, int EngToEncBitCode, int GpOutsBitCode, ULONGLONG CallType,
VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
int Axis = 1;
int EngToEncBitCode = 0x0;
int GpOutsBitCode = 0x0b11;
try
{
Ch.AssignPegNT(Axis, EngToEncBitCode, GpOutsBitCode);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.34.6 AssignPegOutputsNT
Description
The method is used for setting output pins assignment and mapping between FGP_OUT signals to
the bits of the ACSPL+ OUT(x) variable, where x is the index that has been assigned to the controller
in the network during System Configuration, specifically for the SPiiPlus family controllers.
OUT is an integer array that can be used for reading or writing the current state of the General
Purpose outputs - see the SPiiPlus Command & Variable Reference Guide.
Syntax
object. AssignPegOutputsNT(int Axis, int OutputIndex, int BitCode, ULONGLONG CallType, VARIANT
*pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
int Axis = 1;
int OutputBitCode = 0x0b0;
int OutputIndex = 0;
try
{
Ch.AssignPegOutputsNT(Axis, OutputIndex, OutputBitCode);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.34.7 AssignFastInputsNT
Description
The method is used to switch MARK_1 physical inputs to ACSPL+ variables as fast General Purpose
inputs for SPiiPlus family controllers.
While this method is not related to PEG activity, it is included with the PEG methods for
the sake of completeness, since many times fast inputs are used in applications that
use PEG functionality.
The method is used for setting input pins assignment and mapping between FGP_IN signals to the
bits of the ACSPL+ IN(x) variable, where x is the index that has been assigned to the controller in
the network during System Configuration.
IN is an integer array that can be used for reading the current state of the General Purpose inputs -
see the SPiiPlus Command & Variable Reference Guide.
Syntax
object. AssignFastInputsNT(int Axis, int InputIndex, int BitCode, ULONGLONG CallType, VARIANT
*pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
try
{
Ch.AssignFastInputsNT(Ch.ACSC_AXIS_1, 1, 7);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.34.8 PegIncNT
The method is used for setting the parameters for the Incremental PEG mode for SPiiPlus family
controllers. Incremental PEG is defined by first point, last point and the interval
object. PegIncNT(int Flags, int Axis, double Width, double FirstPoint, double Interval, double
LastPoint, int TbNumber, double TbPeriod, ULONGLONG CallType, VARIANT *pWait)
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
None.
try
{
Ch.PegIncNT(0,
Ch.ACSC_AXIS_1, 0.5, 0, 200, 10000, Ch.ACSC_NONE,
Ch.ACSC_NONE);
}
4.34.9 PegRandomNT
Description
The method is used for setting the parameters for the Random PEG mode for SPiiPlus family
controllers. Random PEG function specifies an array of points where position-based events should
be generated.
Syntax
object. PegRandomNT(int Flags, int Axis, double Width, int Mode, int FirstIndex, int LastIndex, BSTR
PointArray, BSTR StateArray, int TbNumber, double TbPeriod, ULONGLONG CallType, VARIANT
*pWait)
Argument
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
None.
try
{
Ch.PegRandomNT(0, Test.Ch.ACSC_AXIS_1, 1.745, 0x444, 0, 4, "Points",
"States", Test.Ch.ACSC_NONE, Test.Ch.ACSC_NONE);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.34.10 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 family controllers.
The method can be used in both the Incremental and Random PEG modes.
Syntax
object. WaitPegReadyNT( int Axis, long Timeout);
Arguments
Return Value
None.
Example
try
{
Ch.WaitPegReadyNT(Ch.ACSC_AXIS_1, 2000);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.34.11 StartPegNT
Description
The method is used to initiate the PEG process on the specified axis for SPiiPlus family controllers.
Syntax
object. StartPegNT(int Axis, ULONGLONG CallType, VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
try
{
Ch.StartPegNT(Ch.ACSC_AXIS_1);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.34.12 StopPegNT
Description
The method is used to terminate the PEG process immediately on the specified axis for SPiiPlus
family controllers.
The method can be used in both the Incremental and Random PEG modes.
Syntax
object. StopPegNT(int Axis, ULONGLONG CallType, VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this case,
the operation result is ignored by the library and cannot be
retrieved to the calling thread.
Return Value
None.
Example
try
{
Ch.StopPegNT(Ch.ACSC_AXIS_1);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.35.1 Structures
The Application Loader methods employ the following structures:
4.35.1.1 ApplicationFileInfo
Description
This structure describes all the application file data.
Syntax
struct ApplicationFileInfo {BSTR filename; BSTR description; int isNewFile; SAFEARRAY(Attribute)
*attributes; SAFEARRAY (Section) *sections; __int64 reserved}
Arguments
4.35.1.2 Attribute
Description
This structure describes any attribute, which can include application file.
Syntax
struct Attribute {BSTR key; BSTR value}
Arguments
4.35.1.3 Section
Description
This structure describes any sections (or controller files).
Syntax
struct Section{FileType type; BSTR filename; BSTR description; unsigned int offset; unsigned int CRC;
int inuse; _int64 error; BSTR *data}
Arguments
1 - In use
inuse
0 - Not in use
4.35.2 Enum
The Application Loader methods employ the following enums:
4.35.2.1 FileType
Description
Describes possible file types.
Syntax
enum FileType {ADJ, SP, ACSPL, PAR, USER}
Arguments
4.35.3 AnalyzeApplication
Description
The method analyzes application file and returns information about the file components, such as,
saved ACSPL+ programs, configuration parameters, user files, etc.
Syntax
object.AnalyzeApplication(string fileName)
Arguments
Return Value
Return value is struct ApplicationFileInfo* described in ApplicationFileInfo. If the method fails, there
is exception thrown.
Example
ApplicationFileInfo info;
string fileName = "neededFile";
info = channel.AnalyzeApplication(fileName);
4.35.4 LoadApplication
Description
The method loads user application file from a host PC to the controller flash.
Syntax
object.LoadApplication (string fileName, ApplicationFileInfo info, Boolean isPreview);
Arguments
Return Value
None
Example
ApplicationFileInfo info;
string fileName = "neededFile";
info = channel.AnalyzeApplication(fileName);
channel.LoadApplication(fileName,info,0);
4.35.5 SaveApplication
Description
The method saves user application from the controller to a file on host PC.
Syntax:
object.SaveApplication(string fileName, ApplicationFileInfo info, Boolean isPreview);
Arguments
Return Value
None
Example
ApplicationFileInfo info;
ErrorCode res = ErrorCode.OK;
string fileName = "neededFile";
info = channel.AnalyzeApplication(NULL);
channel.SaveApplication(fileName, info);
4.35.6 FreeApplication
Description
The method frees memory, previously allocated by the AnalyzeApplication method.
Syntax:
object.FreeApplication(ApplicationFileInfo info);
Arguments
Return Value
None
Example
ApplicationFileInfo info;
info = channel.AnalyzeApplication (NULL);
…
channel.FreeApplication(info);
4.36.1 LoadDataToController
Description
This method writes value(s) from text file to SPiiPlus controller (variable or file).
Syntax:
object.LoadDataToController(long Dest, string DestName, long From1, long To1, long From2, long
To2, string SrcFilename, long SrcNumFormat, int bTranspose)
Arguments
Return Value
None
Remarks
The method writes to a specified variable (scalar/array) or straight to binary file on controller's flash
memory. The variable can be a ACSPL+ controller variable, user global or user local. The input file
must be ANSI format, otherwise an error 168 (invalid file format) is returned.
ACSPL+ and user global variables have global scope. Therefore, Dest must be ACSC_NONE (-1) for
these classes of variables. User local variable exists only within a buffer. The buffer number must
be specified for user local variable.
If Dest is ACSC_NONE (-1) and there is no global variable with the name specified by DestName, it will
be defined. Arrays will be defined with dimensions (To1+1, To2+1).
If performing loading straight to file, From1, To1, From2 and To2 are meaningless.
If the variable is scalar, all indexes From1, To1, From2, and To2 must be ACSC_NONE (-1). The method
writes the value from file specified by SrcFileName, to the variable specified by Name. In this case if
the variable is a one-dimensional array, From1, To1 must specify the index range and From2, To2
must be ACSC_NONE (-1). The text file, pointed to by SrcFileName, must contain To1-From1+1 values
at least. The method writes the values to the specified variable from index From1 to index To1
inclusively.
If the variable is a two-dimensional array, From1, To1 must specify the index range of the first
dimension and From2, To2 must specify the index range of the second dimension. The text file,
pointed to by SrcFileName, must contain ((To1-From1+1) x (To2-From2+1)) values at least. Otherwise,
error will occur.
The method uses the text file as follows: first, the method retrieves the To2-From2+1 values and
writes them to row From1 of the specified controller variable, then retrieves next To2-From2+1
values and writes them to row From1+1 of the specified controller variable, and so forth. If
bTranspose is TRUE, the method actions are inverted. It takes To1-From1+1 values and writes them
to column From2 of the specified controller variable, then retrieves next To1-From1+1 values and
writes them to column From2+1 of the specified controller variable, and so forth.
The text file is processed line-by-line; any characters except numbers, dots, commas and exponent
'e' are translated as separators between the numbers. Line that starts with no digits is considered
as comment and ignored.
Example
try
{
4.36.2 UploadDataFromController
Description
This method writes value(s) from SPiiPlus controller (variable or file) to text file.
Syntax
object.UploadDataFromController(long Src, string SrcName, long SrcNumFormat, long From1, long
To1, long From2, long To2, string DestFilename, string DestNumFormat, Boolean bTranspose)
Arguments
Return Value
None
Remarks
The method writes data to file from a specified variable (scalar/array) or straight from a binary file
in the controller’s flash memory. The variable can be a ACSPL+ controller variable, user global or
user local.
ACSPL+ and user global variables have global scope. Therefore, Src must have the value of ACSC_
NONE (-1) for these classes of variables. User local variable exists only within a buffer. The buffer
number must be specified for user local variable.
If 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 ACSC_NONE (-1). The method
writes the value from variable specified by SrcName, to the file specified by DestFileName.
If the variable is a one-dimensional array, From1, To1 must specify the index range and From2, To2
must be ACSC_NONE (-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 nthe ext column of the specified destination
file.
The destination file’s format will be determined by string specified by DestNumFormat. This string
will be used as argument in the *printf function.
Example
try
{
channel.UploadDataFromController(ACSC_NONE, "MyGlobalArray",ACSC_INT_
BINARY, 0, 3, 2, 4, "C:\\MyTransposedArrayInFile.txt","%d , ", true);
}
catch (Exception ex)
{
ShowException(ex);
}
4.37.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. 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
try
{
channel.RegisterEmergencyStop();
}
catch (Exception ex)
{
ShowException(ex);
}
4.37.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
try
{
channel.UnregisterEmergencyStop();
}
catch (Exception ex)
{
ShowException(ex);
}
4.38.1 ControllerReboot
Description
This method reboots controller and waits for process completion.
Syntax
object.ControllerReboot(int Timeout)
Arguments
Return Value
If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero.
Example
Sub ControllerReboot_Sample()
On Error GoTo except
'Open Ethernet with TCP protocol
'communication with the controller
'TCP/IP address: 10.0.0.100
Call Ch.OpenCommEthernetTCP("10.0.0.100", Ch.ACSC_SOCKET_STREAM_PORT)
Call Ch.ControllerReboot(30000)
Call Ch.CloseComm()
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.38.2 ControllerFactoryDefault
Description
The method reboots the controller, restores factory default settings and waits for process
completion.
Syntax
object.ControllerFactoryDefault(int Timeout)
Arguments
Return Value
If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero.
Example
Sub ControllerFactoryDefault_Sample()
On Error GoTo except
'Open Ethernet with TCP protocol
'communication with the controller
'TCP/IP address: 10.0.0.100
Call Ch.OpenCommEthernetTCP("10.0.0.100", Ch.ACSC_SOCKET_STREAM_PORT)
Call Ch.ControllerFactoryDefault(30000)
Call Ch.CloseComm()
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
4.39.1 CopyFileToController
Description
The function copies file from host PC to controller’s non-volatile memory.
Syntax
object. CopyFileToController(BSTR SourceFileName, BSTR DestinationFileName, ULONGLONG
CallType, VARIANT *pWait);
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ACSC_ASYNCHRONOUS - The function returns immediately.
ulonglong CallType The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
ACSC_IGNORE - The function returns immediately. In this
case, the operation result is ignored by the library and
cannot be retrieved to the calling thread.
Return Value
None.
Example
try
{
Ch.CopyFileToController("C:\\tmp.txt", "C:\\tmp.txt");
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.39.2 DeleteFileFromController
Description
The function deletes user files from controller's non-volatile memory.
Syntax
object.DeleteFileFromController(BSTR FileName, ULONGLONG CallType, VARIANT* pWait)
Arguments
If CallType is:
ACSC_SYNCHRONOUS - The function returns when the
controller response is received.
ulonglong CallType
ACSC_ASYNCHRONOUS - The function returns immediately.
The calling thread must then call the GetString() / GetBinary()
function to retrieve the operation result.
Return Value
None.
Example
object waitObject = 0;
try
{
Ch.DeleteFileFromController("tmp.txt", Ch.ACSC_SYNCHRONOUS, ref
waitObject);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.40.1 ControllerSaveToFlash
Description
The function saves user application to the controller's non-volatile memory.
Syntax
object. ControllerSaveToFlash(VARIANT Parameters, VARIANT Buffers, VARIANT SPPrograms, BSTR
UserArrays);
Arguments
Return Value
None.
Example
The following code sample saves all axes parameters and buffers to flash, with two user arrays:
"MyArray" and"MyArray2".
ErorMsg(Ex);
}
4.41.1 StartSPiiPlusSC
Description
The function starts the SPiiPlusSC controller.
Syntax
object.StartSPiiPlusSC()
Arguments
None
Return Value
None
Example
try
{
Ch. StartSPiiPlusSC();
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
4.41.2 StopSPiiPlusSC
Description
The function stops the SPiiPlusSC controller.
Syntax
object.StopSPiiPlusSC()
Arguments
None
Return Value
None
Example
try
{
Ch. StopSPiiPlusSC();
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
5. Properties
This chapter presents the built-in variables that are used for establishing various properties during
program runtime. For each property, the name of the variable, its value and a description are given.
ACSC_
1 Counterclockwise rotation
COUNTERCLOCKWISE
ACSC_POSITIVE_
1 A move in positive direction
DIRECTION
ACSC_NEGATIVE_
-1 A move in negative direction
DIRECTION
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
ACSC_AMF_
0x00100000 Decelerate to curvature discontinuity point.
CURVEVELOCITY
ACSC_AMF_
0x00800000 Use automatic corner rounding option.
CORNERLENGTH
ACSC_AMF_
0x01000000 Automatic curve calculations
CURVEAUTO
ACSC_AST_
0x00000001 Axis is leading in a group.
LEAD
ACSC_AST_
0x00000004 PEG for the specified axis is in progress.
PEG
ACSC_AST_
0x00000020 Axis is moving.
MOVE
ACSC_AST_
0x00000040 Axis is accelerating.
ACC
ACSC_IST_
0x00000001 Primary encoder index of the specified axis is latched.
IND
ACSC_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_
0x00100000 Hssi Not Connected
HSSINC
ACSC_SAFETY_
0x00800000 External Network Error
EXTNT
ACSC_SAFETY_
0x80000000 Component Failure
FAILURE
ACSC_INTR_ACSPL_
21 A user has sent the INTERRUPTEX command.
PROGRAM_EX
ACSC_INTR_COMM_
32 Communication channel has been closed.
CHANNEL_CLOSED
ACSC_INTR_ETHERCAT_
29 EtherCAT error occurred.
ERROR
ACSC_INTR_LOGICAL_
17 Logical motion has finished.
MOTION_END
ACSC_INTR_MOTION_
18 Motion has been interrupted due to a fault.
FAILURE
ACSC_INTR_MOTION_
25 Motion profile changed the phase
PHASE_CHANGE
ACSC_INTR_MOTION_
24 Physical motion has started.
START
ACSC_INTR_MOTOR_
19 Motor has been disabled due to a fault.
FAILURE
ACSC_INTR_PHYSICAL_
16 Physical motion has finished.
MOTION_END
ACSC_INTR_PROGRAM_
20 ACSPL+ program has finished.
END
ACSC_INTR_SOFTWARE_
33 EStop button was clicked.
ESTOP
ACSC_INTR_SYSTEM_
28 System error occurred.
ERROR
ACSC_INTR_PHYSICAL_MOTION_END,
ACSC_INTR_LOGICAL_MOTION_END,
ACSC_MASK_ ACSC_INTR_MOTION_FAILURE,
63 Axis 63
AXIS_63
ACSC_INTR_MOTOR_FAILURE,
ACSC_INTR_MOTION_START, ACSC_INTR_
MOTION_PHASE_CHANGE, ACSC_INTR_TRIGGER
ACSC_MASK_
BUFFER_0 0 Buffer 0 ACSC_INTR_PROGRAM_END,
... ... ... ACSC_INTR_COMMAND,
ACSC_MASK_ 31 Buffer 31 ACSC_INTR_ACSPL_PROGRAM
BUFFER_31
ACSC_CONF _INT_EDGE_
3 Sets the interrupt edge to be positive or negative.
KEY
ACSC_CONF _ENCODER_
4 Sets encoder type: A&B or analog.
KEY
ACSC_CONF_OUT_KEY 29 OUT0
PEG
Brake
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
6. Events
SPiiPlus COM 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,
Callback Interrupt Masks for a description of Param for each interrupt.
Event Interrupt
MOTIONPHASECHANGE ACSC_INTR_MOTION_PHASE_CHANGE
TRIGGER ACSC_INTR_TRIGGER
7. Error Handling
The SPiiPlus COM Library supports a standard COM error object to provide error information. Each
COM error object contains:
> The source reporting the error as follows: SpiiPlusCom660.Channel.
> A string with a description of the error and the SPiiPlus Error Codes (see Error Codes). For
example:
> HRESULT - a 32-bit standard COM value representing the method return status. To get the
SPiiPlus error code from HRESULT, use ParseCOMErrorCode. For more information about
HRESULT, refer to Microsoft documentation.
Sub OpenCommSerial ()
On Error GoTo except
'Open serial communication through port COM1
'with baud rate 115200
Call Ch.OpenCommSerial(1, 115200)
Exit Sub
except:
MyErrorMsg
End Sub
Sub MyErrorMsg()
Dim Str
Str = "Error from " & Err.Source & Chr$(10) & Chr$(13)
Str = Str & Err.Description & Chr$(10) & Chr$(13)
Str = Str & "HRESULT: " & Hex$(Err.Number)
MsgBox Str
End Sub
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
Atempt to stop
An attempt to stop simulator was made without it
131 Simulator while it
being run.
was not running.
SPiiPlus Simulator The ports set for simulator in UMD are taken by
133
ports are in use by another application.
Error
Error Message Remarks
Code
another application.
Invalid
Specified communication handle must be a handle
134 communication
returned by one of the Open*** methods.
handle.
Received message is
This error cannot be returned and is present for
137 too long (more than
compatibility with previous versions of the library.
size of user 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
Error
Error Message Remarks
Code
Unsolicited
150 messages buffer is
closed.
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
Error
Error Message Remarks
Code
Application Saver
176 Loader Format
Version Error
Application Saver
177 Loader Section Size
is Zero
Pointer to the
buffer is invalid ||
185 Null pointer
received instead of
user allocated object
Cannot access
Returned by DPRAM access methods, when
DPRAM directly
190 attempting to call them with Serial or Ethernet
through any channel
channels.
but PCI and 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