0% found this document useful (0 votes)
16 views313 pages

SPiiPlus COM Library (V5-20)

Uploaded by

Nikita Stenin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views313 pages

SPiiPlus COM Library (V5-20)

Uploaded by

Nikita Stenin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 313

SPiiPlus COM Library

COM Methods, Properties, Events


for Communication with the
Controller

Programmer’s Guide
Version 5.20
Version 5.20, October 30, 2006

COPYRIGHT
Copyright ® 1999 - 2005 ACS Motion Control Ltd.
Changes are periodically made to the information in this document. Changes are published as release
notes and are be incorporated into future 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, PEG and SPii are trademarks of ACS Motion Control Ltd.
Visual Basic and Windows are trademarks of Microsoft Corporation.
Any other companies and product names mentioned herein may be the trademarks of their respective
owners.

Website: http://www.AcsMotionControl.com
Information: [email protected]
Tech Support: [email protected]

ACS Motion Control, Inc.


14700 28th Ave North - Suite 25
Plymouth, MN 55447
Tel: 800-545-2980
Tel. 763-559-7669
Fax. 763-559-0110

ACS Motion Control, Ltd.


Ramat Gabriel Industrial Park
POB 5668
Migdal HaEmek, 10500
ISRAEL
Tel: (972) (4) 6546440
Fax: (972) (4) 6546443
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.

October 30, 2006 ii Programmer’s Guide


Programmer’s Guide

Changes in Version 5.20

Page Change
The following functions were added in V 5.0:
92 FlushLogFile
102 GetEthernetCards
238 SetServerExt
239 SetServerExtLogin

282 Section 5.191, WriteLogFile - method behavior changed, a log file no longer
needs to be explicitly opened.

Implementation of communication log

Version 5.20, October 30, 2006 iii Programmer’s Guide


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Related SPiiPlus Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 The SPiiPlus Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Conventions Used in this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Statement Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Operating Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Communication Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4 Controller Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.5 Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.6 Installation and Supplied Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.7 Standard (SPiiPlus C Library) Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.8 Specific COM Library Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.9 Communication Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Using the SPiiPlus COM Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1 Redistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Visual Basic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 LabView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4 VBScript (HTML) Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.5 Visual Studio .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Methods Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.1 Communication Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2 Service Communication Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 ACSPL+ Program Management Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.4 Read and Write Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.5 Load File to ACSPL+ Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.6 Multiple Thread Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.7 History Buffer Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.8 Unsolicited Messages Buffer Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.9 Log File Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.10 System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.11 Setting and Reading the Motion Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.12 Axis/Motor Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.13 Motion Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.14 Point-to-Point Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.15 Track Motion Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.16 Jog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.17 Slaved Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.18 Multi-Point Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.19 Arbitrary Path Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.20 PVT Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.21 Segmented Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.22 Points and Segments Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.23 Data Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

October 30, 2006 iv


SPiiPlus COM Library Version 5.20 Programmer’s Guide

4.24 Status Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20


4.25 Inputs/Outputs Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.26 Safety Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.27 Wait-for-Condition Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.28 Event and Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.29 Variables Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.30 Service Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.31 Error Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.32 Dual Port RAM (DPRAM) Access Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.33 Position Event Generation (PEG) Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5 Detailed Method Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.1 AddPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.2 MAddPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.3 AddPVPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.4 AddPVPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.5 AddPVTPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .AddPVTPointM 33
5.7 AppendBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.8 Arc1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.9 Arc2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.10 AssignPins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.11 Break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.12 BreakM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.13 CancelOperation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.14 CaptureComm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.15 ClearBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.16 ClearVariables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5.17 CloseComm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.18 CloseHistoryBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.19 CloseLogFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.20 CloseMessageBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.21 CollectB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.22 Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.23 CompileBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.24 DeclareVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.25 Disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.26 DisableAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.27 DisableEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.28 DisableExt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.29 DisableFault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.30 DisableM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.31 DisableResponse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.32 Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.33 EnableEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.34 EnableFault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.35 EnableM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.36 EnableResponse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

October 30, 2006 v


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.37 EndSequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.38 EndSequenceM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.39 ExtAddPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.40 ExtAddPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.41 ExtArc1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.42 ExtArc2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
5.43 ExtLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.44 ExtToPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.45 ExtToPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.46 FaultClear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.47 FaultClearM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.48 FlushLogFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
5.49 GetAcceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
5.50 GetACSCHandle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.51 GetAnalogInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.52 GetAnalogOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.53 GetAxisState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.54 GetCOMLibraryVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.55 GetCommOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.56 GetConf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5.57 GetDeceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.58 GetDefaultTimeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.59 GetEthernetCards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.60 GetErrorString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5.61 GetExtInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.62 GetExtInputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.63 GetExtOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
5.64 GetExtOutputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.65 GetFault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5.66 GetFaultMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.67 GetFirmwareVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.68 GetFPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.69 GetFVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.70 GetHistory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.71 GetIndexState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
5.72 GetInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
5.73 GetInputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5.74 GetInterruptMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
5.75 GetJerk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.76 GetKillDeceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5.77 GetLibraryVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.78 GetSingleMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
5.79 GetMotionError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5.80 GetMotorError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
5.81 GetMotorState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.82 GetOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.83 GetOutputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5.84 GetPCICards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

October 30, 2006 vi


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.85 GetProgramError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129


5.86 GetProgramState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
5.87 GetResponseMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
5.88 GetRPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5.89 GetRVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.90 GetSafetyInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.91 GetSafetyInputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
5.92 GetSafetyInputPortInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
5.93 GetSerialNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
5.94 GetServerExt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
5.95 GetTimeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
5.96 GetVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.97 Go . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.98 GoM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.99 Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
5.100 Halt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.101 HaltM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
5.102 Jog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.103 JogM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
5.104 Kill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
5.105 KillAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
5.106 KillExt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
5.107 KillM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
5.108 Line1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
5.109 LoadBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
5.110 LoadBuffersFromFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
5.111 LoadFileToIntegerVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
5.112 LoadFileToRealVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
5.113 MultiPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
5.114 MultiPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
5.115 OpenCommDirect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
5.116 OpenCommEthernet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5.117 OpenCommPCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
5.118 OpenCommSerial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
5.119 OpenHistoryBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
5.120 OpenLogFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
5.121 OpenMessageBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
5.122 ParseCOMErrorCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
5.123 PegI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
5.124 PegR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
5.125 Projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
5.126 ReadDPRAMInteger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
5.127 ReadDPRAMReal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
5.128 ReadVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5.129 ReadVariableAsScalar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
5.130 ReadVariableAsVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
5.131 ReadVariableAsMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.132 Receive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

October 30, 2006 vii


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.133 ReleaseComm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201


5.134 ResetIndexState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
5.135 RunBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
5.136 Send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
5.137 Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
5.138 SetAccelerationImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
5.139 SetAnalogOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.140 SetCommOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
5.141 SetConf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
5.142 SetDeceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
5.143 SetDecelerationImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
5.144 SetExtOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
5.145 SetExtOutputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
5.146 SetFaultMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
5.147 SetFPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
5.148 SetInterruptMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
5.149 SetIterations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
5.150 SetJerk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.151 SetJerkImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
5.152 SetKillDeceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
5.153 SetKillDecelerationImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
5.154 SetMaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
5.155 SetOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
5.156 SetOutputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
5.157 SetResponseMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
5.158 SetRPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
5.159 SetSafetyInputPortInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
5.160 SetServer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
5.161 SetServerExt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
5.162 SetServerExtLogin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
5.163 SetTimeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
5.164 SetVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
5.165 SetVelocityImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
5.166 Slave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
5.167 SlaveStalled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
5.168 Spline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
5.169 SplineM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
5.170 Split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
5.171 SplitAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
5.172 StopBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
5.173 StopCollect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
5.174 StopPeg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
5.175 Stopper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
5.176 SuspendBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
5.177 Track . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
5.178 ToPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
5.179 ToPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
5.180 Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

October 30, 2006 viii


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.181 UploadBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268


5.182 WaitCollectEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
5.183 WaitInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
5.184 WaitLogicalMotionEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
5.185 WaitMotionEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
5.186 WaitMotorEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
5.187 WaitProgramEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
5.188 WriteDPRAMInteger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
5.189 WriteDPRAMReal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
5.190 WriteVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
5.191 WriteLogFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
6 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
6.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
6.2 General Communication Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
6.3 Ethernet Communication Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
6.4 Axis Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
6.5 Motion Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
6.6 Data Collection Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
6.7 Motor State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
6.8 Axis State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
6.9 Index and Mark State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
6.10 Program State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
6.11 Safety Control Masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
6.12 Interrupt Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
6.13 Interrupt Masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
6.14 Configuration Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
7 Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
8 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
8.1 Error Handling in Visual Basic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
8.2 Error Handling Example in LabVIEW 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
8.3 Error Handling Example in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
8.4 Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

October 30, 2006 ix


SPiiPlus COM Library Version 5.20 Programmer’s Guide

List of Tables
Table 1 Related SPiiPlus Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Table 2 Collateral Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Table 3 Text Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Table 4 Communication Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Table 5 Service Communication Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Table 6 ACSPL+ Program Management Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Table 7 Read and Write Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Table 8 Load File to ACSPL+ Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 9 Multiple Thread Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 10 History Buffer Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 11 Unsolicited Messages Buffer Management . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 12 Log File Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 13 System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 14 Setting and Reading the Motion Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 15 Axis/Motor Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Table 16 Motion Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Table 17 Point-to-Point Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 18 Track Motion Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 19 Jog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 20 Slaved Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 21 Multi-Point Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Table 22 Arbitrary Path Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Table 23 PVT Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Table 24 Segmented Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Table 25 Points and Segments Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Table 26 Data Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Table 27 Status Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Table 28 Inputs/Outputs Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Table 29 Safety Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Table 30 Wait-for-Condition Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Table 31 Event and Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Table 32 Variables Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Table 33 Service Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Table 34 Error Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Table 35 Dual Port RAM (DPRAM) Access Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Table 36 Position Event Generation (PEG) Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Table 37 Value Dimension Indeces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Table 38 General Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Table 39 General Communication Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Table 40 Ethernet Communication Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Table 41 Axis Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Table 42 Motion Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Table 43 Data Collection Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Table 44 Motor State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Table 45 Axis State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Table 46 Index and Mark State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Table 47 Program State Flags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Table 48 Safety Control Masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Table 49 Interrupt Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Table 50 Interrupt Masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Version 5.20, October 30, 2006 x Programmer’s Guide


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 51 Configuration Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291


Table 52 Events and Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Table 53 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297

Version 5.20, October 30, 2006 xi Programmer’s Guide


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Figure 1 LabView Automation Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11


Figure 2 Communication not Established Message - Visual Basic. . . . . . . . . . . . . . . . 295
Figure 3 Error Handling Example in LabView 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Figure 4 LabVIEW Error Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Figure 5 C# Error Message. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

Version 5.20, October 30, 2006 xii Programmer’s Guide


SPiiPlus COM Library Version 5.20 Programmer’s Guide

1 Introduction
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.

1.1 Related SPiiPlus Tools

Table 1 Related SPiiPlus Tools


Tool Description
SPiiPlus MMI A multipurpose user interface with the controller
including: Program management, Motion management,
Communication terminal, Four channel digital
oscilloscope, Safety and I/O signals monitor, Signal tuning
and adjustment, and a fully interactive simulator. Program
and SPii debugging tools and FRF are also included.
SPiiPlus Utilities The SPiiPlus Upgrader allows upgrading or downgrading
of the controller firmware.
The SPiiPlus Emergency Wizard allows firmware
recovery in case of damage or loss of communication to
the controller.
SPiiPlus C Library A DLL (Dynamic Link Library) that supports host
application programming in a variety of languages
including C/C++. The library introduces a new level of
application support with a built-in controller simulator and
it also provides outstanding debugging capabilities. All
tools are provided with a full simulator of the controller.
SPiiPlus COM Library A DLL (Dynamic Link Library) that supports host
application programming in a variety of languages
including Visual Basic, Motion ControlLabView, and
more. The library introduces a new level of application
support with a built-in controller simulator and it also
provides outstanding debugging capabilities. All tools are
provided with a full simulator of the controller.

October 30, 2006 1 Introduction


SPiiPlus COM Library Version 5.20 Programmer’s Guide

1.2 The SPiiPlus Documentation

Table 2 Collateral Documentation


Document Description
SPiiPlus PCI Series Hardware Installation and hardware connection with the SPiiPlus PCI 4
Guide or 8 axes
SPiiPlus CM Hardware Guide Installation and hardware connection with the SPiiPlus
Control Module
HSSI Expansion Modules High-Speed Synchronous Serial Interface (HSSI) for
Guide expanded I/O, distributed axes, and nonstandard devices.
SPiiPlus Setup Guide Communication, configuration and adjustment procedures
for SPiiPlus motion control products.
SPiiPlus ACSPL+ Command set and high level language for programming
Programmer's Guide SPiiPlus controllers.
SPiiPlus Utilities User’s Guide Firmware upgrade and recovery procedures.
SPiiPlus C Library Reference C++ and Visual Basic® libraries for host PC applications.
This guide is applicable for all the SPiiPlus motion control
products
SPiiPlus COM Library COM Methods, Properties, and Events for Communication
Reference Guide with the Controller
SPiiPlus FRF Analyzer User’s The SPiiPlus FRF (Frequency Response Function)
Guide Analyzer™ is a powerful servo analysis GUI for ACS-Tech80
SPiiPlus motion controllers.
SPiiPlus Modbus User’s Guide Describes Modbus setup and register address.
SPiiPlus SA and SA-LT Installation and hardware connection with the SPiiPlus SA
Hardware Guide and SA-LT Controllers.
SPiiPlus 3u Hardware Guide Installation and hardware connection with the SPiiPlus 3U
Controller.

1.3 Conventions Used in this Guide


Several text formats and fonts, illustrated in Table 3, are used in the text to convey information
about the text.

Table 3 Text Conventions


Text Description
BOLD CAPS ACSPL+ elements (commands, functions, operators,
standard variables, etc.) when mentioned in the text.
Software tool menus, menu items, dialog box names and
dialog box elements.
bold Emphasis or an introduction to a key concept.
Monospace Code examples.

October 30, 2006 2 Introduction


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 3 Text Conventions


Text Description
Italic monospace Information in code examples that the user provides.
ALL CAPS (Keyboard) key names [example: SHIFT key].
Bold Blue Text Links within this document, to web pages, and to e-mail
addresses.
| When used in command syntax, indicates input from one
alternative or another.
When used in GUI descriptions, indicates nested menu
items and dialog box options leading to a final action. For
example, the sequence:
Debug | New Watch | Real-time |
directs the user to open the Debug menu, choose the New
Watch command, and select the Real-time option.

1.4 Statement Conventions

Note
Highlights an essential operating or maintenance procedure,
condition, or statement

Model
Model Dependent Text Here!

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

October 30, 2006 3 Introduction


SPiiPlus COM Library Version 5.20 Programmer’s Guide

A warning describes a condition that may result in serious


bodily injury, or death!

October 30, 2006 4 Introduction


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 is provides the easiest way to incorporate SPiiPlus motion control
functionality. The library supports applications written in LabView, Microsoft Visual Basic,
and other popular languages.

2.2 Operating Environment


The SPiiPlus COM Library supports Windows® 98/ME/NT/2000/XP.

2.3 Communication Channels


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

2.4 Controller Simulation


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

2.5 Programming Languages


The SPiiPlus COM Library supports C++, Visual Basic, VBScript, LabView and other
programming languages that support the use of COM components. The library also supports
Delphi, Power Builder, Microsoft Office, Internet Explorer and other development
environments.
The SPiiPlus COM Library has been tested with Visual C++, Visual Basic, VBScript, LabView
and .NET applications.

2.6 Installation and Supplied Components


The SPiiPlus COM Library is supplied as a standard COM component (DLL module) that must
be registered in Windows before using. This is done automatically during the installation of the
SPiiPlus Software Tools (page 3-1). See using SPiiPlus COM Library for details. Samples for
Visual Basic 6, LabVIEW 7, VDScript (HTML), .NET are also installed.

October 30, 2006 5 General Information


SPiiPlus COM Library Version 5.20 Programmer’s Guide

2.7 Standard (SPiiPlus C Library) Features


The SPiiPlus COM Library provides the same standard features as the SPiiPlus C Library (see
SPiiPlus C Library Reference), including:
• Unified support for all communication channels (Serial, Ethernet, PCI Bus)
All SPiiPlus COM Library methods except the OpenCommxxx methods are identical for
all communication channels. A (host computer) user application doesn't require any other
modification to work with different communication channels.
• Controller simulator communication channel
All SPiiPlus COM Library methods support the SPiiPlus Controller Simulator. The user
client application activates the simulator by opening a special communication channel. The
user is not required to change his application in order to communicate with the simulator.
• Concurrent support for up to 10 communication channels in one application
One user client application can open up to ten communication channels simultaneously.
Different communication channels are usually connected to different controllers. However,
two or more communication channels can be connected to the same controller. For example,
an application can communicate with a controller through both the controller's Ethernet
channel and its serial channels.
• Acknowledgement for each command sent to the controller
The library automatically checks the status of each command sent by the user application to
the controller. The user application can check the status to confirm that the command was
received successfully.
• Communication history
The SPiiPlus COM Library enables storage in a memory buffer of all messages sent to, and
received from, the controller. The application can retrieve data from the buffer and can clear
the buffer.
• Separate processing of unsolicited messages
Most messages sent from the controller to the host are responses to host commands.
However, the controller can send unsolicited messages, for example, as output from a disp
command. The library separates the unsolicited messages from the overall message flow
and provides a special method for handling unsolicited messages.
• Rich functionality
The COM library supports setting and reading parameters, advanced motion control,
program management, I/O, safety, and more.
• Debug tools
The SPiiPlus COM Library provides tools that facilitate debugging of the user application.
The simulator and the communication history mentioned above are the primary debugging
tools. The user can also open a log file that stores all communications between the
application and the controller.

October 30, 2006 6 General Information


SPiiPlus COM Library Version 5.20 Programmer’s Guide

2.8 Specific COM Library Features


The SPiiPlus COM Library also supports features based on COM technology:
• Generating COM events for predefined controller events
The SPiiPlus COM Library generates COM events for the user client application if one of
the following events occurs:
• PEG, MARK, or Emergency Stop signal has been generated
• Motion has ended
• Motion has been interrupted due to a fault
• Motor has been disabled due to a fault
• ACSPL+ program in the controller has completed
• Digital input has been changed
• Other events
• Error handling
The SPiiPlus COM Library supports a COM error object to provide rich error information
to a user client application such as error code, error description and help context.
• Automation support
The SPiiPlus COM Library supports scripting languages such as VBScript used in
Microsoft Office, Internet Explorer, and other environments.

2.9 Communication Scenarios


One user application can open through SPiiPlus COM Library up to 10 communication
channels simultaneously. Usually the application opens different communication channels to
work with different controller at the same time.
The following communication scenarios are typical for application development.
• Application works with one controller through one communication channel
Application creates communication channel object, opens communication and then uses
any SPiiPlus COM Library methods. Before closing the application closes communication
and then destroys communication channel object.
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_X)
'get motor feedback position

Ch.CloseCommunication 'close communication
'in VB there is no need to destroy
'communication channel

October 30, 2006 7 General Information


SPiiPlus COM Library Version 5.20 Programmer’s Guide

• 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_X)
'get motor feedback position from 1st
'controller

Ch.CloseCommunication 'close communication
Call Ch.OpenCommSerial(1, 115200) 'open communication with 2nd
'controller

Fposition2 = Ch.GetFPosition(Ch.ACSC_AXIS_X)
'get motor feedback position from
'2nd controller

Ch.CloseCommunication 'close communication
Call Ch.OpenCommSerial(2, 115200) 'open communication with 3rd
'controller

Fposition3 = Ch.GetFPosition(Ch.ACSC_AXIS_X)
'get motor feedback position from
'3rd controller

Ch.CloseCommunication 'close communication
'in VB there is no need to destroy
'communication channel

October 30, 2006 8 General Information


SPiiPlus COM Library Version 5.20 Programmer’s Guide

• Application works with several controllers at the same time


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

Dim Ch1 As Channel


Dim Ch2 As Channel
Dim Ch3 As Channel
Set Ch1 =new Channel 'create communication channel
Set Ch2 =new Channel 'create communication channel
Set Ch3 =new Channel 'create communication channel
Call Ch1.OpenCommPCI(Ch.ACSC_NONE) 'open communication with 1st
'controller
Call Ch2.OpenCommSerial(1, 115200) 'open communication with 2nd
'controller
Call Ch3.OpenCommSerial(2, 115200) 'open communication with 3rd
'controller
… 'get motor feedback position:
Fposition1 = Ch1.GetFPosition(Ch1.ACSC_AXIS_X)
'from 1st controller
Fposition2 = Ch2.GetFPosition(Ch2.ACSC_AXIS_X)
'from 2nd controller
Fposition3 = Ch3.GetFPosition(Ch3.ACSC_AXIS_X)
'from 3rd controller

Ch1.CloseCommunication 'close all communications
Ch2.CloseCommunication
Ch3.CloseCommunication
'in VB there is no need to destroy
'communication channel

October 30, 2006 9 General Information


SPiiPlus COM Library Version 5.20 Programmer’s Guide

3 Using the SPiiPlus COM Library


This chapter describes how to register the SPiiPlus COM Library and provides examples of how
to call SPiiPlus COM methods from Visual Basic, .NET (Visual Basic and C#), LabVIEW, and
VBScript (HTML).
See also demo projects for Visual Basic,.NET (Visual Basic and C#), LabVIEW, and VBScript
in the SPiiPlus COM installation folder.

3.1 Redistribution

Note
SPiiPlus COM Library is registered automatically by the SPiiPlus
installation. However, when you deploy an application that uses the
SPiiPlus COM Library to other computers, you will have to register the
library.

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 SPiiPlusCOM510.dll with the full path. The path and DLL name
should be in quotation marks. For example:
regsvr32 “C:\MyProjects\SPiiPlusCOM510.dll”
The SPiiPlus COM Library requires the SpiiPlus C Library and drivers. See Section 3.3 of the
SPiiPlus C Library Programmer’s Guide for details how to redistribute the SPiiPlus C Library.

3.2 Visual Basic


1. In the Project menu click References. The dialog box opens.
2. In the dialog box, select SPiiPlusCOM 5.10 Type Library
3. In your project source file declare
Public Ch As Channel
4. In the method that is called when your form is loaded, include
Set Ch = New 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.

October 30, 2006 10 Using the SPiiPlus COM Library


SPiiPlus COM Library Version 5.20 Programmer’s Guide

1. On the Controls palette select the Refnum -> Automation Refnum control.
2. On the control, click the right mouse button and select Select ActiveX Class - > Browse. A
list is displayed
3. Select SPiiPlus COM 5.10 Type Library Version 1.0 from the Type Library combo box.
In the Objects list, Channel should be selected.
4. Right click the SPiiPlusCOMLib control and select Find Terminal.
5. On your diagram, open the Function palette and select Communication->ActiveX-
>Automation Open.
6. Connect the SPiiPlusCOMLib510.IChannel control to the Automation Open control. as
illustrated in Figure 1.

SPiiPlusCOMLib .IChannel

labview _example

Figure 1 LabView Automation Open

3.4 VBScript (HTML) Example


Add the following declaration to your HTML file after <BODY>:
<OBJECT classid=clsid: 4FC7FF8B-8432-49d5-9878-9A97FB42E04D height=1
id=Ch
VIEWASTEXT></OBJECT>

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>

October 30, 2006 11 Using the SPiiPlus COM Library


SPiiPlus COM Library Version 5.20 Programmer’s Guide

<BODY>
<OBJECT classid=clsid: 4FC7FF8B-8432-49d5-9878-9A97FB42E04D height=1 id=Ch
VIEWASTEXT></OBJECT>
<INPUT id=button1 name=button1 style="HEIGHT: 28px; WIDTH: 127px" type=button
value=Button>&nbsp;

</BODY>
</HTML>

3.5 Visual Studio .NET


1. On “Solution Explorer” window right click on Reference and choose “Add Reference…”
In the Project menu click References. The dialog box opens.
2. In the dialog box click on “COM” panel, select SPiiPlusCOM5.10 Type Library, click
Select , then OK.
3. Declare in your project:
Visual basic:
Public Ch As SPIIPLUSCOM510Lib.Channel
C#:
Public SPIIPLUSCOM510Lib.Channel Ch;
4. In the method that is called when your form is loaded, include
Ch = New SPIIPLUSCOM510Lib.Channel
5. Now you can call SPiiPlus COM Library methods. For example,
Ch.OpenCommPCI(-1)

October 30, 2006 12 Using the SPiiPlus COM Library


SPiiPlus COM Library Version 5.20 Programmer’s Guide

4 Methods Overview

4.1 Communication Methods

Table 4 Communication Methods


CancelOperation Cancels all operations.
Command Sends a command to the controller and analyzes the
controller response.
CloseComm Closes communication (for all kinds of communication).
FlushLogFile Allows flushing the User-Mode Driver (UMD) internal
binary buffer to a specified text file, from a user application.
GetEthernetCards Retrieves all SPiiPlus controller IP addresses within a local
domain.
GetPCICards Retrieves information about the installed SPiiPlus PCI cards.
OpenCommDirect Starts up the Simulator and opens communication with it.
OpenCommEthernet Opens communication via Ethernet.
OpenCommPCI Opens communication with the SPiiPlus PCI via PCI Bus.
OpenCommSerial Opens communication via serial port.
Receive Receives a message.
Send Sends a message.
SetServer Defines communication server IP address
SetServerExt Defines communication server IP address and specifies
explicit port number.
SetServerExtLogin Sets the remote User-Mode Driver (UMD) with a specified
IP address, port number, and user login.
Transaction Executes one transaction with the controller, i.e. sends the
request and receives the controller response.

4.2 Service Communication Methods

Table 5 Service Communication Methods


GetACSCHandle Retrieves the SPiiPlus C Library communication handle
GetCOMLibraryVersion Retrieves the SPiiPlus COM Library version number.
GetCommOptions Retrieves the communication options.
GetDefaultTimeout Retrieves default communication timeout.
GetErrorString Retrieves the explanation of an error code.
GetLibraryVersion Retrieves the legacy SPiiPlus C Library version number.
GetTimeout Retrieves communication timeout.

October 30, 2006 13 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 5 Service Communication Methods


SetIterations Sets the number of iterations of one transaction.
SetCommOptions Sets the communication options.
SetTimeout Sets communication timeout.

4.3 ACSPL+ Program Management Methods

Table 6 ACSPL+ Program Management Methods


AppendBuffer Appends one or more ACSPL+ lines to the program in the
specified program buffer.
ClearBuffer Deletes the specified ACSPL+ program lines in the specified
program buffer.
CompileBuffer Compiles ACSPL+ program in the specified program
buffer(s).
LoadBuffer Clears the specified program buffer and then loads ACSPL+
program to this buffer.
LoadBuffersFromFile Opens a file that contains one or more ACSPL+ programs
allocated to several buffers and download the programs to the
corresponding buffers.
RunBuffer Starts up ACSPL+ program in the specified program buffer.
StopBuffer Stops ACSPL+ program in the specified program buffer(s).
SuspendBuffer Suspends ACSPL+ program in the specified program
buffer(s).
UploadBuffer Uploads ACSPL+ program from the specified program buffer.

4.4 Read and Write Variables

Table 7 Read and Write Variables


ReadVariable Reads variable from a controller and returns it in the form
of VARIANT
ReadVariableAsScalar Reads variable from a controller and returns it as scalar
VARIANT
ReadVariableAsVector Reads variable from a controller and returns it in the form
VARIANT that contains one-dimension array
ReadVariableAsMatrix Reads variable from a controller and returns it in the form
VARIANT that contains two-dimensions array
WriteVariable Writes to controller variable(s)

October 30, 2006 14 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

4.5 Load File to ACSPL+ Variable

Table 8 Load File to ACSPL+ Variable


LoadFileToIntegerVariable Loads file to integer variable.
LoadFileToRealVariable Loads file to real variable.

4.6 Multiple Thread Synchronization

Table 9 Multiple Thread Synchronization


CaptureComm Captures a communication channel.
ReleaseComm Releases a communication channel.

4.7 History Buffer Management

Table 10 History Buffer Management


OpenHistoryBuffer Opens a history buffer.
CloseHistoryBuffer Closes a history buffer.
GetHistory Retrieves the contents of the history buffer.

4.8 Unsolicited Messages Buffer Management

Table 11 Unsolicited Messages Buffer Management


OpenMessageBuffer Opens an unsolicited messages buffer.
CloseMessageBuffer Closes an unsolicited messages buffer.
GetSingleMessage Retrieves single unsolicited message from the buffer.

4.9 Log File Management

Table 12 Log File Management


OpenLogFile Opens a log file.
CloseLogFile Closes a log file.
WriteLogFile Writes to a log file.

October 30, 2006 15 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

4.10 System Configuration

Table 13 System Configuration


SetConf The method writes system configuration data.
GetConf The method reads system configuration data.

4.11 Setting and Reading the Motion Parameters

Table 14 Setting and Reading the Motion Parameters


SetVelocity Defines a value of motion velocity.
GetVelocity Retrieves a value of motion velocity.
SetAcceleration Defines a value of motion acceleration.
GetAcceleration Retrieves a value of motion acceleration.
SetKillDeceleration Defines a value of motion deceleration.
GetDeceleration Retrieves a value of motion deceleration.
SetJerk Defines a value of motion jerk.
GetJerk Retrieves a value of motion jerk.
SetKillDeceleration Defines a value of kill deceleration.
GetKillDeceleration Retrieves a value of kill deceleration.
SetVelocityImm Defines a value of motion velocity. Unlike SetVelocity,
the method has immediate effect on any executed and
planned motion.
SetAccelerationImm Defines a value of motion acceleration. Unlike
SetAcceleration, the method has immediate effect on
any executed and planned motion.
SetDecelerationImm Defines a value of motion deceleration. Unlike
SetDeceleration, the method has immediate effect on
any executed and planned motion.
SetJerkImm Defines a value of motion jerk. Unlike SetJerk, the
method has an immediate effect on any executed and
planned motion.
SetKillDecelerationImm Defines a value of kill deceleration. Unlike
SetKillDeceleration, the method has immediate effect
on any executed and planned motion.
SetFPosition Assigns a current value of feedback position.
GetFPosition Retrieves a current value of motor feedback position.
SetRPosition Assigns a current value of reference position.
GetRPosition Retrieves a current value of reference position.

October 30, 2006 16 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 14 Setting and Reading the Motion Parameters


GetFVelocity Retrieves a current value of motor feedback velocity.
GetRVelocity Retrieves a current value of reference velocity.

4.12 Axis/Motor Management

Table 15 Axis/Motor Management


Enable Activates an axis.
EnableM Activates several axes.
Disable Shuts off an axis.
DisableAll Shuts off all axes.
DisableExt Shuts off an axis and defines the disable reason.
DisableM Shuts off several axes.
Group Creates a coordinate system for a multi-axis motion.
Split Breaks down a previously created axis group.
SplitAll Breaks down all previously created axis groups.

4.13 Motion Management

Table 16 Motion Management


Go Starts up a motion that is waiting in the specified motion
queue.
GoM Synchronously starts up several motions that are waiting in
the specified motion queues.
Halt Terminates a motion using the full deceleration profile.
HaltM Terminates several motions using the full deceleration
profile.
Kill Terminates a motion using the reduced deceleration
profile.
KillAll Terminates all currently executed motions.
KillM Terminates several motions using the reduced deceleration
profile.
KillExt Terminates a motion using reduced deceleration profile
and defines the kill reason.
Break Terminates a motion immediately and provides a smooth
transition to the next motion.
BreakM Terminates several motions immediately and provides a
smooth transition to the next motions.

October 30, 2006 17 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

4.14 Point-to-Point Motion

Table 17 Point-to-Point Motion


ToPoint Initiates a single-axis motion to the specified point.
ToPointM Initiates a multi-axis motion to the specified point.
ExtToPoint Initiates a single-axis motion to the specified point using
the specified velocity or end velocity.
ExtToPointM Initiates a multi-axis motion to the specified point using the
specified velocity or end velocity.

4.15 Track Motion Control

Table 18 Track Motion Control


Track The method initiates a single-axis track motion.

4.16 Jog

Table 19 Jog
Jog Initiates a single-axis jog motion.
JogM Initiates a multi-axis jog motion.

4.17 Slaved Motion

Table 20 Slaved Motion


SetMaster Initiates calculation of a master value for an axis.
Slave Initiates a master-slave motion.
SlaveStalled Initiates master-slave motion with limited following area.

October 30, 2006 18 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

4.18 Multi-Point Motion

Table 21 Multi-Point Motion


MultiPoint Initiates a single-axis multi-point motion.
MultiPointM Initiates a multi-axis multi-point motion.

4.19 Arbitrary Path Motion

Table 22 Arbitrary Path Motion


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

4.20 PVT Methods

Table 23 PVT Methods


AddPVPoint Adds a point to a single-axis multi-point or spline motion.
AddPVPointM Adds a point to a multi-axis multi-point or spline motion.
AddPVTPoint Adds a point to a single-axis multi-point or spline motion.
AddPVTPointM Adds a point to a multi-axis multi-point or spline motion.

4.21 Segmented Motion

Table 24 Segmented Motion (page 1 of 2)


Segment Initiates a multi-axis segmented motion.
Line1 Adds a linear segment to a segmented motion.
ExtLine Adds a linear segment to a segmented motion and specifies
a motion velocity.
Arc1 Adds an arc segment to a segmented motion and specifies
the coordinates of center point, coordinates of the final
point, and the direction of rotation.
ExtArc1 Adds an arc segment to a segmented motion and specifies
the coordinates of center point, coordinates of the final
point, direction of rotation, and the vector velocity for the
current segment.
Arc2 Adds an arc segment to a segmented motion and specifies
the coordinates of center point and rotation angle.

October 30, 2006 19 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 24 Segmented Motion (page 2 of 2)


ExtArc2 Add’s an arc segment to a segmented motion and specifies
the coordinates of center point, rotation angle, and the
vector velocity for the current segment.
Stopper Provides a smooth transition between two segments of
segmented motion.
Projection Sets a projection matrix for a segmented motion.

4.22 Points and Segments Manipulation

Table 25 Points and Segments Manipulation


AddPoint Adds a point to a single-axis multi-point or spline motion.
MAddPointM Adds a point to a multi-axis multi-point or spline motion.
ExtAddPoint Adds a point to a single-axis multi-point or spline motion
and specifies a specific velocity or motion time.
ExtAddPointM Adds a point to a multi-axis multi-point or spline motion
and specifies a specific velocity or motion time.
EndSequence Informs the controller that no more points will be specified
for the current single-axis motion.
EndSequenceM Informs the controller that no more points or segments will
be specified for the current multi-axis motion.

4.23 Data Collection

Table 26 Data Collection


CollectB Initiates data collection.
StopCollect Terminates data collection.

4.24 Status Report

Table 27 Status Report


GetMotorState Retrieves the current motor state.
GetAxisState Retrieves the current axis state.
GetIndexState Retrieves the current state of the index and mark variables.
ResetIndexState Resets the specified bit of the index/mark state.
GetProgramState Retrieves the current state of the program buffer.

October 30, 2006 20 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

4.25 Inputs/Outputs Access

Table 28 Inputs/Outputs Access


GetInput Retrieves the current state of the specified digital input.
GetInputPort Retrieves the current state of the specified digital input port.
GetOutput Retrieves the current state of the specified digital output.
GetOutputPort Retrieves the current state of the specified digital output
port.
SetOutput Sets the specified digital output to the specified value.
SetOutputPort Sets the specified digital output port to the specified value.
GetAnalogInput Retrieves the current numerical value of the specified analog
inputs.
GetAnalogOutput Retrieves the current numerical value of the specified analog
outputs.
SetAnalogOutput Writes the current numerical value to the specified analog
outputs.
GetExtInput Retrieves the current state of the specified extended input.
GetExtInputPort Retrieves the current state of the specified extended input
port.
GetExtOutput Retrieves the current state of the specified extended output.
GetExtOutputPort Retrieves the current state of the specified extended output
port.
SetExtOutput Sets the specified extended output to the specified value.
SetExtOutputPort Sets the specified extended output port to the specified
value.

4.26 Safety Control

Table 29 Safety Control (page 1 of 2)


GetFault Retrieves the set of bits that indicate the motor or system
faults.
SetFaultMask Sets the mask, that enables/disables the examination and
processing of the controller faults.
GetFaultMask Retrieves the mask that defines which controller faults are
examined and processed.
EnableFault Enables the specified axis or system fault.
DisableFault Disables the specified axis or system fault.
SetResponseMask Sets the mask that defines for which axis or system faults
the controller provides default response.

October 30, 2006 21 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 29 Safety Control (page 2 of 2)


GetResponseMask Retrieves the mask that defines for which axis or system
faults the controller provides default response.
EnableResponse Enables the default response to the specified axis or system
fault.
DisableResponse Disables the default response to the specified axis or
system fault.
GetSafetyInput Retrieves the current state of the specified safety input.
GetSafetyInputPort Retrieves the current state of the specified safety input port.
GetSafetyInputPortInv Retrieves the set of bits that define inversion for the
specified safety input port.
SetSafetyInputPortInv Sets the set of bits that define inversion for the specified
safety input port.
FaultClear The method clears the current faults and results of previous
faults stored in the MERR variable.
FaultClearM The method clears the current faults and results of previous
faults stored in the MERR variable for multiple axis.

4.27 Wait-for-Condition Methods

Table 30 Wait-for-Condition Methods


WaitMotionEnd Waits for the end of a motion.
WaitLogicalMotionEnd Waits for the logical end of a motion.
WaitCollectEnd Waits for the end of data collection.
WaitProgramEnd Waits for the program termination in the specified buffer.
WaitMotorEnabled Waits for the specified state of the specified motor.
WaitInput Waits for the specified state of the specified digital input.

4.28 Event and Interrupt Handling

Table 31 Event and Interrupt Handling


EnableEvent Enables ActiveX event generation for the specified
interrupt condition.
DisableEvent Disables ActiveX event generation for the specified
interrupt condition.
SetInterruptMask Sets the mask for the specified interrupt.
GetInterruptMask Retrieves the mask for the specified interrupt.

October 30, 2006 22 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

4.29 Variables Management

Table 32 Variables Management


DeclareVariable Creates the persistent global variable.
ClearVariables Deletes all persistent global variables.

4.30 Service Methods

Table 33 Service Methods


GetFirmwareVersion Retrieves the firmware version of the controller.
GetSerialNumber Retrieves the controller serial number.

4.31 Error Diagnosis

Table 34 Error Diagnosis


GetMotorError Retrieves the reason why the motor was disabled.
GetMotionError Retrieves the termination code of the last executed motion
of the specified axis.
GetProgramError Retrieves the error code of the last program error
encountered in the specified buffer.
ParseCOMErrorCode Parses the SPiiPlus error code and components of
HRESULT.

4.32 Dual Port RAM (DPRAM) Access Methods

Table 35 Dual Port RAM (DPRAM) Access Methods


ReadDPRAMInteger Reads 32-bit integer from DPRAM
WriteDPRAMInteger Writes 32-bit integer to DPRAM
ReadDPRAMReal Reads 64 real from DPRAM
WriteDPRAMReal Writes 64-bit real to DPRAM

4.33 Position Event Generation (PEG) Methods

Table 36 Position Event Generation (PEG) Methods (page 1 of 2)


PegI Sets incremental PEG
PegR Sets random PEG

October 30, 2006 23 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 36 Position Event Generation (PEG) Methods (page 2 of 2)


AssignPins 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.
StopPeg Stops PEG

October 30, 2006 24 Methods Overview


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5 Detailed Method Descriptions


This section describes each of the methods available in the SPiiPlus COM Library. The
methods are ordered alphabetically for easy use.
For each method there is a:
• Name and brief description
• Syntax example where object is a placeholder for a valid object name.
• Parameters-Definition of parameters. Parameters that are sent with the method are defined
as type [in], and parameters that receive a value from the method are defined as [out].
• Return Value
• Remarks
• Example - A short Visual Basic code example.

5.1 AddPoint
Adds a point to a single axis multi-point or spline motion.

Syntax
object.AddPoint(Axis, Point)

Parameters
Name Type Description
Axis [in] long Axis
Point [in] double Coordinate of the added point

Return Value
None.

Remarks
The method adds a point to a single-axis multi-point or spline motion. To add a point to a multi-
axis motion, use AddPVPointM. To add a point with a specified non-default velocity 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.

October 30, 2006 25 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub AddPoint_Sample()
Dim Str(1) As String

On Error GoTo except 'Enable axis X


Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X enabled during 5
secCall Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Create multi-point motion with
'default velocity and dwell 1 ms
Call Ch.MultiPoint(0, Ch.ACSC_AXIS_X, 1)'Add some points
For Index = 0 To 5 'Add points to axis X
Call Ch.AddPoint(Ch.ACSC_AXIS_X, 100 * Index)
Next Index 'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
yErrorMsg 'See Error Handling in Visual Basic
End Sub

5.2 MAddPointM
Adds a point to a multi-axis multi-point or spline motion.

Syntax
object.AddPointM(Axes, Point)

October 30, 2006 26 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axes [in] variant Array of involved axes. Each element specifies an
involved axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] variant Array of the coordinates of added point. The number
and order of values must correspond to the Axes array.
The Point must specify a value for each element of
Axes except the last –1 element.

Return Value
None.

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except 'Enable axes XY

October 30, 2006 27 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 XY
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

5.3 AddPVPoint
The method adds a point to a single-axis PV spline motion and specifies velocity.
object.AddPVPoint(Axis, Point, Velocity)

Parameters
Name Type Description
Axis [in] long ACSC_AXIS_X corresponds to X, ACSC_AXIS_Y –
to Y etc.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] double Coordinate of the added point.
Velocity [in] double Desired velocity at the point

Return Value
None.

Remarks
Before this method can be used, initiate PV spline motion by calling Spline with the appropriate
flags.

October 30, 2006 28 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X, 500)
'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 20000 * Index 'Position and velocity for each point
'of axis X
Call Ch.AddPVPoint(Ch.ACSC_AXIS_X, 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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.4 AddPVPointM
Adds a point to a multiple-axis PV spline motion and specifies velocity.

October 30, 2006 29 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.AddPVPointM(Axis, Point, Velocity)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] variant Array of the coordinates of added point. The number
and order of values must correspond to the Axes array.
The Point must specify a value for each element of
Axes except the last –1 element.
Velocity [in] variant Array of the velocities of added point. The number and
order of values must correspond to the Axes array. The
Velocity must specify a value for each element of Axes
except the last –1 element.

Return Value
None.

Remarks
Before this method can be used, PVT spline motion must be initiated by calling SplineM with
the appropriate flags.
The method adds a point to a multiple-axis PV spline motion with a uniform time and specified
velocity at that point.
To add a point to a single-axis PV motion, use AddPVPoint. To add a point to a PVT motion
with non-uniform time interval, use the AddPVTPoint and AddPVTPointM methods.
The method waits for the controller response.
The controller response indicates that the 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.

October 30, 2006 30 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub AddPVPointM_Sample()
Dim Index As Long
Dim Points(1) As Double
Dim Axes(2) As String
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except 'Enable axes XY
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

5.5 AddPVTPoint
Adds a point to a single-axis PVT spline motion and specifies velocity and motion time.

Syntax
object.AddPVTPoint(Axis, Point, Velocity, TimeInterval)

Parameters
Name Type Description

October 30, 2006 31 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axis [in] long ACSC_AXIS_X corresponds to X, ACSC_AXIS_Y –


to Y etc.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] double Coordinate of the added point.
Velocity [in] double Desired velocity at the point
TimeInterval [in] double If the motion was activated by the Spline method with
the ACSC_AMF_VARTIME flag, this parameter
defines the time interval between the previous point
and the present one.

Return Value
None.

Remarks
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 X
Call Ch.Enable(Ch.ACSC_AXIS_X) 'Wait axis X enabled during 5 sec

October 30, 2006 32 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 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_X, 0) 'Add some points
For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 200 * Index 'Position, velocity and time
interval
'of 500 ms for each point

Call Ch.AddPVTPoint(Ch.ACSC_AXIS_X, Points(0), Points(1), 500)


Next Index 'Finish the motion
'End of the arbitrary path motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.6 AddPVTPointM
Adds a point to a multiple-axis PVT spline motion and specifies velocity and motion time.

Syntax
object.AddPVTPointM(Axis, Point, Velocity, TimeInterval)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

October 30, 2006 33 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Point [in] variant Array of the coordinates of added point. The number
and order of values must correspond to the Axes array.
The Point must specify a value for each element of
Axes except the last –1 element.
Velocity [in] variant Array of the velocities of added point. The number and
order of values must correspond to the Axes array. The
Velocity must specify a value for each element of Axes
except the last –1 element.
TimeInterval [in] double If the motion was activated by the SplineM method
with the ACSC_AMF_VARTIME flag, this parameter
defines the time interval between the previous point
and the present one.

Return Value
None.

Remarks
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)

October 30, 2006 34 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Enable axes XY
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

5.7 AppendBuffer
The method appends one or more ACSPL+ lines to the program in the specified buffer.

Syntax
object.AppendBuffer(Buffer, Program, Count)

Parameters
Name Type Description
Buffer [in] long Number of a program buffer in the controller.
Program [in] string ACSPL+ program.

Return Value
None.

October 30, 2006 35 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 x;jog x;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

5.8 Arc1
Adds an arc segment to a segmented motion and specifies the coordinates of the center point,
the coordinates of the final point and the direction of rotation.

Syntax
object.Arc1(Axes, Center, FinalPoint, Rotation)

Parameters
Name Type Description

October 30, 2006 36 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Center [in] variant Array of the center coordinates. The number and order
of values must correspond to the Axes array. The
Center must specify a value for each element of the
Axes except the last–1 element.
FinalPoint [in] variant Array of the final point coordinates. The number and
order of values must correspond to the Axes array. The
FinalPoint must specify a value for each element of
Axes except the last –1 element.
Rotation [in] long This parameter defines the direction of rotation. If
Rotation is set to ACSC_COUNTERCLOCKWISE,
then the rotation is counterclockwise. If Rotation is set
to ACSC_CLOCKWISE, then rotation is clockwise.

Return Value
None.

Remarks
The method adds an arc segment to the segmented motion and specifies the coordinates of the
center point, the coordinates of the final point and the direction of rotation. To add an arc
segment with a specified non-default velocity, use ExtArc1.
All axes specified in the Axes array must be specified before the call of the Segment method.
The number and order of the axes in the Axes array must correspond exactly to the number and
order of the axes of the Segment method.
The parameter Center specifies the coordinates of the arc center. The parameter FinalPoint
specifies the coordinates of the final point. All coordinates are absolute in the plane.
The method waits for the controller response.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can
call this method periodically until the method returns non-zero value.
If the method fails, the Error object is filled with the error description.

October 30, 2006 37 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub Arc1_Sample()
Dim Point(1) As Double
Dim Center(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Create segmented motion, coordinates of
the
'initial point are (1000,1000)
Point(0) = 1000
Point(1) = 1000
'enable axes XY
Call Ch.EnableM(Axes)
Call Ch.Segment(0, Axes, Point)
'Describe circle with center (1000, 0),
'final point (1000, -1000), clockwise
'rotation
Center(0) = 1000
Center(1) = 0

Point(0) = 1000
Point(1) = -1000
Call Ch.Arc1(Axes, Center, Point, Ch.ACSC_CLOCKWISE)
'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

5.9 Arc2
Adds an arc segment to a segmented motion and specifies the coordinates of the center point
and the rotation angle.

October 30, 2006 38 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.Arc2(Axes, Center, Angle)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Center [in] variant Array of the center coordinates. The number and order
of values must correspond to the Axes array. The
Center must specify a value for each element of Axes
except the last –1 element.
Angle [in] double Rotation angle in radians. Positive angle for
counterclockwise rotation, negative for clockwise
rotation.

Return Value
None.

Remarks
The method adds an arc segment to the segmented motion and specifies the coordinates of the
center point and the rotation angle. To add an arc segment with a specified non-default velocity,
use ExtArc2
All axes specified in the Axes array must be specified before the call of the Segment method.
The number and order of the axes in the Axes array must correspond exactly to the number and
order of the axes of the Segment method.
The parameter Center specifies the coordinates of the arc center. The coordinates are absolute
in the plane.
The method waits for the controller response.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can
call this method periodically until the method returns a non-zero value.
If the method fails, the Error object is filled with the error description.

October 30, 2006 39 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub Arc2_Sample()
Dim Point(1) As Double
Dim Center(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Create segmented motion, coordinates of
the
'initial point are(1000,1000)
Point(0) = 1000
Point(1) = 1000
'enable axes XY
Call Ch.EnableM(Axes)
Call Ch.Segment(0, Axes, Point)
'Describe circle with center (1000, 0),
full
'circle
Center(0) = 1000
Center(1) = 0
Call Ch.Arc2(Axes, Center, -2 * 3.141529)
'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

5.10 AssignPins
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(Axis, Mask)

October 30, 2006 40 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axis [in] long PEG axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Mask [in] short 16-bit mask defines pins state.

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 SPiiPlus
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 X PEG
Call Ch.AssignPins(Ch.ACSC_AXIS_X, 256)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.11 Break
Terminates a motion immediately and provides a smooth transition to the next motion.
object.Break(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

October 30, 2006 41 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait axis X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Start up the motion of axis X to point
'10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_X, 10000)
'Executing of break to axis X
Call Ch.Break(Ch.ACSC_AXIS_X)
'Change the end of the point to point 0
'on the fly

October 30, 2006 42 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_X, 0)


'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.12 BreakM
Terminates several motions immediately and provides a smooth transition to the next motions.

Syntax
object.BreakM(Axes)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

Remarks
The method terminates the executed motions that involve the specified axes. Only those
motions are terminated that have the next motion waiting in the corresponding motion queue.
The terminated motions can be either single-axis or multi-axis.
If a motion queue contains no waiting motion, the break command does not immediately affect
the corresponding axis. The current motion continues instead until the next motion is planned
to the same motion queue. Only then, the break command is executed.
If no executed motion involves the specified axis, or the corresponding motion finishes before
the next motion is planned, the method does not affect the axis.
When executing the break command, the controller terminates the motion immediately without
any deceleration profile. Instead, the controller builds a smooth third-order transition profile to
the next motion.

October 30, 2006 43 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
Axes(3) = Ch.ACSC_AXIS_T
Axes(4) = Ch.ACSC_AXIS_A
Axes(5) = Ch.ACSC_AXIS_B
Axes(6) = Ch.ACSC_AXIS_C
Axes(7) = Ch.ACSC_AXIS_D
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

October 30, 2006 44 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Points(Index) = -10000
Next Index
'Change the end points to point -10000
on the
'fly
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

5.13 CancelOperation
Cancels all operations.

Syntax
object.CancelOperation
Parameters
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

October 30, 2006 45 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.14 CaptureComm
Captures a communication channel.

Syntax
object.CaptureComm

Parameters
None.

Return Value
None.

Remarks
The method captures the communication channel for the calling thread and prevents access to
this communication channel from other threads.
If one thread captures the communication channel and another thread calls one of the SPiiPlus
COM Library methods, the second thread will be delayed until the first thread executes
ReleaseComm.
The method provides the ability to execute a sequence of methods without risk of intervention
from other threads.
If the method fails, the Error object is filled with the error description.

Example

Sub CaptureComm_Sample()
On Error GoTo except
'The method captures a communication
channel
Call Ch.CaptureComm
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

October 30, 2006 46 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.15 ClearBuffer
Deletes the specified ACSPL+ program lines in the specified program buffer.

Syntax
object.ClearBuffer(Buffer, FromLine, ToLine)

Parameters
Name Type Description
Buffer [in] long Buffer number, from 0 to 9.
FromLine, [in] long These parameters specify a range of lines to be deleted.
ToLine FromLine starts from 1.
If ToLine is larger then the total number of lines in the
specified program buffer, the range includes the last
program line.
If ToLine is ACSC_MAX_LINE, the method deletes
all lines in the specified buffer.

Return Value
None.

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 x;jog x;stop" & Chr$(10)
On Error GoTo except
'Appends the line "enable x;jog x;stop"
to
'buffer 0
Call Ch.AppendBuffer(0, StringBuf(1))
'Delete buffer 0 from line 1 to 1000

October 30, 2006 47 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.ClearBuffer(0, 1, 1000)


StringBuf(1) = Ch.UploadBuffer(0)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual BasicEnd
Sub

5.16 ClearVariables
Deletes all persistent global variables.

Syntax
object.ClearVariables

Parameters
None.

Return Value
None.

Remarks
The method deletes all persistent global variables created by the DeclareVariable method.
The method waits for the controller response.
If the method fails, the Error object is filled with the error description.

Example

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

October 30, 2006 48 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.17 CloseComm
The method closes communication via the specified communication channel.

Syntax
object.CloseComm()

Parameters
None.

Return Value
None.

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

Example

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

5.18 CloseHistoryBuffer
Closes the history buffer and discards all stored history.

October 30, 2006 49 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.CloseHistoryBuffer()

Parameters
None.

Return Value
None.

Remarks
The method closes the history buffer and releases the used memory. All information stored in
the buffer is discarded.
If the method fails, the Error object is filled with the error description.

Example

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

5.19 CloseLogFile
The method closes the log file.

Syntax
object.CloseLogFile()

Parameters
None.

Return Value
None.

Remarks
An application must always call CloseLogFile before it exits. Otherwise, the data written to the
file might be lost.

October 30, 2006 50 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 BasicEnd Sub

5.20 CloseMessageBuffer
The method closes the messages buffer and discards all stored unsolicited messages.

Syntax
object.CloseMessageBuffer()

Parameters
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.

October 30, 2006 51 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.21 CollectB
The method initiates data collection.

Syntax
object.CollectB(Flags, Array, NSample, Period, Vars)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
ACSC_DCF_TEMPORAL: temporal data collection.
The sampling period is calculated automatically
according to the collection time.
ACSC_DCF_CYCLIC: cyclic data collection uses the
collection array as a cyclic buffer and continues
infinitely. When the array is full, each new sample
overwrites the oldest sample in the array.
Array [in] string Name of the array that stores the collected samples.
The array must be declared as a global variable by an
ACSPL+ program or by the DeclareVariable method.
Nsample [in] long Number of samples to be collected.

October 30, 2006 52 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Period [in] long Sampling period in milliseconds.


If the ACSC_DCF_TEMPORAL flag is specified, this
parameter defines a minimal period.
Vars [in] string The string contains chained names of the variables,
separated by ‘\r’(13) character. The values of these
variables will be collected in the Array. If variable
name specifies an array, the name must be
supplemented with indexes in order to specify one
element of the array.

Return Value
None.

Remarks
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 ≥ than the number of variables in the variable list. The
number of the array columns must be equal 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

Sub CollectB_Sample()
'Matrix consisting of two rows with 1000
'columns each
Dim ArrayName As String
ArrayName = "DCA(2)(1000)"
'Positions of axes X and Y will be
‘collected
Dim Vars As String
Vars = "FPOS(0)” & Chr$(13)& FPOS(1)"
On Error GoTo except

October 30, 2006 53 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'Declare the variable "ArrayName" name


'of data collection array
Call Ch.DeclareVariable(Ch.ACSC_REAL_TYPE, ArrayName)
'Parameters: 0 - system data collection
'ArrayName - name of data collection
'array 1000 - number of samples to be
‘collected
'1 - sampling period 1 millisecond
'Vars - variables to be collected
all Ch.CollectB(0, ArrayName, 1000, 1, Vars)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual BasicEnd
Sub

5.22 Command
The method sends a command to the controller and analyzes the controller response.

Syntax
object.Command(CommandName)

Parameters
Name Type Description
CommandName [in] string The command to be sent.

Return Value
None.

Remarks
The method sends a string containing one or more ACSPL+ commands to the controller. The
method verifies that the controller receives the command but does not return the controller
response. The method is intended for commands where the controller response does not include
any information except the prompt. For commands where the controller response includes some
information, use Transaction.
If the method fails, the Error object is filled with the error description.

October 30, 2006 54 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub Command_Sample()
On Error GoTo except
'Executed controller's command
'Call Ch.Command("enable x")
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.23 CompileBuffer
The method compiles the ACSPL+ program in the specified program buffer(s).

Syntax
object.CompileBuffer(Buffer)

Parameters
Name Type Description
Buffer [in] long Buffer number, from 0 to 9.
Use ACSC_NONE instead of the buffer number, to
compile all programs in all buffers.

Return Value
None.

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

October 30, 2006 55 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.24 DeclareVariable
The method creates the persistent global variable.

Syntax
object.DeclareVariable (Type, Name)

Parameters
Name Type Description
Type [in] long Type of the variable.
For the integer variable the parameter must be
ACSC_INT_TYPE.
For the real variable, the parameter must be
ACSC_REAL_TYPE.
Name [in] string Name of the variable.

Return Value
None.

Remarks
The method creates the persistent global variable specified by the parameter Name of type
specified by the parameter Type. The variable can be used as any other standard or global
variable.

October 30, 2006 56 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

If it is necessary to declare one or two-dimensional array, the parameter 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

ub 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

5.25 Disable
The method shuts off an axis.

Syntax
object.Disable(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
None.

Remarks
The method shuts off a motor. After shutting off the motor cannot follow the reference and
remains at idle.
If the method fails, the Error object is filled with the error description.

October 30, 2006 57 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub Disable_Sample()
On Error GoTo except
'Disable of axis X
Call Ch.Disable(Ch.ACSC_AXIS_X)
'Wait motor X be disable during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 0, 5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.26 DisableAll
The method shuts off all axes.

Syntax
object.DisableAll()

Parameters
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

October 30, 2006 58 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.27 DisableEvent
The method disables ActiveX event generation for the specified interrupt condition.

Syntax
object. DisableEvent (Interrupt)

Parameters
Name Type Description
Interrupt [in], Long Specifies one of the interrupts such as
ACSC_INTR_PEG, ACSC_INTR_MARK1 etc. For
the full list of the interrupts, see Section 6.12,
Interrupt Types.

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.

Note
The method can be used only with the PCI communication channel or
the Simulator.

Example

Sub DisableEvent_Sample()
On Error GoTo except
'Disable event PROGRAM_END
Ch. DisableEvent (Ch.ACSC_INTR_PROGRAM_END)
Exit Sub

October 30, 2006 59 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual BasicEnd
Sub

5.28 DisableExt
The method shuts off an axis and defines the disable reason.

Syntax
object.DisableExt(Axis, Reason)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Reason [in] long Integer number that defines the reason of disable. The
specified value is stored in the MERR variable in the
controller and so modifies the state of the disabled
motor.

Return Value
None.

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

October 30, 2006 60 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub DisableExt_Sample()
Dim MyCode As Long
My Code = 10
On Error GoTo except
'Disable of axis X with internal
customer
'code
Call Ch.DisableExt(Ch.ACSC_AXIS_X, MyCode)
'Wait motor X be disable during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 0, 5000)
Exit Sub
except:
ErrorMsg 'See Error Handling in Visual Basic
End Sub

5.29 DisableFault

Certain controller faults provide protection against potential


serious bodily injury and damage to equipment. Be aware of
the implications before disabling any alarm, limit, or error.

The method disables the specified axis or system fault.

Syntax
object.DisableFault(Axis, Fault)

October 30, 2006 61 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to
disable the motor faults or ACSC_NONE to disable the
system faults.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Fault [in] long The fault to be disabled. Only one fault can be disabled
at a time.
To specify the fault, one of the properties
ACSC_SAFETY_*** can be used. See Section 6.11,
Safety Control Masks for a detailed description of
these properties.

Return Value
None.

Remarks
The method disables the examination and processing of the specified motor or system fault by
setting the specified bit of the fault mask to zero.
The motor faults are related to a specific motor, the power amplifier, and the Servo processor.
For example: Position Error, Encoder Error, and Driver Alarm.
The system faults are not related to any specific motor, for example: Emergency Stop, Memory
Fault.
For more information about the controller faults, see SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub DisableFault_Sample()
On Error GoTo except
'Disable fault Software Right Limit in
axis X
Call Ch.DisableFault(Ch.ACSC_AXIS_X, Ch.ACSC_SAFETY_RL)
Exit Sub

October 30, 2006 62 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.30 DisableM
The method shuts off several axes.

Syntax
object.DisableM(Axes)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

Remarks
The method shuts off several axes. After the shutting off, the axes cannot follow the
corresponding reference and remain idle.
If the method fails, the Error object is filled with the error description.

Example

Sub DisableM_Sample()
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Disable axes X and Y
Call Ch.DisableM(Axes)
Exit Sub

October 30, 2006 63 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.31 DisableResponse

Certain controller faults provide protection against potential


serious bodily injury and damage to equipment. Be aware of
the implications before disabling any alarm, limit, or error.

The method disables the default response to the specified axis or system fault.

Syntax
object.DisableResponse(Axis, Response)

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to
disable the default response to the specified motor
fault, or ACSC_NONE to disable response to the
specified system fault.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Response [in] long The response to be disabled. Only one default response
can be disabled at a time.
To specify the fault, one of the properties
ACSC_SAFETY_*** can be used. See Section 6.11,
Safety Control Masks for a detailed description of
these properties.

Return Value
None.

Remarks
The method disables the default response to the specified motor or system fault by setting the
specified bit of the response mask to zero.

October 30, 2006 64 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see SPiiPlus ACSPL+
Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub DisableResponse_Sample()
On Error GoTo except
'Disable the default response to the
Right
'Limit fault
Call Ch.DisableResponse(Ch.ACSC_AXIS_X, Ch.ACSC_SAFETY_RL)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual BasicEnd
Sub

5.32 Enable
The method activates an axis.

Syntax
object.Enable(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
None.

Remarks
The method activates an axis. After activation, the axis begins to follow the reference and
physical motion is available.
If the method fails, the Error object is filled with the error description.

October 30, 2006 65 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub Enable_Sample()
On Error GoTo except
'Enable axis X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
Exit Sub

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.33 EnableEvent
The method enables ActiveX event generation for the specified interrupt condition.

Syntax
object. EnableEvent (Interrupt)

Parameters
Name Type Description
Interrupt [in], Long Specifies one of the interrupts such as
ACSC_INTR_PEG, ACSC_INTR_MARK1 etc. For
the full list of the interrupts, see Section 6.12,
Interrupt Types.

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 Chapter 7, Events.
The bit-mapped event parameter Param identifies which axis/buffer/input the interrupt was
generated for. See Section 6.13, Interrupt Masks for a detailed description of the parameter
Param for each interrupt.

October 30, 2006 66 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 parameter Interrupt equal
to the specified interrupt type.
If the method fails, the Error object is filled with the error description.

Note
The method can be used only with the PCI communication channel or
the Simulator.
Before the PEG interrupts can be detected, the AssignPins method
must be called.

Example

'Sub EnableEvent_Sample()
Private Sub ChWithEvents_ACSPLPROGRAM(ByVal Param As Long)
MsgBox "Parameter=" & Param, vbExclamation, "ACSPLPROGRAM"
End Sub

October 30, 2006 67 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.34 EnableFault
The method enables the specified axis or system fault.

Syntax
object.EnableFault(Axis, Fault)

Parameters
Name Type Description

October 30, 2006 68 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axis [in] long The parameter specifies the axis (ACSC_AXIS_X


corresponds to X, ACSC_AXIS_Y – to Y etc.) to
enable the motor fault or ACSC_NONE to enable the
system fault.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Fault [in] long The fault to be enabled. Only one fault can be enabled
at a time.
To specify the fault, one of the properties
ACSC_SAFETY_*** can be used. See Section 6.11,
Safety Control Masksfor a detailed description of
these properties.

Return Value
None.

Remarks
The method enables the examination and processing of the specified motor or system fault by
setting the specified bit of the fault mask to one.
The motor faults are related to a specific motor, the power amplifier, and the Servo processor.
For example: Position Error, Encoder Error, and Driver Alarm.
The system faults are not related to any specific motor. For example: Emergency Stop, Memory
Fault.
For more information about the controller faults, see SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub EnableFault_Sample()
On Error GoTo except
'Enable fault Right Limit of axis X
Call Ch.EnableFault(Ch.ACSC_AXIS_X, Ch.ACSC_SAFETY_RL)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.35 EnableM
The method activates several motors.

Syntax
object.EnableM(Axes)

October 30, 2006 69 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

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

Example

Sub EnableM_Sample()
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Enable of axes X and Y
Call Ch.EnableM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.36 EnableResponse
The method enables the response to the specified axis or system fault.

Syntax
object.EnableResponse(Axis, Response)

October 30, 2006 70 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to
enable the response to the specified motor fault, or
ACSC_NONE to enable the response to the specified
system fault.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Response [in] long The default response to be enabled. Only one default
response can be enabled at a time.
To specify the default response, one of the properties
ACSC_SAFETY_*** can be used. See Section 6.11,
Safety Control Masks for a detailed description of
these properties.

Return Value
None.

Remarks
The method enables the default response to the specified axis or system fault by setting the
specified bit of the response mask to one.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see SPiiPlus ACSPL+
Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub EnableResponse_Sample()
On Error GoTo except
'Enable the default response to the
'Position Error fault of axis X
Call Ch.EnableResponse(Ch.ACSC_AXIS_X, Ch.ACSC_SAFETY_PE)
Exit Sub
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

except:

October 30, 2006 71 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.37 EndSequence
The method informs the controller that no more points will be specified for the current single-
axis motion.

Syntax
object.EndSequence(Axis)

Parameters
Name Type Description
Axis [in] long [in] Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

Remarks
The motion finishes when the EndSequence method is executed. If the call of EndSequence
is omitted, the motion will stop at the last point of the sequence and wait for the next point. No
transition to the next motion in the motion queue will occur until the EndSequence method
executes.
The method waits for the controller response.
This method applies to the single-axis multi-point or spline (arbitrary path) motions.
If the method fails, the Error object is filled with the error description.

Example

Sub EndSequence_Sample()
Dim Index As Long
On Error GoTo except
'Enable axis X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Create multi-point motion with default
'velocity and dwell 1 ms

October 30, 2006 72 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.MultiPoint(0, Ch.ACSC_AXIS_X, 1)


'Add some points
For Index = 0 To 5
Call Ch.AddPoint(Ch.ACSC_AXIS_X, 100 * Index)
Next Index
'Finish the motion
'End of the multi-point motion of axis X
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual BasicEnd
Sub

5.38 EndSequenceM
The method informs the controller that no more points or segments will be specified for the
current multi-axis motion.

Syntax
object.EndSequence(Axes)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

Remarks
The motion finishes when the EndSequenceM method is executed. If the call of
EndSequenceM is omitted, the motion will stop at the last point or segment of the sequence
and wait for the next point. No transition to the next motion in the motion queue will occur until
the EndSequenceM method executes.
The method waits for the controller response.

October 30, 2006 73 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Enable axes X and Y
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 X
and
'Y
Call Ch.EndSequenceM(Axes)

Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

October 30, 2006 74 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.39 ExtAddPoint
The method adds a point to a single-axis multi-point or spline motion and specifies a specific
velocity or motion time.

Syntax
object.ExtAddPoint(Axis, Point, Rate)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Point [in] double Coordinate of the added point.
Rate [in] double If the motion was activated by the MultiPoint method
with the ACSC_AMF_VELOCITY flag, this
parameter defines the motion velocity.
If the motion was activated by the Spline method with
the ACSC_AMF_VARTIME flag, this parameter
defines the time interval between the previous point
and the present one.

Return Value
None.

Remarks
The method adds a point to a single-axis multi-point motion with specific velocity or to single-
axis spline motion with a non-uniform time.
To add a point to a multi-axis motion, use ExtAddPointM. To add a point to a motion with
default velocity or uniform time interval, the AddPoint and MAddPointM 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.

October 30, 2006 75 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub ExtAddPoint_Sample()
On Error GoTo except
'Enable axis X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 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_X, 1)
'Add some points
For Index = 0 To 5
'Adds points to axis X, defines a motion
'velocity of 5000
Call Ch.ExtAddPoint(Ch.ACSC_AXIS_X, 100 * Index, 5000)
Next Index
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual BasicEnd Sub

5.40 ExtAddPointM
Adds a point to a multi-axis multi-point or spline motion and specifies a specific velocity or
motion time.

Syntax
object.ExtAddPointM(Axes, Point, Rate)

Parameters
Name Type Description

October 30, 2006 76 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] variant Array of the coordinates of added point. The number
and order of values must correspond to the Axes array.
The Point must specify a value for each element of
Axes except the last –1 element.
Rate [in] double If the motion was activated by the MultiPoint method
with the ACSC_AMF_VELOCITY flag, this
parameter defines as motion velocity.
If the motion was activated by the Spline method with
the ACSC_AMF_VARTIME flag, this parameter
defines as time interval between the previous point and
the present one.

Return Value
None.

Remarks
The method adds a point to a multi-axis multi-point or spline motion. To add a point to a single-
axis motion, 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)

October 30, 2006 77 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Enable axes X and Y
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 XY, 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

5.41 ExtArc1
Adds an arc segment to a segmented motion and specifies the coordinates of the center point,
the coordinates of the final point, the direction of rotation, and the vector velocity for the current
segment.

Syntax
object.ExtArc1(Axes, Center, FinalPoint, Rotation, Velocity)

October 30, 2006 78 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Center [in] variant Array of the center coordinates. The number and order
of values must correspond to the Axes array. The
Center must specify a value for each element of Axes
except the last –1 element.
FinalPoint [in] variant Array of the final point coordinates. The number and
order of values must correspond to the Axes array. The
FinalPoint must specify a value for each element of
Axes except the last –1 element.
Rotation [in] long This parameter defines the direction of rotation. If
Rotation is set to ACSC_COUNTERCLOCKWISE,
then the rotation is counterclockwise; if Rotation is set
to ACSC_CLOCKWISE, then rotation is clockwise.
Velocity [in] double If the motion was activated by the Segment method
with the ACSC_AMF_VELOCITY flag, this
parameter specifies a motion velocity for current
segment.

Return Value
None.

Remarks
The method adds an arc segment to the segmented motion and specifies the coordinates of the
center point, the coordinates of the final point, the direction of rotation, and the vector velocity
for the current segment. To add an arc segment with default velocity, use Arc1.
All axes specified in the Axes array must be specified before calling the Segment method. The
number and order of the axes in the Axes array must correspond exactly to the number and
order of the axes of Segment method.
The parameter Center specifies the coordinates of the arc center. The parameter FinalPoint
specifies the coordinates of the final point. All coordinates are absolute in the plane.
The method waits for the controller response.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can
call this method periodically until the method returns non-zero value.

October 30, 2006 79 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

If the method fails, the Error object is filled with the error description.

Example

Sub ExtArc1_Sample()
'The path of the specified segmented
motion
'is circle
'for each semicircle the different
'vector velocity is used
Dim Points(1) As Double
Dim Center(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Create segmented motion, coordinates of
the
'initial points are (1000,1000)
Points(0) = 1000
Points(1) = 1000
'Enable axes XY
Call Ch.EnableM(Axes)
Call Ch.Segment(Ch.ACSC_AMF_VELOCITY, Axes, Points)
'Describe circle with center (1000, 0),
'final point (1000, -1000), clockwise
'rotation with vector velocity 25000
Center(0) = 1000
Center(1) = 0
Points(0) = 1000
Points(1) = -1000
Call Ch.ExtArc1(Axes, Center, Points, Ch.ACSC_CLOCKWISE, 25000)
'Finish the motion
'End of the multi-point motion

October 30, 2006 80 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.EndSequenceM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.42 ExtArc2
The method adds an arc segment to a segmented motion and specifies the coordinates of the
center point, the rotation angle, and the vector velocity for the current segment.

Syntax
object.ExtArc2(Axes, Center, Angle, Velocity)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Center [in] variant Array of the center coordinates. The number and order
of values must correspond to the Axes array. The
Center must specify a value for each element of Axes
except the last –1 element.
Angle [in] double Rotation angle in radians. Positive angle for
counterclockwise rotation, negative for clockwise
rotation.
Velocity [in] double If the motion was activated by the Segment method
with the ACSC_AMF_VELOCITY flag, this
parameter specifies a motion velocity for current
segment.

Return Value
None.

October 30, 2006 81 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
The method adds an arc segment to the segmented motion and specifies the coordinates of the
center point, the rotation angle, and the vector velocity for the current segment. To add an arc
segment with default velocity, use Arc2.
All axes specified in the Axes array must be specified before the call of the Segment method.
The number and order of the axes in the Axes array must correspond exactly to the number and
order of axes of the Segment method.
The parameter Center specifies the coordinates of the arc center. The coordinates are absolute
in the plane.
The method waits for the controller response.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can
call this method periodically until the method returns a non-zero value.
If the method fails, the Error object is filled with the error description.

Example

Sub ExtArc2_Sample()
'The path of the specified segmented
motion
'is circle
'for each semicircle the different
vector
'velocity is used
Dim Points(1) As Double
Dim Center(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
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 X and Y

October 30, 2006 82 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.EnableM(Axes)
Call Ch.Segment(Ch.ACSC_AMF_VELOCITY, Axes, Points)
'Describe circle with center (1000, 0),
'final point (1000, 1000),
'Semicircle
Center(0) = 1000
Center(1) = 0
Call Ch.ExtArc2(Axes, Center, 3.141529, 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

5.43 ExtLine
Adds a linear segment to a segmented motion and specifies a motion velocity.

Syntax
object.ExtLine(Axes, Point, Velocity)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

October 30, 2006 83 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Point [in] variant Array of the final point coordinates. The number and
order of values must correspond to the Axes array. The
Point must specify a value for each element of Axes
except the last –1 element.
Velocity [in] double If the motion was activated by the Segment method
with the ACSC_AMF_VELOCITY flag, this
parameter specifies a motion velocity for current
segment.

Return Value
None.

Remarks
The method adds a linear segment to the segmented motion and specifies a motion velocity for
the current segment. To add a linear segment with a default velocity, use Line1. All axes
specified in the Axes array must be specified before the call of the Segment method. The
number and order of the axes in the Axes array must correspond exactly to the number and
order of the axes of the Segment method.
The parameter Point specifies the coordinates of the final point. The coordinates are absolute
in the plane.
The method waits for the controller response.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In that 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 ExtLine_Sample()
'The path of the specified segmented
motion
'is square. For each side of the square
the
'non-default vector velocity is used

October 30, 2006 84 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Dim Points(1) As Double


Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
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 X and Y
Call Ch.EnableM(Axes)
Call Ch.Segment(Ch.ACSC_AMF_VELOCITY, Axes, Points)
'Add line segment to axes XY 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

5.44 ExtToPoint
Initiates a single-axis motion to the specified point using the specified velocity or end velocity.

Syntax
object.ExtToPoint(Flags, Axis, Point, Velocity, EndVelocity)

Parameters
Name Type Description

October 30, 2006 85 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• ACSC_AMF_WAIT: plan the motion but don't
start it until the method Go is executed.
• ACSC_AMF_RELATIVE: the Point value is
relative to the end point of the previous motion. If
the flag is not specified, the Point specifies an
absolute coordinate.
• ACSC_AMF_VELOCITY: the motion will use
velocity specified by the Velocity argument instead
of the default velocity.
• ACSC_AMF_ENDVELOCITY: the motion will
come to the end point with the velocity specified by
the EndVelocity argument.
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Point [in] double Coordinate of the target point.
Velocity [in] double Motion velocity. The argument is used only if the
ACSC_AMF_VELOCITY flag is specified.
EndVelocity [in] double Velocity in the target point. The argument is used only
if the ACSC_AMF_ENDVELOCITY flag is specified.
Otherwise, the motion finishes with zero velocity.

Return Value
None.

Remarks
The method initiates a single-axis point-to-point motion.
If the ACSC_AMF_VELOCITY flag is specified, the motion is executed using the velocity
specified by the Velocity argument. 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 argument. 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.

October 30, 2006 86 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait untill axis X is disabled for 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 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_X - axis X
'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_X, 10000, 5000, 1000)
'Wait motion ends during 20 sec
Call Ch.WaitMotionEnd(Ch.ACSC_AXIS_X, 20000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.45 ExtToPointM
The method initiates a multi-axis motion to the specified point using the specified velocity or
end velocity.

October 30, 2006 87 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.ExtToPointM(Flags, Axes, Point, Velocity, EndVelocity)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• ACSC_AMF_WAIT: plan the motion but don't
start it until the method Go is executed.
• ACSC_AMF_RELATIVE: the Point values are
relative to the end of the previous motion. If the flag
is not specified, the Point specifies absolute
coordinates.
• ACSC_AMF_VELOCITY: the motion will use
velocity specified by the Velocity argument instead
of the default velocity.
• ACSC_AMF_ENDVELOCITY: the motion will
come to the end with the velocity specified by the
EndVelocity argument.
• ACSC_AMF_MAXIMUM: not to use the motion
parameters from the leading axis but to calculate
the maximum allowed motion velocity,
acceleration, deceleration and jerk of the involved
axes.
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] variant Array of the target coordinates. The number and order
of values must correspond to the Axes array. The Point
must specify a value for each element of Axes except
the last –1 element.
Velocity [in] double Motion vector velocity. The argument is used only if
the ACSC_AMF_VELOCITY flag is specified.
EndVelocity [in] double Vector velocity in the target point. The argument is
used only if the ACSC_AMF_ENDVELOCITY is
specified. Otherwise, the motion finishes with zero
velocity.

October 30, 2006 88 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 the Velocity argument. Otherwise, the required motion velocity is used. 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.
If the ACSC_AMF_ENDVELOCITY flag is specified, the motion velocity at the final point is
specified by the EndVelocity argument. 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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Points(0) = 1000
Points(1) = 2000
On Error GoTo except
'Enable axes X and Y
Call Ch.EnableM(Axes)
'Parameters: Ch.ACSC_AMF_VELOCITY Or
'Ch.ACSC_AMF_ENDVELOCITY -
'Start up the motion with specified velocity
‘5000

October 30, 2006 89 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'come to the end point with specified velocity


1000
'Axes - axes XY
'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

5.46 FaultClear
The method clears the current faults and the result of the previous fault stored in the
MERR variable.

Syntax
object.FaultClear(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
None.

Remarks
The method clears the current faults of the specified axis and the result of the previous fault
stored in the MERR variable.
If the method fails, the Error object is filled with the error description.

October 30, 2006 90 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 X
Call Ch.FaultClear(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.47 FaultClearM
The method clears the current faults and results of previous faults stored in the MERR variable
for multiple axis.

Syntax
object.FaultClearM(Axes)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

October 30, 2006 91 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Clears the current faults and results
of
'previous faults stored in the MERR
variable
'of axes XY
Call Ch.FaultClearM(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.48 FlushLogFile
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[in] FileName)

Parameters
Name Type Description
FileName [in] string String that specifies the file name.

Return Value
None.

Remarks
If Continuous Log is active, the function will fail.

October 30, 2006 92 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub FlushLogFile()
Dim
On Error GoTo except
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.49 GetAcceleration
The method retrieves a value of motion acceleration.

Syntax
object.GetAcceleration(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

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 X
Acceleration = Ch.GetAcceleration(Ch.ACSC_AXIS_X)
Exit Sub

October 30, 2006 93 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.50 GetACSCHandle
The method Retrieves the SPiiPlus C Library communication handle.

Syntax
object.GetACSCHandle()

Parameters
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

5.51 GetAnalogInput
The method retrieves the current numerical value of the specified analog inputs.

Syntax
object.GetAnalogInput(Port)

October 30, 2006 94 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Port [in] long Number of the analog inputs port.

Return Value
Long.

Remarks
The method retrieves the current numerical value of the specified analog inputs.
Analog inputs are represented in the controller variable AIN. For more information about analog
inputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub GetAnalogInput_Sample()
Dim Index
Dim Port(15) As Double
On Error GoTo except
For Index = 0 To 15
'The method reads analog inputs of
'port 0 to 15 ( AIN(0)-AIN(15) )
Port(Index) = Ch.GetAnalogInput(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.52 GetAnalogOutput
The method retrieves the current numerical value of the specified analog outputs.

Syntax
object.GetAnalogOutput(Port)

October 30, 2006 95 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Port [in] long Number of the output port.

Return Value
Long.

Remarks
The method retrieves the current numerical value of the specified analog outputs. To write a
value to the specific analog outputs, use the SetAnalogOutput method.
Analog outputs are represented in the controller variable AOUT. For more information about
analog outputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub GetAnalogOutput_Sample()
Dim Index
Dim Port(15) As Long
On Error GoTo except
For Index = 0 To 15
'The method reads analog outputs of port
0
'to 15 ( AOUT(0)-AOUT(15) )
Port(Index) = Ch.GetAnalogOutput(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.53 GetAxisState
The method retrieves the current axis state.

Syntax
object.GetAxisState(Axis)

October 30, 2006 96 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Long.
The method retrieves the current axis state.

Remarks
The return value can be comprised of one or more flags. For example, ACSC_AST_LEAD
(leading axis), ACSC_AST_DC (data collection in progress for the axis), etc. See the complete
list of flags, see Section 6.8, 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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.54 GetCOMLibraryVersion
The method retrieves the SPiiPlus COM Library version number.

Syntax
object.GetCOMLibraryVersion()

Parameters
None.

October 30, 2006 97 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.55 GetCommOptions
The method retrieves the communication options.

Syntax
object.GetCommOptions()

Parameters
None.

October 30, 2006 98 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.56 GetConf
The method reads system configuration data.

Syntax
object.GetConf(Key, Index)

Parameters
Name Type Description

October 30, 2006 99 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Key [in] long Configuration Keys (see Section 6.14) specify the
configured feature. Assigns value of the key argument
in ACSPL+ GetConf method.
Index [in] long Specifies corresponding axis or buffer number.
Assigns value of index argument in ACSPL+ GetConf
method.

Return Value
Double.
The method reads system configuration data.

Remarks
The Key parameter specifies the feature number and the Index parameter defines axis or buffer
to which it should be applied. For detailed description of system configuration see “SPiiPlus
ACSPL+ Programmer’s Guide” getconf definition.
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
X
'with key 205
GetC = Ch.GetConf(Ch.ACSC_CONF_DIGITAL_SOURCE_KEY, Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.57 GetDeceleration
The method retrieves a value of motion deceleration.

Syntax
object.GetDeceleration(Axis)

Parameters

October 30, 2006 100 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Name Type Description


Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Double.
The method retrieves the value of the motion deceleration.

Remarks
The retrieved value is either the value defined by a previous call of the SetDeceleration method
or the default value if SetDeceleration was not previously called.
If the method fails, the Error object is filled with the error description.

Example

Sub GetDeceleration_Sample()
Dim Deceleration As Double
On Error GoTo except
'Retrieves a value of motion
deceleration
Deceleration = Ch.GetDeceleration(Ch.ACSC_AXIS_X)
Exit Sub

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.58 GetDefaultTimeout
The method retrieves default communication timeout.

Syntax
object.GetDefaultTimeout()

Parameters
None.

Return Value
Long.

October 30, 2006 101 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
The value of the default timeout depends on the type of the established communication channel.
Timeout depends also on the baud rate value for serial communication.
If the method fails, the Error object is filled with the error description.

Example

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

5.59 GetEthernetCards
The method retrieves all SPiiPlus controller IP addresses within a local domain through a
standard Ethernet comunication protocol.

Syntax
object.GetEthernetCards(variant) [out] arrIPAddress, string [in,optional]
BroadvcastAddress

Parameters
Name Type Description
arrIPAddress [out] variant Array of stringd with the returned IP addresses
of the controllers
BroadcastAddress [in, optional] string String containing the broadcast mask address.
Optional parameter - can be omitted.

Return Value
Long.
The method returns the number of cards found or zero if no cards are detected.

October 30, 2006 102 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
If more than one controller card is detected, the method initializes arrIPAddress variant 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 paramters.

Example

Sub GetEthernetCards()
Dim
On Error GoTo except

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.60 GetErrorString
The method retrieves the explanation of an error code.

Syntax
object.GetErrorString(ErrorCode)

Parameters
Name Type Description
ErrorCode [in] long An error code returned by the following methods:
ParseCOMErrorCode
GetMotorError
GetMotionError
GetProgramError

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.

October 30, 2006 103 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.61 GetExtInput
The method retrieves the current state of the specified extended input.

Syntax
object.GetExtInput(Port, Bit)

Parameters
Name Type Description
Port [in] long Number of the extended input port.
Bit [in] long Number of the specific bit.

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 SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

October 30, 2006 104 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.62 GetExtInputPort
The method retrieves the current state of the specified extended input port.

Syntax
object.GetExtInputPort(Port)

Parameters
Name Type Description
Port [in] long Number of the extended input port.

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 SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

October 30, 2006 105 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.63 GetExtOutput
The method retrieves the current state of the specified extended output.

Syntax
object.GetExtOutput(Port, Bit)

Parameters
Name Type Description
Port [in] long Number of the extended output port.
Bit [in] long Number of the specific bit.

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 SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

October 30, 2006 106 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.64 GetExtOutputPort
The method retrieves the current state of the specified extended output port.

Syntax
object.GetExtOutputPort(Port)

Parameters
Name Type Description
Port [in] long Number of the extended output port.

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 SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

October 30, 2006 107 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub GetExtOutputPort_Sample()
'The method reads extended output port 0
(
'EXTOUT(0) )
Dim Index As Long
Dim Port(15) As Double
On Error GoTo except
For Index = 0 To 15
Port(Index) = Ch.GetExtOutputPort(Index)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.65 GetFault
The method retrieves the set of bits that indicate the motor or system faults.

Syntax
object.GetFault(Axis)

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to
receive the motor faults or ACSC_NONE to receive the
system faults.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

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.

October 30, 2006 108 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 Section 6.11, Safety Control
Masks for a detailed description of these properties.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer’s
Guide.
If the method fails, the Error object is filled with the error description.

Example

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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.66 GetFaultMask
The method retrieves the mask that defines which controller faults are examined and processed.

Syntax
object.GetFaultMask(Axis, Mask)

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to get
the motor faults mask, or ACSC_NONE to get the
system faults mask.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
Long.
The method retrieves the mask that defines which controller faults are examined and processed.

October 30, 2006 109 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 Section 6.11, Safety
Control Masks for a detailed description of these properties.
Controller faults are of two types: motor faults and system faults.
The motor faults are related to a specific motor, the power amplifier or the Servo processor. For
example: Position Error, Encoder Error or Driver Alarm.
The system faults are not related to any specific motor, for example: Emergency Stop or
Memory Fault.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer’s
Guide.
If the method fails, the Error object is filled with the error description.

Example

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 X
Mask = Ch.GetFaultMask(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.67 GetFirmwareVersion
The method retrieves the firmware version of the controller.

Syntax
object.GetFirmwareVersion()

Parameters
None

Return Value
String.

October 30, 2006 110 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.68 GetFPosition
The method retrieves the current value of the motor feedback position.

Syntax
object.GetFPosition(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

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

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

October 30, 2006 111 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.69 GetFVelocity
The method retrieves the instantaneous value of the motor feedback velocity. Unlike
GetVelocity, this method retrieves the actually measured velocity and not the required value.

Syntax
object.GetFVelocity(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Double.

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

October 30, 2006 112 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.70 GetHistory
The method retrieves the contents of the history buffer.

Syntax
object.GetHistory(bClear)

Parameters
Name Type Description
bClear [in] Boolean If TRUE, the method clears contents of the history
buffer.
If FALSE, the history buffer content is not cleared.

Return Value
String.
The method retrieves the communication history from the history buffer.

Remarks
The communication history includes all commands sent to the controller and all responses and
unsolicited messages from the controller. The amount of history data is limited by the size of
the history buffer. The history buffer works as a cyclic buffer: when the amount of the stored
data exceeds the buffer size, the newly stored data overwrites the earliest data in the buffer.
Therefore, as a rule, the retrieved communication history includes only recent commands,
responses and unsolicited messages. The depth of the retrieved history depends on the history
buffer size.

October 30, 2006 113 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 x"
Call Ch.Send("enable x")
'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

5.71 GetIndexState
The method retrieves the current set of bits that indicate the index and mark state.

Syntax
object.GetIndexState(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Long.
The method retrieves the current set of bits that indicate the index and mark state.

October 30, 2006 114 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.72 GetInput
The method retrieves the current state of the specified digital input.

Syntax
object.GetInput(Port, Bit)

Parameters
Name Type Description
Port [in] long Number of the input port.
Bit [in] long Number of the specific bit.

October 30, 2006 115 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 SPiiPlus 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

5.73 GetInputPort
The method retrieves the current state of the specified digital input port.

Syntax
object.GetInputPort(Port)

Parameters
Name Type Description
Port [in] long Number of the input port.

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.

October 30, 2006 116 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Digital inputs are represented in the controller variable IN. For more information about digital
inputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

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

5.74 GetInterruptMask
The method retrieves the mask for specified interrupt.

Syntax
object.GetInterruptMask(, Mask)

Parameters
Name Type Description
Interrupt [in] long Specifies one of the following interrupts:
• ACSC_INTR_PEG – a position event signal (PEG)
has been generated
• ACSC_INTR_MARK1 – a MARK1 signal has
been generated
• ACSC_INTR_MARK2 – a MARK2 signal has
been generated
• ACSC_INTR_PHYSICAL_MOTION_END – a

October 30, 2006 117 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

• physical motion has finished


• ACSC_INTR_LOGICAL_MOTION_END – a
logical motion has finished
• ACSC_INTR_MOTION_FAILURE – a motion
has been interrupted due to a fault
• ACSC_INTR_MOTOR_FAILURE – a motor has
been disabled due to a fault
• ACSC_INTR_PROGRAM_END – an ACSPL+
program has finished
• ACSC_INTR_COMMAND – a line of ACSPL +
commands has been executed in a dynamic buffer
• ACSC_INTR_INPUT – a digital input has changed
from 0 to 1
• ACSC_INTR_COMMAND – a line of ACSPL +
commands has been executed in a dynamic buffer
• ACSC_INTR_INPUT – a digital input has changed
from 0 to 1
• ACSC_INTR_ACSPL_PROGRAM – an ACSPL+
program has generated the interrupt by
INTERRUPT command
• ACSC_INTR_MOTION_START – motion starts
• ACSC_INTR_MOTION_PHASE_CHANGE –
motion profile changes the phase
• ACSC_INTR_TRIGGER – AST.#TRIGGER bit
goes high
• ACSC_INTR_MESSAGE – communication
interrupt (the controller raises this interrupt after
sending a complete message to the host)

Return Value
Long.
The method retrieves the bit mask for the specified interrupt.

Remarks
To set the mask for a specified interrupt, call SetInterruptMask.
If a bit in the return value equals 0, the interrupt for the corresponding axis/buffer/input is
disabled.
Use the ACSC_MASK_*** properties to find the values of specific bits. See Section 6.13,
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.

October 30, 2006 118 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub GetInterruptMask_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.GetInterruptMask(Ch.ACSC_INTR_PROGRAM_END)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.75 GetJerk
The method retrieves a value of motion jerk.

Syntax
object.GetJerk(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Double.
The method retrieves the value of the motion jerk.

Remarks
The retrieved value is a value defined by a previous call of SetJerk, or the default value if the
method was not called before.
If the method fails, the Error object is filled with the error description.

October 30, 2006 119 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.76 GetKillDeceleration
The method retrieves a value of motion kill deceleration.

Syntax
object.GetKillDeceleration(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Double.
The method retrieves the value of the motion kill deceleration.

Remarks
The retrieved value is a value defined by a previous call of tSetKillDeceleration, or the default
value if the method was not previously called.
If the method fails, the Error object is filled with the error description.

October 30, 2006 120 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.77 GetLibraryVersion
The method retrieves the legacy SPiiPlus C Library version number.

Syntax
object.GetLibraryVersion()

Parameters
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.

October 30, 2006 121 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.78 GetSingleMessage
The method retrieves single unsolicited message from the buffer. This method only works if
you setup a buffer using OpenMessageBuffer. If no message buffer is open, these messages
will be returned by Receive. If there is no message in the buffer the method waits until the
message arrives or time out expires.

Syntax
object.GetSingleMessage(Timeout )

Parameters
Name Type Description
Timeout [in] long Maximum waiting time in milliseconds

Return Value
String.

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

October 30, 2006 122 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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
'from the buffer and wait 1 second till a
'message arrives
Str = Ch.GetSingleMessage(1000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.79 GetMotionError
The method retrieves the termination code of the last executed motion of the specified axis.

Syntax
object.GetMotionError(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
For a multi-axis motion this parameter must
correspond to a leading axis of a group.

October 30, 2006 123 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 SPiiPlus ACSPL+ Programmer’s Guide for all available motion termination codes
description.
If the method fails, the Error object is filled with the error description.

Example

Sub GetMotionError_Sample()
Dim MError As Long
On Error GoTo except
'Retrieves the termination code of the
last
'executed motion of axis X
MError = Ch.GetMotionError(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.80 GetMotorError
The method retrieves the reason for motor disabling.

Syntax
object.GetMotorError(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

October 30, 2006 124 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 “SPiiPlus ACSPL+ Programmer’s Guide” for all available motor error code descriptions.
If the method fails, the Error object is filled with the error description.

Example

Sub GetMotorError_Sample()
Dim MError As Long
On Error GoTo except
'Retrieves the reason for motor
disabling
MError = Ch.GetMotorError(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.81 GetMotorState
The method retrieves the current motor state.

Syntax
object.GetMotorState(Axis, State)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Long.
The method retrieves the current motor state.

October 30, 2006 125 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 X
State = Ch.GetMotorState(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.82 GetOutput
The method retrieves the current state of the specified digital output.

Syntax
object.GetOutput(Port, Bit)

Parameters
Name Type Description
Port [in] long Pointer to a variable that receives the current state of
the specific output. The value will be populated by 0 or
1.
Bit [in] long Number of the specific bit.

Return Value
Long.
The method retrieves the current state (0 or 1) of the specified digital output.

October 30, 2006 126 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
To get values of all outputs of the specific port, use GetExtOutputPort.
Digital outputs are represented in the controller variable OUT. For more information about
digital outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

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

5.83 GetOutputPort
The method retrieves the current state of the specified digital output port.

Syntax
object.GetOutputPort(Port)

Parameters
Name Type Description
Port [in] long Number of the output port.

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 SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

October 30, 2006 127 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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
On Error GoTo except
For Index = 0 To 15
Port(Index) = Ch.GetOutputPort(Index)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.84 GetPCICards
The method retrieves information about the controller cards inserted in the computer PCI Bus.

Syntax
object.GetPCICards(arrBusNumber, arrSlotNumber, arrFunction)

Parameters
Name Type Description
arrBusNumber [out] variant Array of bus numbers that is filled in by the method.
arrSlotNumber [out] variant Array of slot numbers of the controller card
arrFunction [out] variant Array of function of the controller card

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.

October 30, 2006 128 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.85 GetProgramError
The method retrieves the error code of the last program error encountered in the specified
buffer.

Syntax
object.GetProgramError(Buffer)

Parameters
Name Type Description
Buffer [in] long Number of the program buffer.

Return Value
Long.
The method retrieves the error code of the last program error encountered in the specified
buffer.

October 30, 2006 129 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.86 GetProgramState
The method retrieves the current state of the program buffer.

Syntax
object.GetProgramState(Buffer)

Parameters
Name Type Description
Buffer [in] long Number of the buffer.

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

October 30, 2006 130 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

• 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

5.87 GetResponseMask
The method retrieves the mask that defines the motor or the system faults for which the
controller provides the default response.

Syntax
object.GetResponseMask(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Long.

October 30, 2006 131 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 SPiiPlus
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 X
Mask = Ch.GetResponseMask(Ch.ACSC_AXIS_X)
Exit Sub

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

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

Syntax
object.GetRPosition(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Double.
The method retrieves the current value of the motor reference position.

October 30, 2006 132 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.89 GetRVelocity
The method retrieves an instant value of the motor reference velocity.

Syntax
object.GetRVelocity(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Double.
The method retrieves the current value of the motor reference velocity.

Remarks
The reference velocity is a value calculated by the controller in the process of motion
generation.
If the method fails, the Error object is filled with the error description.

October 30, 2006 133 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.90 GetSafetyInput
The method retrieves the current state of the specified safety input.

Syntax
object.GetSafetyInput(Axis, Input)

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to get
the specified safety motor input, or ACSC_NONE to
get the specified system safety input.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Input [in] long The specific safety input.
To specify a desired motor safety input OR
combination of any of the following properties can be
used:
• ACSC_SAFETY_RL
• ACSC_SAFETY_LL
• ACSC_SAFETY_HOT
• ACSC_SAFETY_DRIVE
• ACSC_SAFETY_ES
See Section 6.11, Safety Control Masks for a detailed
description of these properties.

October 30, 2006 134 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 SPiiPlus ACSPL+ Programmer’s Guide.

Note
Some safety inputs can be unavailable in specific controller model. For
example, SPiiPlus SA controller does not provide Motor Overheat,
Preliminary Left Limit, or Preliminary Right Limit safety inputs.
See specific model documentation for details.

If the method fails, the Error object is filled with the error description.

Example

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
X
SInput = Ch.GetSafetyInput(Ch.ACSC_AXIS_X, Ch.ACSC_SAFETY_RL)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.91 GetSafetyInputPort
The method retrieves the current state of the specified safety input port.

Syntax
object.GetSafetyInputPort(Axis)

October 30, 2006 135 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to get
the specified safety motor inputs port, or
ACSC_NONE to get the specified safety system inputs
port.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

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_RL2
• ACSC_SAFETY_LL2
• ACSC_SAFETY_HOT
• ACSC_SAFETY_DRIVE
To recognize a specific system safety input, only ACSC_SAFETY_ES property can be used.
See Section 6.11, Safety Control Masks for a detailed description of these properties.

Remarks
To get the state of the specific safety input of a specific axis, use GetSafetyInput.
Safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more
information about safety inputs, see SPiiPlus ACSPL+ Programmer’s Guide.

Note
Some safety inputs can be unavailable in specific controller model. For
example, SPiiPlus SA controller does not provide Motor Overheat,
Preliminary Left Limit, or Preliminary Right Limit safety inputs.
See specific model documentation for details.

If the method fails, the Error object is filled with the error description.

October 30, 2006 136 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub GetSafetyInputPort_Sample()
Dim SInput As Long
On Error GoTo except
'The method reads safety input port of
the
'axis X
SInput = Ch.GetSafetyInputPort(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.92 GetSafetyInputPortInv
The method retrieves the set of bits that define inversion for the specified safety input port.

Syntax
object.GetSafetyInputPortInv(Axis)

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to get
the inversion for the specified safety motor inputs port,
or ACSC_NONE to get the inversion for the specified
safety system inputs port.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

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_RL2
• ACSC_SAFETY_LL2
• ACSC_SAFETY_HOT

October 30, 2006 137 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

• ACSC_SAFETY_DRIVE
Use the ACSC_SAFETY_ES property to recognize an inversion for the specific system safety
input port,.
See Section 6.11, 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.
The inversions of safety inputs are represented in the controller variables SAFINI and
S_SAFINI. For more information about safety inputs, see the SPiiPlus ACSPL+ Programmer’s
Guide.

Note
Some safety inputs can be unavailable in specific controller model. For
example, SPiiPlus SA controller does not provide Motor Overheat,
Preliminary Left Limit, or Preliminary Right Limit safety inputs.
See specific model documentation for details.
If the method fails, the Error object is filled with the error description.

Example

Sub GetSafetyInputPortInv_Sample()
'The method reads an inversion of safety
'input port of the axis X
Dim State As Long
On Error GoTo except
State = Ch.GetSafetyInputPortInv(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.93 GetSerialNumber
The method retrieves the controller serial number.

Syntax
object.GetSerialNumber()

October 30, 2006 138 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
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:
O MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.94 GetServerExt
The method defines the communication server IP address and specifies the explicit port
number.

Syntax
object.SetSrverExt([in] string IPaddress,[in] long Port)

Parameters
Name Type Description
IPaddress [in] string IP address of the remote UMD. The address must be
the same as the remote UMD dialog.
Port [in} long Port over which the UMD is contacted. The address
must be the same as the remote UMD dialog.

Return Value
None.

October 30, 2006 139 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
This method allows setting the remote UMD port numner in case the default port number on
the remote computer is not available.

Example

5.95 GetTimeout
The method retrieves communication timeout.

Syntax
object.GetTimeout()

Parameters
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

October 30, 2006 140 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.96 GetVelocity
The method retrieves a value of motion velocity.

Syntax
object.GetVelocity(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
Double.
The method retrieves the value of the motion velocity.

Remarks
The retrieved value is the value defined by a previous call of SetVelocity or the default value
if the method was not previously called.
If the method fails, the Error object is filled with the error description.

Example

Sub GetVelocity_Sample()
Dim Velocity As Double
On Error GoTo except
'Retrieves a value of motion velocity of
axis
'X
Velocity = Ch.GetVelocity(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.97 Go
The method starts up a motion waiting in the specified motion queue.

October 30, 2006 141 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.Go(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
None.

Remarks
A motion that was planned with ACSC_AMF_WAIT flag does not start until the Go method is
executed. Being planned, a 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 X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X is enabled during 5
sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Wait till GO command executed on axis
X,
'target position of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_WAIT, Ch.ACSC_AXIS_X, 10000)
'Motion start

October 30, 2006 142 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.Go(Ch.ACSC_AXIS_X)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.98 GoM
The method synchronously starts up several motions that are waiting in the specified motion
queues.

Syntax
object.GoM(Axes)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

Remarks
A motion that was planned with ACSC_AMF_WAIT flag does not start until the GoM method
is executed. After being planned, a 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 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.

October 30, 2006 143 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub GoM_Sample()
Dim Points(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Points(0) = 10000
Points(1) = 10000
On Error GoTo except
'Enable axes X and Y
Call Ch.EnableM(Axes)
'Wait till GO command executed on axes
XY,
'target position of 10000,10000
Call Ch.ToPointM(Ch.ACSC_AMF_WAIT, Axes, Points)
'Start the motion of X and Y
Call Ch.GoM(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

5.99 Group
The method creates a coordinate system for a multi-axis motion.

Syntax
object.Group(Axes)

Parameters

October 30, 2006 144 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Name Type Description


Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

Remarks
The method creates a coordinate system for a multi-axis motion. The first element of the Axes
array specifies the leading axis. The motion parameters of the leading axis become the default
motion parameters for the group.
An axis can belong 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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
Axes(3) = -1
On Error GoTo except
'Create group of axes XYZ
Call Ch.Group(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.100 Halt
The method terminates a motion using the full deceleration profile.

Syntax
object.Halt(Axis)

October 30, 2006 145 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
None.

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

Example

Sub Halt_Sample()
On Error GoTo except
'Enable axis X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X is enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Relative motion of axis X, target
position
'of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_X, 10000)
'Halt executed to axis X
Call Ch.Halt(Ch.ACSC_AXIS_X)
'Finish the motion
'End of the multi-point motion

October 30, 2006 146 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.101 HaltM
The method terminates several motions using the full deceleration profile.

Syntax
object.HaltM(Axes)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

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

October 30, 2006 147 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub HaltM_Sample()
Dim Points(1) As Double
Dim Index As Long
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Points(0) = 10000
Points(1) = 10000
On Error GoTo except
'Enable XY
Call Ch.EnableM(Axes)
'Relative motion of axes XY with target
'position of 10000,10000
Call Ch.ToPointM(Ch.ACSC_AMF_RELATIVE, Axes, Points)
'Halt executed on axes XY
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

5.102 Jog
The method initiates a single-axis jog motion.

Syntax
object.Jog(Flags, Axis, Velocity)

Parameters
Name Type Description

October 30, 2006 148 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• •ACSC_AMF_WAIT: plan the motion but don’t
start it until the method Go is executed.
• •ACSC_AMF_VELOCITY: the motion will use
the velocity specified by the Velocity argument
instead of the default velocity.
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Velocity [in] double If the ACSC_AMF_VELOCITY flag is specified, the
velocity profile is built using the value of Velocity. The
sign of Velocity defines the direction of the motion.
If the ACSC_AMF_VELOCITY flag is not specified,
only the sign of Velocity is used in order to specify the
direction of motion. In this case, the properties
ACSC_POSITIVE_DIRECTION or
ACSC_NEGATIVE_DIRECTION can be used.

Return Value
None.

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

October 30, 2006 149 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub Jog_Sample()
On Error GoTo except
'Enable axis X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X is enabled during 5
sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Initiates a single-axis jog motion to
axis
'X to positive direction with the
specified
'velocity 10000
Call Ch.Jog(Ch.ACSC_POSITIVE_DIRECTION, Ch.ACSC_AXIS_X, 10000)
'Finish the motion
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.103 JogM
The method initiates a multi-axis jog motion.

Syntax
object.JogM(Flags, Axes, Direction, Velocity)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• •ACSC_AMF_WAIT: plan the motion but don’t
start it until the method Go is executed.
• •ACSC_AMF_VELOCITY: the motion will use
the velocity specified by the Velocity argument
instead of the default velocity.

October 30, 2006 150 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Direction [in] variant Array of directions—The number and order of values
must correspond to the Axes array. The Direction
array must specify direction for each element of Axes
except the last –1 element. The property
ACSC_POSITIVE_DIRECTION in the Direction
array specifies the correspondent axis to move in
positive direction, the property
ACSC_NEGATIVE_DIRECTION specifies the
correspondent axis to move in the negative direction.
Velocity [in] double If the ACSC_AMF_VELOCITY flag is specified, the
velocity profile is built using the value of Velocity.
If the ACSC_AMF_VELOCITY flag is not specified,
Velocity is not used.

Return Value
None.

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

October 30, 2006 151 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Enable XY
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

5.104 Kill
The method terminates a motion using reduced deceleration profile.

Syntax
object.Kill(Axis)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

October 30, 2006 152 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Relative motion of axis X with target
'position of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_X, 10000)
'Kill axis X
Call Ch.Kill(Ch.ACSC_AXIS_X)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.105 KillAll
The method terminates all currently executed motions.
object.KillAll()

October 30, 2006 153 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Points(0) = 10000
Points(1) = 10000
On Error GoTo except
'Enable XY
Call Ch.EnableM(Axes)
'Relative motion of axes XY with target
'position of 10000,10000
Call Ch.ToPointM(Ch.ACSC_AMF_RELATIVE, Axes, Points)
'Kill axes X and Y
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

5.106 KillExt
The method terminates a motion using reduced deceleration profile and defines the kill reason.

October 30, 2006 154 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.KillExt(Axis, Reason)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Reason [in] long Integer number that defines the reason for the kill. The
specified value is stored in the MERR variable in the
controller and so modifies the state of the killed motor.

Return Value
None.

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

Example

Sub KillExt_Sample()
Dim MyCode As Long
MyCode = 10
On Error GoTo except
' Enable axis X

October 30, 2006 155 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.Enable(Ch.ACSC_AXIS_X)
' Wait till X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
' Relative motion of axis X with target
' position of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_X, 10000)
' Kill axis X with internal customer
code
Call Ch.KillExt(Ch.ACSC_AXIS_X, MyCode)
' Finish the motion
' End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
ErrorMsg 'See Error Handling in Visual Basic
End Sub

5.107 KillM
The method terminates several motions using reduced deceleration profile.

Syntax
object.KillM(Axes)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

October 30, 2006 156 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Points(0) = 1000000
Points(1) = 1000000
On Error GoTo except
'Enable XY
Call Ch.EnableM(Axes)
'Relative motion of axes XY with target
'position of 10000,10000
Call Ch.ToPointM(Ch.ACSC_AMF_RELATIVE, Axes, Points)
'Kill axes X and Y
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

5.108 Line1
The method adds a linear segment to a segmented motion.

October 30, 2006 157 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.Line1(Axes, Point)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] variant Array of the final point coordinates. The number and
order of values must correspond to the Axes array. The
Point must specify a value for each element of Axes
except the last –1 element.

Return Value
None.

Remarks
The method adds a linear segment to the segmented motion. To add a linear segment with a
specified non-default velocity, use ExtLine.
All axes specified in the Axes array must be specified before calling the Segment method. The
number and order of the axes in the Axes array must correspond exactly to the number and
order of the axes of Segment method.
The parameter Point specifies the coordinates of the final point. The coordinates are absolute
in the plane.
The method waits for the controller response.
The controller response indicates that the command was accepted and the segment is added to
the motion buffer. The segment can be rejected if the motion buffer is full. In this case, you can
call this method periodically until the method returns non-zero value.
If the method fails, the Error object is filled with the error description.

October 30, 2006 158 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub Line1_Sample()
Dim Axes(2)
Dim Points(1) As Double
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Points(0) = 1000
Points(1) = 1000
On Error GoTo except
'Enable XY
Call Ch.EnableM(Axes)
Call Ch.Segment(0, Axes, Points)
'Adds a linear segment to the segmented
'motion
'Parameters: Axes - Axes XY
'Points - position points 1000,1000
Call Ch.Line1(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

5.109 LoadBuffer
The method clears the specified program buffer and then loads ACSPL+ program to this buffer.
object.LoadBuffer(Buffer, Program, Count)

Parameters
Name Type Description
Buffer [in] long Number of a program buffer in the controller.
Program [in] string Pointer to the buffer contained ACSPL+ program(s).

October 30, 2006 159 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Return Value
None.

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

Example

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

5.110 LoadBuffersFromFile
The method opens a file that contains one or more ACSPL+ programs allocated to several
buffers and download the programs to the corresponding buffers.

Syntax
object.LoadBuffersFromFile(Filename)

Parameters
Name Type Description
Filename [in] string Path of the file

Return Value
None.

October 30, 2006 160 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
The method analyzes the file, determines which program buffers should be loaded, clears them
and then loads ACSPL+ programs to those buffers.
SPiiPlus software tools save ACSPL+ programs in the following format:
# Header: Date, Firmware version etc.
#Buf1 (buffer number)
ACSPL+ program of Buf1
#Buf2 (buffer number)
ACSPL+ program of Buf2
#Buf3 (buffer number)
ACSPL+ program of Buf3 etc.
The number of buffers in file may change from 1 to 10, without any default order.
No compilation or syntax check is provided during downloading. Any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy,
the compile command must be executed after downloading.
If the method fails, the Error object is filled with the error description.

Example

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

5.111 LoadFileToIntegerVariable
The method writes value(s) from text file to integer variable.

Syntax
object.LoadFileToIntegerVariable(NBuf, Var, From1, To1, From2, To2, Filename)

October 30, 2006 161 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Nbuf [in] long Number of program buffer for local variable or
ACSC_NONE for global and standard variable.
Var [in] string Pointer to the null-terminated character string
contained name of the variable.
From1, To1 [in] long Index range (first dimension).
From2, To2 [in] long Index range (second dimension).
Filename [in] string Path of the text data file.

Return Value
None.

Remarks
The method writes to a specified integer variable or array.
The variable can be a standard controller variable, user global or user local.
Standard and user global variables have global scope. Therefore, parameter 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.
If the variable is scalar, all indexes From1, To1, From2, To2 must be ACSC_NONE (-1). The
method writes the value pointed by Values to the specified variable.
If the variable is a one-dimensional array, From1, To1 must specify the index range and From2,
To2 must be ACSC_NONE (-1). Array Values 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 by Filename parameter, 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 values and writes them to row From1 of the specified controller variable, then
retrieves next To2-From2 values and writes them to row From1+1 of the specified controller
variable, etc.
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.
If the method fails, the Error object is filled with the error description.

October 30, 2006 162 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub LoadFileToIntegerVariable_Sample()
Dim StrBuf, FileP As String
FileP = "C:\\Projects\\SPiiPlusCOM Test\\UserArr.txt"
StrBuf = "Global int UserArr(2)(10);stop"

On Error GoTo except


'Load to buffer 0 a line that contains
the
'variable "UserArr"
Call Ch.LoadBuffer(0, StrBuf)
'Run buffer 0
Call Ch.RunBuffer(0)
'Writes value(s) from text file to
integer
'variable "UserArr"
'Parameters: 0 - Number of program
buffer
'"UserArr" - variable name
'0,1 - first dimension indexes
'0,9 - second dimension indexes
'FileP - Text file name contained
'values that must be written
Call Ch.LoadFileToIntegerVariable(0, "UserArr", 0, 1, 0, 9, FileP)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.112 LoadFileToRealVariable
The method writes value(s) from text file to real variable.
object.LoadFileToRealVariable(NBuf, Var, From1, To1, From2, To2, Filename)

Parameters
Name Type Description

October 30, 2006 163 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Nbuf [in] long Number of program buffer for local variable or


ACSC_NONE for global and standard variable.
Var [in] string Pointer to the null-terminated character string
contained name of the variable.
From1, To1 [in] long Index range (first dimension).
From2, To2 [in] long Index range (second dimension).
Filename [in] string Path of the text data file.

Return Value
None.

Remarks
The method writes to a specified integer variable or array.
The variable can be a standard controller variable, user global or user local.
Standard and user global variables have global scope. Therefore, parameter 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.
If the variable is scalar, all indexes From1, To1, From2, To2 must be ACSC_NONE (-1). The
method writes the value pointed by Values to the specified variable.
If the variable is a one-dimensional array, From1, To1 must specify the index range and From2,
To2 must be ACSC_NONE (-1). Array Values 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 by Filename parameter, 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 values and writes them to row From1 of the specified controller variable, then
retrieves next To2-From2 values and writes them to row From1+1 of the specified controller
variable, etc.
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.
If the method fails, the Error object is filled with the error description.

October 30, 2006 164 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub LoadFileToRealVariable_Sample()
Dim StrBuf, FileP As String
FileP = "C:\\Projects\\SPiiPlusCOM Test\\UserArr.txt"
StrBuf = "Global real UserArr(2)(10);stop"
On Error GoTo except
'Load to buffer 0 a line that contains
the
'variable "UserArr"
Call Ch.LoadBuffer(0, StrBuf)
'Run buffer 0
Call Ch.RunBuffer(0)
'Writes value(s) from text file to real
'variable "UserArr"
'Parameters: 0 - Number of
program
'buffer
'"UserArr" - variable name
'0,1 - first dimension indexes
'0,9 - second dimension indexes
'FileP - Text file name contained
'values that must be written
Call Ch.LoadFileToRealVariable(0, "UserArr", 0, 1, 0, 9, FileP)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.113 MultiPoint
The method initiates a single-axis multi-point motion.

October 30, 2006 165 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.MultiPoint(Flags, Axis, Dwell)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• ACSC_AMF_WAIT: plan the motion but don’t
start it until the method Go is executed.
• ACSC_AMF_RELATIVE: the coordinates of each
point are relative. The first point is relative to the
instant position when the motion starts; the second
point is relative to the first, etc. If the flag is not
specified, the coordinates of each point are
absolute.
• ACSC_AMF_VELOCITY: the motion uses the
velocity specified with each point instead of the
default velocity.
• ACSC_AMF_CYCLIC: the motion uses the point
sequence as a cyclic array. After positioning to the
last point it does positioning to the first point and
continues.
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Dwell [in] double Dwell in each point in milliseconds.

Return Value
None.

Remarks
The method initiates a single-axis multi-point motion. To execute multi-axis multi-point
motion, use MultiPointM.
The motion executes sequential positioning to each of the specified points, optionally with
dwell in each point.
The method itself does not specify any point, so that the created motion starts only after the first
point is specified. The points of motion are specified by using the AddPoint or ExtAddPoint
methods that follow this method.
The motion finishes when the EndSequence method is executed. If the EndSequence call is
omitted, the motion will stop at the last point of the sequence and wait for the next point. No
transition to the next motion in the motion queue will occur until the method EndSequence
executes.

October 30, 2006 166 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

The method waits for the controller response.


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

Example

Sub MultiPoint_Sample()
Dim Index As Long
On Error GoTo except
'Enable axis X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Create multi-point motion of axis X
with
'default velocity with dwell 1 ms
Call Ch.MultiPoint(0, Ch.ACSC_AXIS_X, 1)
'Add some points
For Index = 0 To 5
Call Ch.AddPoint(Ch.ACSC_AXIS_X, 100 * Index)
Next Index
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

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

Syntax
object.MultiPointM(Flags, Axes, Dwell)

October 30, 2006 167 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• •ACSC_AMF_WAIT: plan the motion but don’t
start it until the method GoM is executed.
• •ACSC_AMF_RELATIVE: the coordinates of
each point are relative. The first point is relative to
the instant position when the motion starts; the
second point is relative to the first, etc. If the flag is
not specified, the coordinates of each point are
absolute.
• •ACSC_AMF_VELOCITY: the motion will use
the velocity specified with each point instead of the
default velocity.
• •ACSC_AMF_CYCLIC: the motion uses the point
sequence as a cyclic array: after positioning to the
last point does positioning to the first point and
continues.
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Dwell [in] double Dwell on each point in milliseconds.

Return Value
None.

Remarks
The method initiates a multi-axis multi-point motion. To execute single-axis multi-point
motion, use MultiPoint.
The motion executes sequential positioning to each of the specified points, optionally with
dwell in each point.
The method itself does not specify any point, so the created motion starts only after the first
point is specified. The points of motion are specified by using MAddPointM 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

October 30, 2006 168 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Enable axes XY
Call Ch.EnableM(Axes)
'Create multi-point motion of axes XY
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

October 30, 2006 169 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.115 OpenCommDirect
The method starts up the Simulator and opens communication with the Simulator.

Syntax
object.OpenCommDirect()

Parameters
None.

Return Value
None.

Remarks
The Simulator is a part of the SPiiPlus COM Library. When the application calls
OpenCommDirect, the library starts up the Simulator as a separate process on the same PC
and opens a simulator communication channel for communication with the simulator.
After a channel is open, any SPiiPlus COM method works with the Simulator exactly as with a
physical controller.

Note
For the simulator to be to be found by OpenCommDirect a copy of the
simulator executable file, sb4.exe (located in the SPiiPlus BIN folder),
must be in the same folder as the application executable file.

If the method fails, the Error object is filled with the error description.

October 30, 2006 170 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub OpenCommDirect_Sample()
On Error GoTo except
'Starts up the Simulator and opens
'communication with the Simulator
Call Ch.OpenCommDirect
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.116 OpenCommEthernet
The method opens communication with the controller via Ethernet.

Syntax
object.OpenCommEthernet(Address, Port)

Parameters
Name Type Description
Address [in] string Pointer to a null-terminated character string that
contains the network address of the controller in
symbolic or TCP/IP dotted form.
Port [in] long Service port.
For point-to-point communication, this parameter must
be ACSC_SOCKET_DGRAM_PORT.
For communication via Internet/Intranet, this
parameter must be
ACSC_SOCKET_STREAM_PORT.

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 parameter Port is ACSC_SOCKET_DGRAM_PORT, the library opens communication
using the connectionless socket and UDP communication protocol.
If the parameter Port is ACSC_SOCKET_STREAM_PORT, the library opens communication
using the connection-oriented socket and TCP communication protocol.

October 30, 2006 171 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

The controller supports both protocols. The UDP protocol provides faster communication, but
is not reliable when used in a multi-node network.
Use UDP protocol if the host computer has a point-to-point Ethernet connection to the
controller.
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 OpenCommEthernet_Sample()
On Error GoTo except
'Open point-to-point Ethernet
communication
'with the controller TCP/IP address
'10.0.0.100
Call Ch.OpenCommEthernet("10.0.0.100", Ch.ACSC_SOCKET_DGRAM_PORT)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.117 OpenCommPCI
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(SlotNumber)

Parameters
Name Type Description
SlotNumber [in] long Number of the slot of the controller card.
If SlotNumber is ACSC_NONE, the method opens
communication with the first found controller card.

October 30, 2006 172 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Return Value
None.

Remarks
To open PCI communication the host PC, one or more controller cards must be inserted into the
computer PCI Bus.
After a channel is open, any SPiiPlus 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

5.118 OpenCommSerial
The method opens communication with the controller via a serial port.

Syntax
object.OpenCommSerial(Channel, Rate)

Parameters
Name Type Description
Rate [in] long Communication rate in bits per second (baud).
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.

October 30, 2006 173 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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.

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

5.119 OpenHistoryBuffer
The method opens a history buffer.

Syntax
object.OpenHistoryBuffer(Size)

Parameters
Name Type Description
Size [in] long Required size of the buffer in bytes

Return Value
None.

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

October 30, 2006 174 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.120 OpenLogFile
The method opens a log file.

Syntax
object.OpenLogFile(FileName)

Parameters
Name Type Description
FileName [in] long Pointer to the null-terminated string contained name or
path of the log file.

Return Value
None.

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

October 30, 2006 175 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.121 OpenMessageBuffer
The method opens an unsolicited messages buffer.

Syntax
object.OpenMessageBuffer(Size)

Parameters
Name Type Description
Size [in] long Required size of the buffer in bytes.

Return Value
None.

Remarks
The method allocates a buffer that stores unsolicited messages from the controller.
Unsolicited messages are messages that the controller sends on its own initiative and not as a
response to 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.
If the message buffer has been open, the library separates unsolicited messages from the
controller responses and stores them in the message buffer. In this case, the Receive method
retrieves only the controller replies, and the GetSingleMessage method retrieves unsolicited
messages. If the message buffer is not open, Receive retrieves both replies and unsolicited
messages. If the user application does not call Receive or GetSingleMessage and uses only
Transaction and Command the unsolicited messages are discarded.
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.

October 30, 2006 176 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.122 ParseCOMErrorCode
The method is used to parse the SPiiPlus error code and components of HRESULT.

Syntax
object.ParseCOMErrorCode (COMErrorCode, Code, Facility, Severity)

Parameters
Name Type Description
COMErrorCode [in] long HRESULT: a 32-bit standard COM value representing
the method return status. It consists of a severity code,
a facility code, and an error code.
HRESULT can be retrieved from the Error object (see
Chapter 8, Error Handling).
Code [out] long Optional. HRESULT error code. The SPiiPlus error
code is a component of the HRESULT error code.
Facility [out] long Optional. HRESULT facility code.
Severity [out] long Optional. HRESULT severity code.

Return Value
Long.
The function returns the SPiiPlus error codes (see Section 8.4,Error Codes) parsed from
COMErrorCode (which is HRESULT).

October 30, 2006 177 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks

Note
In VBScript 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

Sub ParseCOMErrorCode _Sample()


On Error GoTo except
Dim Code As Long
Dim Facility As Long
Dim Severity As Long
'Parse COM Error Code
code = Ch.ParseCOMErrorCode(ErrorNum)
'code = Ch.ParseCOMErrorCode(ErrorNum,
Code, Facility, Severity)
If (code <> 0) Then MsgBox Ch.GetErrorString(code)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.123 PegI
The method initiates incremental PEG. The Incremental PEG method is defined by the first
point,the last point and the interval.

Syntax
object.PegI(Flags, Axis, Width, FirstPoint, Interval, LastPoint, TbNumber, TbPeriod)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include following flag:
ACSC_AMF_SYNCHRONOUS: PEG starts
synchronously with the motion sequence.

October 30, 2006 178 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axis [in] long PEG axis: ACSC_AXIS_X corresponds to X,


ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Width [in] double Width of desired pulse in milliseconds.
FirstPoint [in] long Position where the first pulse is generated.
Interval [in] long Distance between the pulse-generating points.
LastPoint [in] long Position where the last pulse is generated.
TbNumber [in] long Number of time-based pulses generated after each
encoder-based pulse, the range is from 0 to 511.
If time-based pulses aren’t desired, assign
ACSC_NONE in this parameter.
TbPeriod [in] double Period of time-based pulses, period from 0.000025 to
0.75
(Milliseconds). If time-based pulses aren’t desired,
assign ACSC_NONE in this parameter.

Return Value
None.

Remarks
The method initiates incremental PEG generation. See details in the SPiiPlus 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 PegI_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

October 30, 2006 179 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'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.PegI(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

5.124 PegR
The method initiates random PEG. Random PEG method specifies an array of points where
position-based events should be generated.

Syntax
object.PegR(Flags, Axis, Width, PointArray, StateArray, TbNumber, TbPeriod)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include following flag:
• ACSC_AMF_SYNCHRONOUS: PEG starts
synchronously with the motion sequence.
Axis [in] long PEG axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Width [in] double Width of desired pulse in milliseconds.

October 30, 2006 180 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

PointArray [in] string Null-terminated string contained the name of the real
array that stores positions at which PEG pulse should
be generated
The array must be declared as a global variable by an
ACSPL+ program or by the DeclareVariable method.
StateArray [in] string Null-terminated string contained the name of the
integer array that stores desired output state at each
position.
The array must be declared as a global variable by an
ACSPL+ program or by the DeclareVariable method.
If output state change is not desired, this parameter
should be NULL.
TbNumber [in] long Number of time-based pulses generated after each
encoder-based pulse, the range is from 0 to 511.
If time-based pulses aren’t desired, assign
ACSC_NONE in this parameter.
TbPeriod [in] double Period of time-based pulses, period from 0.000025 to
0.75
(Milliseconds). If time-based pulses aren’t desired,
assign ACSC_NONE in this parameter.

Return Value
None.

Remarks
The method initiates random PEG generation (see SPiiPlus 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 PegR_Sample()
On Error GoTo except
'Declare variable "PointArr(10)"
Call Ch.DeclareVariable(Ch.ACSC_REAL_TYPE, "PointArr(10)")
'Declare variable "StateArr(10)"
Call Ch.DeclareVariable(Ch.ACSC_INT_TYPE, "StateArr(10)")
'Enable axis Z

October 30, 2006 181 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.Enable(Ch.ACSC_AXIS_Z)
'Wait till axis Z enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_Z, 1, 5000)
'Relative motion of axis Z with target
'position of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_Z, 10000)
'Parameters: 0 - Not-Synchronous PEG
'Ch.ACSC_AXIS_Z - axis Z
'0.01 - 10 microseconds pulse
width
'"PointArr" - point array
'"StateArr" - State array
'Ch.ACSC_NONE, Ch.ACSC_NONE -
with No
'time-based pulse generation
Call Ch.PegR(0, Ch.ACSC_AXIS_Z, 0.01, "PointArr", "StateArr",
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

5.125 Projection
The method sets a projection matrix for segmented motion.

Syntax
object.Projection(Axes, Matrix)

Parameters
Name Type Description

October 30, 2006 182 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Matrix [in] string Pointer to the null-terminated string containing the
name of the matrix that provides the specified
projection.

Return Value
None.

Remarks
The method sets a projection matrix for segmented motion.
The projection matrix connects the plane coordinates and the axis values in the axis group. The
projection can provide any transformation as rotation or scaling. The number of the matrix rows
must be equal to the number of the specified axes. The number of the matrix columns must
equal two.
The matrix must be declared before as a global variable by an ACSPL+ program or by the
DeclareVariable method and must be initialized by an ACSPL+ program or by the method.
For more information about projection, see the SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

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

October 30, 2006 183 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Matrix(2, 0) = 0
Matrix(2, 1) = 1.41421
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Call Ch.Segment(0, Axes, Point)
'Incline the working plane XY by 45°
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
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

October 30, 2006 184 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Center(0) = 1000
Center(1) = 0
Call Ch.Arc2(Axes, Center, -2 * 3.141529)
'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

5.126 ReadDPRAMInteger
The method reads 32-bit integer from the DPRAM.

Syntax
ReadDPRAMInteger(Address)

Parameters
Name Type Description
Address [in] long Must be even number from 128 to 508.

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.

Note
The method can be used only with the PCI and Simulator
communication channels.

October 30, 2006 185 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.127 ReadDPRAMReal
The method reads 64-bit Real from the DPRAM.

Syntax
object.ReadDPRAMReal(Address)

Parameters
Name Type Description
Address [in] long Address has to be even number from 128 to 508.

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.

October 30, 2006 186 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Note
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 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

5.128 ReadVariable
Reads a variable from the controller and returns it as VARIANT.

Syntax
object.ReadVariable(Variable, NBuf, [From1], [To1], [From2], [To2])

Parameters
Name Type Description
Variable [in] string Name of the controller variable
NBuf [in] long Number of program buffer for local variable or
ACSC_NONE for global and standard variable.
From1, To1 [in] long Default value: ASCS_NONE.
Index range (first dimension) starting from zero.
From2, To2 [in] long Default value: ASCS_NONE.
Index range (second dimension) starting from zero.

October 30, 2006 187 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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
Reads scalar variable, vector, row of matrix, column of matrix or matrix 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 standard controller variable, a user global variable, or a user local
variable.
Standard and user global variables have global scope. Therefore, parameter 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)

October 30, 2006 188 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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.
5. Reading a column or part of a column from a matrix
From1 and To1 should specify the range of rows within the specified column, where
From1 should be less than To1. From2 and To2 should be equal and specify the column
number. The method returns data as VARIANT, initialized as a vector with the number of
elements equal to To1–From1+1.
6. Reading sub-matrix from matrix
From1 and To1 should specify the range of rows, where From1 should be less then To1.
From2 and To2 should specify columns range, where From2 should be less than To2. The
method returns data as VARIANT, initialized as a matrix with the number of rows equal to
To1–From1+1 and the number of columns equal to To2–From2+1.
If the method fails, the Error object is filled with the error description.

Example

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 - standard 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 - standard variable
Var = Ch.ReadVariable("VEL", Ch.ACSC_NONE)

October 30, 2006 189 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'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 - standard variable
' 3 – From1
' 3 – To1
Var = Ch.ReadVariable("VEL", Ch.ACSC_NONE, 3,3)
'Now Var is a scalar value

'Reading one element from matrix (two-dimensional array)


'Reading one element of matrix from row 1,column 2)
'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the
'controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 1 – From1
' 1 – To1
' 2 – From2
' 2 – To2
Var = Ch.ReadVariable ("MyMatrix ", Ch.ACSC_NONE, 1, 1, 2, 2)
'Now Var is a scalar value

'Reading sub-vector (more then one element) from vector


'Reading sub-vector with indexes from 1 to 5
'Parameters: "VEL" - controller variable name
' Ch.ACSC_NONE - standard variable

October 30, 2006 190 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

' 1 – From1
' 5 – To1
Var = Ch.ReadVariable("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.ReadVariable ("MyMatrix", Ch.ACSC_NONE, 1,1,0,2)
'Now Var is a vector of size 3

'Reading column or part of column from matrix


'Reading a part of colomn 1 from element with index 0 till element with
' index 1
'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the
'controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 0 – From1
' 1 – To1
' 1 – From2
' 1 – To2
Var = Ch.ReadVariable("MyMatrix ", Ch.ACSC_NONE, 0,1,1,1)

October 30, 2006 191 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'Now Var is a vector of size 2

'Reading sub-matrix from matrix


'Reading sub-matrix from with rows from 0 to 1 and colomns from 0 to 2
'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the
'controller
'Parameters: "MyMatrix – user variable name
' 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

5.129 ReadVariableAsScalar
Reads variable from a controller and returns as scalar.

Syntax
object.ReadVariableAsScalar (Variable, NBuf, [Ind1], [Ind2])

Parameters
Name Type Description
Variable [in] string Name of the controller variable
NBuf [in] long Number of program buffer for local variable or
ACSC_NONE for global and standard variable.
Ind1 [in] long Default value: ASCS_NONE.
Index of first dimension (row number) starting from
zero.
Ind2 [in] long Default value: ASCS_NONE.
Index of second dimension (column number) starting
from zero.

October 30, 2006 192 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Return Value
Variant.
The return value is scalar. The type of return value is real or integer, corresponding to the type
of controller variable.

Remarks
Reads a scalar variable, one element of a vector or one element of a matrix from a controller
and returns the value as scalar.
If you require a method return value as one vector element, use the ReadVariableAsVector
method. If you require a method return value as one matrix element, use the
ReadVariableAsMatrix method.
The variable can be a standard controller variable, a user-defined global variable, or a user-
defined local variable.
Standard 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.

October 30, 2006 193 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

' Ch.ACSC_NONE - standard 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 - standard 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:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.130 ReadVariableAsVector
Reads variable from a controller and returns it as vector.

Syntax
object.ReadVariable(Variable, NBuf, [From1], [To1], [From2], [To2]))

Parameters
Name Type Description
Variable [in] string Name of the controller variable
NBuf [in] long Number of program buffer for local variable or
ACSC_NONE for global and standard variable.
From1, To1 [in] long Default value: ASCS_NONE.
Index range (first dimension) starting from zero.
From2, To2 [in] long Default value: ASCS_NONE.
Index range (second dimension) starting from zero.

October 30, 2006 194 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Return Value
Variant.
The return value is one-dimensional array (vector). The type of return value is real or integer,
corresponding to the type of controller variable.

Remarks
Reads variable from a controller and returns it as vector.
If you want a return value as scalar or matrix use ReadVariableAsScalar or
ReadVariableAsMatrix methods correspondingly.
The variable can be a standard controller variable, a user global variable, or a user local
variable.
Standard and user global variables have global scope. Therefore, parameter 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 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
If the Variable is matrix, the method will return an error.
2. Reading sub-vector from vector:
The From1 and To1 should specify sub-vector index range, From1 should be less than or
equal to To1. The From2 and To2 should be omitted or specified as ACSC_NONE. The
methods returns data as vector with number of elements equals to To1-From1+1.
3. Reading a row or part of a row from matrix::
The From1 and To1 should be equal and specify row number. The From2 and To2 should
specify elements range within the specified row, From2 should be less than or equal to To2.
The methods returns data as vector with number of elements equals to To2-From2+1.
4. Reading a column or part of a column from matrix:
The From1 and To1 should specify rows range within the specified column, From1 should
be less than or equal to To1. The From2 and To2 should be equal and specify column
number. The methods returns data as vector with number of elements equals to To1-
From1+1.
If the method fails, the Error object is filled with the error description.

October 30, 2006 195 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 - standard 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 - standard 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 - standard 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

October 30, 2006 196 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

' 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

'Reading column or part of column from matrix


'Reading a part of colomn 1 from element with index 0 till element with
' index 1
'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the
'controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 0 – From1
' 1 – To1
' 1 – From2
' 1 – To2
Var = Ch.ReadVariableAsVector("MyMatrix ", Ch.ACSC_NONE, 0,1,1,1)
'Now Var is a vector of size 2

Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.131 ReadVariableAsMatrix
Reads variable from a controller and returns it as matrix.

Syntax
object.ReadVariableAsMatrix(Variable, NBuf, [From1], [To1], [From2], [To2])

Parameters
Name Type Description
Variable [in] string Name of the controller variable
NBuf [in] long Number of program buffer for local variable or
ACSC_NONE for global and standard variable.

October 30, 2006 197 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

From1, To1 [in] long Default value: ASCS_NONE.


Index range (first dimension) starting from zero.
From2, To2 [in] long Default value: ASCS_NONE.
Index range (second dimension) starting from zero.

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
Reads a variable from a controller and returns it as matrix.
If you want a return value as scalar or vector use ReadVariableAsScalar or
ReadVariableAsVector methods correspondingly.
The variable can be a standard controller variable, a user global variable, or a user local
variable.
Standard controller variables and user global variables have a global scope. Therefore, the
parameter 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 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 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.

October 30, 2006 198 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

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 - standard 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 - standard variable
Var = Ch.ReadVariableAsMatrix ("VEL", Ch.ACSC_NONE)
'Now Var is a matrix of size 1x8

'Reading whole variable, if the variable is two-dimensional array


'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the
'controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
Var = Ch.ReadVariableAsMatrix("MyMatrix ", Ch.ACSC_NONE)
'Now Var is a matrix of size 3x4

'Reading sub-vector (more then one element) from vector


'Reading sub-vector with indexes from 1 to 5
'Parameters: "VEL" - controller variable name
' Ch.ACSC_NONE - standard variable
' 1 – From1

October 30, 2006 199 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

' 5 – To1
Var = Ch.ReadVariableAsMatrix ("VEL", Ch.ACSC_NONE,1,5)
'Now Var is a matrix of size 1x5

'Reading sub-matrix from matrix


'Reading sub-matrix from with rows from 0 to 1 and colomns from 0 to 2
'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the
'controller
'Parameters: "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 0 – From1
' 1 – To1
' 0 – From2
' 2 – To2
Var = Ch.ReadVariableAsMatrix("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

5.132 Receive
The method receives a message from the controller.

Syntax
object.Receive()

Parameters
None

Return Value
String.
The method receives a message from the controller.
If no characters were received, the method returns zero.

Remarks
The method retrieves currently stored data from an input internal library buffer.

October 30, 2006 200 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Note
This method is only used for compatibility with the previous version of
zero-library. To communicate with the controller, use the Transaction
or the Command methods.

If the method fails, the Error object is filled with the error description.

Example

Sub Receive_Sample()
Dim Rec As String
Dim Cmd As String
Cmd = "?FPOS0" 'Feedcack position of axis X
On Error GoTo except
Call Ch.Send(Cmd)
'The method retrieves currently stored
data
'from an input internal library buffer
Rec = Ch.Receive
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.133 ReleaseComm
The method releases a communication channel.
object.ReleaseComm()

Parameters
None.

Return Value
None.

Remarks
The method releases the communication channel captured by CaptureComm and allows other
threads to communicate through the channel.
If the method fails, the Error object is filled with the error description.

October 30, 2006 201 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub ReleaseComm_Sample()
On Error GoTo except
'The method releases a communication
channel
Call Ch.ReleaseComm
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.134 ResetIndexState
The method resets the specified bit of the index/mark state.

Syntax
object.ResetIndexState(Axis, Mask)

Parameters
Name Type Description
Mask [in] long The parameter contains bit to be cleared. Only one of
the following flags can be specified:
• ACSC_IST_IND – a primary encoder index of the
specified axis is latched
• ACSC_IST_IND2 – a secondary encoder index of
the specified axis is latched
• ACSC_IST_MARK – a MARK1 signal has been
generated and position of the specified axis was
latched
• ACSC_IST_MARK2 – a MARK2 signal has been
generated and position of the specified axis was
latched

Return Value
None.

Remarks
The method resets the specified bit of the index/mark state. The parameter Mask contains a bit,
which must be cleared, i.e. the method resets only that bit of the index/mark state, which

October 30, 2006 202 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

corresponds to non-zero bit of the parameter 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_X, Ch.ACSC_IST_IND)
Call Ch.ResetIndexState(Ch.ACSC_AXIS_X, Ch.ACSC_IST_IND2)
Call Ch.ResetIndexState(Ch.ACSC_AXIS_X, Ch.ACSC_IST_MARK)
Call Ch.ResetIndexState(Ch.ACSC_AXIS_X, Ch.ACSC_IST_MARK2)
IState = Ch.GetIndexState(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.135 RunBuffer
The method starts up ACSPL+ program in the specified buffer.

Syntax
object.RunBuffer(Buffer, [Label])

Parameters
Name Type Description
Label [in] string Default value: “”. Label in the program that the
execution starts from.
If NULL is specified instead of a pointer, the execution
starts from the first line.

Return Value
None.

October 30, 2006 203 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.136 Send
The method sends a message to the controller.

Syntax
object.Send(Command)

October 30, 2006 204 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Command [in] string Command to be sent

Return Value
None.

Remarks
The method sends a command to the controller. The method does not receive a controller
response.
The method can be useful for applications like communication terminal to send any commands
to the controller. All background communication can be received with help of the GetHistory
method, which retrieves communication history.
If the method fails, the Error object is filled with the error description.

Example

Sub Send_Sample()
Dim Cmd As String
Cmd = "?VR" 'Firmware version
On Error GoTo except
'The method sends the message ?VR to the
'controller
Call Ch.Send(Cmd)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.137 Segment
The method initiates a multi-axis segmented motion.

Syntax
object.Segment(Flags, Axes, Point)

Parameters
Name Type Description

October 30, 2006 205 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• ACSC_AMF_WAIT: plan the motion but don’t
start it until the method GoM is executed.
• ACSC_AMF_VELOCITY: the motion will use
velocity specified for each segment instead of the
default velocity.
• ACSC_AMF_CYCLIC: the motion uses the
segment sequence as a cyclic array: after the last
segment, move along the first segment etc.
• ACSC_AMF_VELOCITYLOCK: slaved motion:
the motion advances in accordance to the master
value of the leading axis.
• ACSC_AMF_POSITIONLOCK: slaved motion,
strictly conformed to master.
• ACSC_AMF_EXTRAPOLATED: if a master
value travels beyond the specified path, the last or
the first segment is extrapolated.
• ACSC_AMF_STALLED: if a master value travels
beyond the specified path, the motion stalls at the
last or first point.
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] variant Array of the coordinates of the initial point on the
plane. The number and order of values must
correspond to the Axes array. The Point must specify a
value for each element of Axes except the last –1
element.

Return Value
None.

Remarks
The method initiates a multi-axis segmented motion.
Segmented motion moves axes along a continuous path. The path is defined as a sequence of
linear and arc segments on the plane. Although segmented motion follows a flat path, it can
involve any number of axes, because the motion plane can be connected to the axes at any
projection transformation. To use such transformation, use the Projection method.

October 30, 2006 206 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

The method itself does not specify any segment, so the created motion starts only after the first
segment is specified. The segments of motion are specified by using Line1, Arc1, Arc2,
ExtLine, ExtArc1, or ExtArc2 methods that follow this method.
The motion finishes when the ExtAddPointM method is executed. If the call of
EndSequenceM is omitted, the motion will stop at the last segment of the sequence and wait
for the next segment. No transition to the next motion in the motion queue will occur until the
method EndSequenceM is executed.
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 ExtLine, ExtArc1, or ExtArc2
methods is used.
The flags ACSC_AMF_EXTRAPOLATED and ACSC_AMF_STALLED are relevant only
for slaved motion and must be used with ACSC_AMF_VELOCITYLOCK or
ACSC_AMF_POSITIONLOCK flags.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method does not wait and does not validate the end of the motion. To wait for
the motion end, use the WaitMotionEnd method.
If the method fails, the Error object is filled with the error description.

Example
Call Ch.EnableM(Axes)

Sub Segment_Sample()
Dim Points(1) As Double
Dim Center(1) As Double
Dim Axes(2)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Create segmented motion, coordinates of
the
'initial point are (1000,1000)
Points(0) = 1000
Points(1) = 1000

October 30, 2006 207 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.Segment(0, Axes, Points)


'Describe circle with center (1000, 0),
'final point (1000, -1000),
'clockwise rotation
Center(0) = 1000
Center(1) = 0
Points(0) = 1000
Points(1) = -1000
Call Ch.Arc1(Axes, Center, Points, Ch.ACSC_CLOCKWISE)
'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

SetAcceleration

The method defines a value of motion acceleration.

Syntax
object.SetAcceleration(Axis, Acceleration)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Acceleration [in] double The value specifies required motion acceleration. The
value will be used in the subsequent motions except the
master-slave motions.

Return Value
None.

Remarks
The method writes the specified value to the controller.
One value can be specified for each axis.

October 30, 2006 208 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X, 200000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.138 SetAccelerationImm
The method defines a value of motion acceleration. Unlike SetAcceleration, the method has
immediate effect on any executed and planned motion.

Syntax
object.SetAccelerationImm(Axis, Acceleration)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Acceleration [in] double The value specifies required motion acceleration.

Return Value
None.

Remarks
The method writes the specified value to the controller.

October 30, 2006 209 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X, 300000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.139 SetAnalogOutput
The method writes the current numerical value to the specified analog outputs.

Syntax
object.SetAnalogOutput(Port, Value)

Parameters
Name Type Description
Port [in] long Number of the output port.
Value [in] long The value to be writes to the specific analog outputs.

Return Value
None.

October 30, 2006 210 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
The method writes the current numerical value to the specified analog outputs. To get a value
of the specific analog outputs, use the GetAnalogOutput method.
Analog outputs are represented in the controller variable AOUT. For more information about
analog outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

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

5.140 SetCommOptions
The method sets the communication options.

Syntax
object.SetCommOptions(Options)

Parameters

October 30, 2006 211 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Name Type Description


Options [in] long Communication options to be set
Bit-mapped parameter that can include one of the
following flags:
ACSC_COMM_USE_CHECKSUM: the
communication mode used when each command is sent
to the controller with checksum and the controller also
responds with checksum.
ACSC_COMM_AUTORECOVER_HW_ERROR:
When a hardware error is detected in the
communication channel and this bit is set, the library
automatically repeats the transaction, without counting
iterations.

Return Value
None.

Remarks
The method sets the communication options. To get current communication option, call
GetCommOptions.
To add some communication options to the current configuration, modify an Option parameter
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

5.141 SetConf
The method writes system configuration data.

October 30, 2006 212 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.SetConf(Key, Index, Value)

Parameters
Name Type Description
Key [in] long Configuration Keys (see Section 6.14) that specify
the configured feature. Assigns value of key argument
in ACSPL+ SetConf method.
Index [in] long Specifies corresponding axis or buffer number.
Assigns value of index argument in ACSPL+ SetConf
method.
Value [in] double Value to write to specified key. Assigns value of value
argument in ACSPL+ SetConf method.

Return Value
None.

Remarks
The method writes system configuration data. The Key parameter specifies the feature number
and the Index parameter defines axis or buffer to which it should be applied. Use
ACSC_CONF_XXX properties in the value field. For detailed description of system
configuration see the description of the SetConf method in the SPiiPlus ACSPL+
Programmer’s 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 X
'to 1 with key 205
Call Ch.SetConf(Ch.ACSC_CONF_DIGITAL_SOURCE_KEY, Ch.ACSC_AXIS_X, 1)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.142 SetDeceleration
The method defines a value of motion deceleration.

October 30, 2006 213 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.SetDeceleration(Axis, Deceleration)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Deceleration [in] double The value specifies a required motion deceleration. The
value will be used in the subsequent motions except the
master-slave motions.

Return Value
None.

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

Example

Sub SetDeceleration_Sample()
On Error GoTo except
'Sets deceleration value of 200000 to
axis X
Call Ch.SetDeceleration(Ch.ACSC_AXIS_X, 200000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

October 30, 2006 214 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.143 SetDecelerationImm
The method defines a value of motion deceleration. Unlike SetDeceleration, the method has
immediate effect on any executed and planned motion.

Syntax
object.SetDecelerationImm(Axis, Deceleration)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Deceleration [in] double The value specifies required motion deceleration.

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
to
'the controller
Call Ch.SetDecelerationImm(Ch.ACSC_AXIS_X, 300000)
Exit Sub

October 30, 2006 215 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.144 SetExtOutput
The method sets the specified extended output to the specified value.

Syntax
object.SetExtOutput(Port, Bit, Value)

Parameters
Name Type Description
Port [in] long Number of the extended output port.
Bit [in] long Number of the specific bit.
Value [in] long The value to be written to the specified output. Any
non-zero value is interpreted as 1.

Return Value
None.

Remarks
The method sets the specified extended output to the specified value. To set values of all outputs
of the specific extended port, use the SetExtOutputPort method.
Extended outputs are represented in the controller EXTOUT variable. For more information
about extended outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub SetExtOutput_Sample()
'The method sets output 0 of extended
port 0
'to 1
'(ACSPL+ equivalent: EXTOUT(0).0 = 1)
On Error GoTo except

October 30, 2006 216 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.SetExtOutput(0, 0, 1)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.145 SetExtOutputPort
The method sets the specified extended output port to the specified value.

Syntax
object.SetExtOutputPort(Port, Value)

Parameters
Name Type Description
Port [in] long Number of the extended output port.
Value [in] long The value to be written to the specified output port.

Return Value
None.

Remarks
The method sets the specified extended output port to the specified value. To set the value of
the specific output of the specific extended port, use the SetExtOutput method.
Extended outputs are represented in the controller variable EXTOUT. For more information
about extended outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub SetExtOutputPort_Sample()
'The method sets outputs of extended
port 0
'to 15 to 100
Dim Index As Double

October 30, 2006 217 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.146 SetFaultMask

Note
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.

The method sets the mask that enables or disables the examination and processing of the
controller faults.

Syntax
object.SetFaultMask(Axis, Mask)

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to mask
the motor faults, or ACSC_NONE to mask the system
faults.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

October 30, 2006 218 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Mask [in] long The mask to be set:


If a bit of the Mask is zero, the corresponding fault is
disabled.
To set/reset a specified bit, use ACSC_SAFETY_***
properties. See Section 6.11, Safety Control Masks
for a detailed description of these properties.
If the Mask is ACSC_NONE, then all the faults for the
specified axis are enabled.
If the Mask is zero, then all the faults for the specified
axis are disabled.

Return Value
None.

Remarks
The method sets the mask, that enables/disables the examination and processing of the
controller faults. The two types of controller faults are motor faults and system faults.
The motor faults are related to a specific motor, the power amplifier or the Servo processor. For
example: Position Error, Encoder Error or Driver Alarm.
The system faults are not related to any specific motor. For example: Emergency Stop or
Memory Fault.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer’s
Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub SetFaultMask_Sample()
On Error GoTo except
'Enable all faults of axis X
Call Ch.SetFaultMask(Ch.ACSC_AXIS_X, ACSC_NONE)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.147 SetFPosition
The method assigns a current value of feedback position.

Syntax
object.SetFPosition(Axis, FPosition)

October 30, 2006 219 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
FPosition [in] double The value specifies the current value of feedback
position.

Return Value
None.

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

Example

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_X, 0)
Next Index
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.148 SetInterruptMask
The method sets the mask for specified interrupt.

October 30, 2006 220 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.SetInterruptMask(Interrupt, Mask)

Parameters
Name Type Description
Interrupt [in] long Specifies one of the following interrupts:
• ACSC_INTR_PEG – a position event signal (PEG)
has been generated
• ACSC_INTR_MARK1 – a MARK1 signal has
been generated
• ACSC_INTR_MARK2 – a MARK2 signal has
been generated
• ACSC_INTR_PHYSICAL_MOTION_END – a
physical motion has finished
• ACSC_INTR_LOGICAL_MOTION_END – a
logical motion has finished
• ACSC_INTR_MOTION_FAILURE – a motion
has been interrupted due to a fault
• ACSC_INTR_MOTOR_FAILURE – a motor has
been disabled due to a fault
• ACSC_INTR_PROGRAM_END – an ACSPL+
program has finished
• ACSC_INTR_COMMAND – a line of ACSPL+
commands has been executed in a dynamic buffer
• ACSC_INTR_ACSPL_PROGRAM – an ACSPL+
program has generated the interrupt by
INTERRUPT command
• ACSC_INTR_INPUT – a digital input changed
from 0 to 1
• ACSC_INTR_MOTION_START – motion starts
• ACSC_INTR_MOTION_PHASE_CHANGE –
motion profile changes the phase
• ACSC_INTR_TRIGGER – AST.#TRIGGER bit
goes high

October 30, 2006 221 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Interrupt [in] long • ACSC_INTR_MESSAGE – communication


interrupt (the controller raises this interrupt after
sending a complete message to the host)
Mask [in] long The mask to be set.
If some bit = 0 then the interrupt for the corresponding
axis/buffer/input does not occur – interrupt is disabled.
Use ACSC_MASK_*** properties to set/reset a
specified bit. See GetInterruptMask for a detailed
description of these properties.
If Mask is ACSC_NONE, the interrupts for all
axes/buffers/inputs are enabled.
If Mask is 0, the interrupts for all axes/buffers/inputs
are disabled.
As default all bits for each interrupts are set to one.

Return Value
None.

Remarks
The method sets the bit mask for specified interrupt. To get current mask for specified interrupt,
call GetInterruptMask.
Using a mask, you can reduce the number of generated events. The event will be generated only
if the interrupt is caused by an axis/buffer/input that corresponds to non-zero bit in the related
mask.

Note
The method can be used only with the PCI communication channel.

If the method fails, the Error object is filled with the error description.

Example

Sub SetInterruptMask_Sample()
On Error GoTo except
'Sets the mask for specified interrupt
only
'for axis X
Call Ch.SetInterruptMask(Ch.ACSC_INTR_PROGRAM_END,
Ch.ACSC_MASK_AXIS_X)
Exit Sub

October 30, 2006 222 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.149 SetIterations
The method sets the number of iterations in one transaction.

Syntax
object.SetIterations(Iterations)

Parameters
Name Type Description
Iterations [in] long Number of iterations

Return Value
None.

Remarks
If, after the transmission of command to the controller, the controller response is not received
during the predefined time, the library repeats the command transmission. The number of those
iterations is defined by the 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

October 30, 2006 223 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.150 SetJerk
The method defines a value of motion jerk.

Syntax
object.SetJerk(Axis, Jerk)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Jerk [in] double The value specifies a required motion jerk. The value
will be used in the subsequent motions except for the
master-slave motions.

Return Value
None.

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

October 30, 2006 224 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.151 SetJerkImm
The method defines a value of motion jerk. Unlike SetJerk, the method has an immediate effect
on any executed and planned motion.

Syntax
object.SetJerkImm(Axis, Jerk)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Jerk [in] double The value specifies required motion jerk.

Return Value
None.

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

October 30, 2006 225 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

• 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_X, 2000000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.152 SetKillDeceleration
The method defines a value of motion kill deceleration.

Syntax
object.SetKillDeceleration(Axis, KillDeceleration)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
KillDeceleration [in] double The value specifies a required motion kill deceleration.
The value will be used in the subsequent motions.

Return Value
None.

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

October 30, 2006 226 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
Axes(3) = Ch.ACSC_AXIS_T
Axes(4) = Ch.ACSC_AXIS_A
Axes(5) = Ch.ACSC_AXIS_B
Axes(6) = Ch.ACSC_AXIS_C
Axes(7) = Ch.ACSC_AXIS_D
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

5.153 SetKillDecelerationImm
The method defines a value of motion kill deceleration. Unlike SetKillDeceleration, the
method has an immediate effect on any executed and planned motion.

October 30, 2006 227 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.SetKillDecelerationImm(Axis, Deceleration)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
KillDeceleration [in] double The value specifies the required motion deceleration.

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_X, 200000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.154 SetMaster
The method initiates calculating of master value for an axis.

October 30, 2006 228 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.SetMaster(Axis, Formula)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Formula [in] string 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 standard 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

October 30, 2006 229 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'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

5.155 SetOutput
The method sets the specified digital output to the specified value.

Syntax
object.SetOutput(Port, Bit, Value)

Parameters
Name Type Description
Port [in] long Number of the output port.

October 30, 2006 230 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Bit [in] long Number of the specific bit.


Value [in] long The value to be writes to the specified output. Any non-
zero value is interpreted as 1.

Return Value
None.

Remarks
The method sets the specified digital output to the specified value. To set values of all outputs
of a specific port, use the SetOutputPort method.
Digital outputs are represented in the controller variable OUT. For more information about
digital outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

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

5.156 SetOutputPort
The method sets the specified digital output port to the specified value.

Syntax
object.SetOutputPort(Port, Value)

Parameters
Name Type Description
Port [in] long Number of the output port.
Value [in] long The value to be writes to the specified output port.

Return Value
None.

October 30, 2006 231 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
The method sets the specified digital output port to the specified value. To set the value of the
specific output of the specific port, use the SetOutput method.
Digital outputs are represented in the controller variable OUT. For more information about
digital outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

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

5.157 SetResponseMask

Note
Certain controller default responses provide protection against
potential serious bodily injury and damage to equipment. Be aware of
the implications before disabling responses to any alarm, limit, or
error.

The method retrieves the mask that defines the motor or the system faults for which the
controller provides the default response.

Syntax
object.SetResponseMask(Axis, Mask)

Parameters
Name Type Description

October 30, 2006 232 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Axis [in] long The parameter specifies the axis (ACSC_AXIS_X


corresponds to X, ACSC_AXIS_Y – to Y etc.) to set
the mask of responses to the motor faults, or
ACSC_NONE to set the mask of responses to the
system faults.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Mask [in] long The mask to be set.
If a bit of Mask is zero, the corresponding default
response is disabled.
Use the ACSC_SAFETY_*** properties to set/reset a
specified bit. See Safety Control Masks for a detailed
description of these properties.
If Mask is ACSC_NONE, all default responses for the
specified axis are enabled.
If Mask is zero, all default responses for the specified
axis are disabled.

Return Value
None.

Remarks
The method retrieves the mask that defines the motor or the system faults for which the
controller provides the default response.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see the SPiiPlus ACSPL+
Programmer’s Guide.
If the method fails, the Error object is filled with the error description.

Example

Sub SetResponseMask_Sample()
On Error GoTo except
'Enable all default responses
Call Ch.SetResponseMask(Ch.ACSC_AXIS_X, ACSC_NONE)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

October 30, 2006 233 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.158 SetRPosition
The method assigns a current value of reference position.

Syntax
object.SetRPosition(Axis, RPosition)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Rposition [in] long The value specifies the current value of reference
position.

Return Value
None.

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

Example

Sub SetRPosition_Sample()
Dim Index As Long
Dim Axes(8)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
Axes(3) = Ch.ACSC_AXIS_T
Axes(4) = Ch.ACSC_AXIS_A
Axes(5) = Ch.ACSC_AXIS_B
Axes(6) = Ch.ACSC_AXIS_C
Axes(7) = Ch.ACSC_AXIS_D
Axes(8) = -1

October 30, 2006 234 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.159 SetSafetyInputPortInv
The method sets the set of bits that define inversion for the specified safety input port.

Syntax
object.SetSafetyInputPortInv(Axis, Value)

Parameters
Name Type Description
Axis [in] long The parameter specifies the axis (ACSC_AXIS_X
corresponds to X, ACSC_AXIS_Y – to Y etc.) to set
the specified safety motor inputs port, or
ACSC_NONE to set the specified safety system inputs
port.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Value [in] long The specific inversion.
To set a specific bit, use the following properties:
• ΑCSC_SAFETY_RL
• ACSC_SAFETY_LL
• ACSC_SAFETY_RL2
• ACSC_SAFETY_LL2,
• ACSC_SAFETY_HOT
• ACSC_SAFETY_DRIVE.
To set an inversion for the specific system safety input
port, use only the ACSC_SAFETY_ES property.
See Section 6.11, Safety Control Masks for a detailed
description of these properties.

October 30, 2006 235 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Return Value
None.

Remarks
The method sets the bits that define inversion for the specified safety input port. To retrieve an
inversion for the specific safety input port, use the GetSafetyInputPortInv method.
If a bit of the set is zero, the corresponding signal will not be inverted and therefore high voltage
is considered an active state. If a bit is raised, the signal will be inverted and low voltage is
considered an active state.
The inversions of safety inputs are represented in the controller variables SAFINI and
S_SAFINI. For more information about safety, inputs see SPiiPlus ACSPL+ Programmer’s
Guide.
I

Note
Some safety inputs can be unavailable in a specific controller model.
For example, SPiiPlus SA controller does not provide Motor Overheat,
Preliminary Left Limit and Preliminary Right Limit safety inputs.
See specific model documentation for details.

If the method fails, the Error object is filled with the error description.

Example

Sub SetSafetyInputPortInv_Sample()
'The method sets the inversion for
safety
'input port of the axis X to 100
On Error GoTo except
Call Ch.SetSafetyInputPortInv(Ch.ACSC_AXIS_X, 100)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.160 SetServer
The method defines the communication server IP address.

Syntax
object.SetServer(IP)

October 30, 2006 236 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
IP [in] BSTR IP address of the communication server. It may be
entered as an IP address (10.0.0.102) or as local
machine name (ACS110)

Return Value
None.

Remarks
Use the method only if application needs to establish communication with a controller through
the remote computer.
If the method is not called, by default all connections are established through the local
computer. Only controller connected to the local computer by serial cable, PCI bus or Ethernet
can be accessed.
Once the method is called, it defines the remote computer to be used as a communication server.
Any subsequent acsc_OpenCommxxx call will attempt to establish communication with a
controller connected to that remote computer.
Application can simultaneously communicate through several communication servers. Use the
following pattern to open communication channels through several servers:

Set Ch1 =new Channel


Ch1.OpenComxxx(…) 'Open one of channels with
controllers
'connected to the local computer

Set Ch2 =new Channel


Ch2.SetServer(Server1) 'Set Server1
Ch2.OpenComxxx(…) 'Open one of channels with
controllers
'connected to Server1

Set Ch3 =new Channel


Ch3.SetServer(Server2) 'Set Server2
Ch3.OpenComxxx(…) 'Open one of channels with

October 30, 2006 237 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'controllers
'connected to'Server2

Note
When the application calls SetServer(Server2) all channels related to
the local computer or to Server1 remain valid. Then the application can
use all channels to provide simultaneous communication with many
controllers through different servers.

The remote computer addressed in the SetServer method must have the SPiiPlus C Library
installed. Otherwise, the computer cannot be used as a communication server, and the
SetServer call fails.
If the method fails, the Error object is filled with the error description.

Example

Sub SetServer_Sample()
On Error GoTo except
'Defines remote server
Call Ch.SetServer(“10.0.0.134”);
'Attempts to open communication with PCI
'card via remote server at 10.0.0.134
Ch.OpenCommPCI(-1))
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.161 SetServerExt
The method defines the communication server IP address and the explicit port number.

Syntax
object.SetServerExt([in] string IPAddress,[in] long Port)

October 30, 2006 238 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
IPAddress [in] string IP address of the remote User-Mode Driver (UMD).
The address should equal the address displayed in the
remote UMD dialog.
Port [in] long Port through which communication with the remote
UMD occurs. The port number should be the same that
is displayed in the remote UMD dialog

Return Value
None.

Remarks
The method allows setting the remote UMD port number if the default port number is not
available on the remote computer.

Example

Sub SetServerExt
Dim
On Error GoTo except
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.162 SetServerExtLogin
The method sets the remote User-Mode Driver (UMD) with a specified IP address, port
number, and user login.

Syntax
object.SetServerExtLogin([in] string IPAddress,[in] long Port, [in] string Password,[in[
string Domain

Parameters
Name Type Description
IPAddress [in] string IP address of the remote UMD. This address should be
the same address displayed in the remote UMD dialog.

October 30, 2006 239 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

User [in] string User name on the remote host.


Password [in] string Password on the remote host.
Domain [in] string Domain name on the remote host.

Return Value
None.

Remarks
The method sets the temote 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

5.163 SetTimeout
The method sets the communication timeout.

Syntax
object.SetTimeout(Timeout)

Parameters
Name Type Description
Timeout [in] long Maximum waiting time in milliseconds.

Return Value
None.

Remarks
The method sets the communication timeout.
All of the subsequent waiting calls of the methods will wait for the controller response Timeout
in milliseconds. If the controller does not respond to the sent command during this time,
SPiiPlus COM methods return with zero value. In this case, the the Error object is assigned
ACSC_TIMEOUT.

October 30, 2006 240 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

If the method fails, the Error object is filled with the error description.

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

5.164 SetVelocity
The method defines a value of motion velocity.

Syntax
object.SetVelocity(Axis, Velocity)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Velocity [in] double The value specifies required motion velocity. The
value will be used in the subsequent motions except for
the master-slave motions and the motions activated
with the ACSC_AMF_VELOCITY flag.

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.

October 30, 2006 241 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
Axes(3) = Ch.ACSC_AXIS_T
Axes(4) = Ch.ACSC_AXIS_A
Axes(5) = Ch.ACSC_AXIS_B
Axes(6) = Ch.ACSC_AXIS_C
Axes(7) = Ch.ACSC_AXIS_D
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

5.165 SetVelocityImm
The method defines a value of motion velocity. Unlike SetVelocity, the method has immediate
effect on any executed or planned motion.

October 30, 2006 242 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Syntax
object.SetVelocityImm(Axis, Velocity)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Velocity [in] double The value specifies required motion velocity.

Return Value
None.

Remarks
The method writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the
value of the leading axis. The leading axis is an axis specified first in the motion command.
The method affects:
• 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_X, 80000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

October 30, 2006 243 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.166 Slave
The method initiates a master-slave motion.

Syntax
object.Slave(Flags, Axis)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• ACSC_AMF_WAIT: plan the motion but don’t
start it until the method Go is executed.
• ACSC_AMF_POSITIONLOCK: the motion will
use position lock. If the flag is not specified,
velocity lock is used (see Remarks).
Axis [in] long Slaved axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
None.

Remarks
The method initiates a single-axis master-slave motion with an unlimited area of following. If
the area of following must be limited, use SlaveStalled.
The master-slave motion continues until the motion is killed or the motion fails for any reason.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully.
The master value for the specified axis must be defined before by the call to SetMaster method.
The SetMaster method can be called again in order to change the formula of master calculation.
If at this moment the master-slave motion is in progress, the slave can come out from
synchronism. The controller then regains synchronism, probably with a different value of offset
between the master and slave.
If the ACSC_AMF_POSITIONLOCK flag is not specified, the method activates a velocity-
lock mode of slaved motion. When synchronized, the APOS axis reference follows the MPOS
with a constant offset:

APOS = MPOS + C

October 30, 2006 244 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

October 30, 2006 245 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.167 SlaveStalled
The method initiates master-slave motion within predefined limits.

Syntax
object.SlaveStalled(Flags, Axis, Left, Right)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include one or both of
the following flags:
• ACSC_AMF_WAIT: plan the motion but don’t
start it until the Go method is executed.
• ACSC_AMF_POSITIONLOCK: the motion will
use position lock. If the flag is not specified,
velocity lock is used (see Remarks).
Axis [in] long Slaved axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions
Left [in] double Left (negative) limit of the axis.
Right [in] double Right (positive) limit of the axis.

Return Value
None.

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

October 30, 2006 246 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

The controller response indicates that the command was accepted and the motion was planned
successfully.
The master-slave motion continues until the Kill command is executed, or the motion fails for
any reason.
The master value for the specified axis must be defined before by the call to SetMaster method.
The SetMaster method can be called again in order to change the formula of master calculation.
If at this moment the master-slave motion is in progress, the slave can come out from
synchronism. The controller then regains synchronism, probably with a different value of offset
between the master and slave.
If the ACSC_AMF_POSITIONLOCK flag is not specified, the method activates a velocity-
lock mode of slaved motion. When synchronized, the APOS axis reference follows the MPOS
with a constant offset:

APOS = MPOS + C

The value of C is latched at the moment when the motion comes to synchronism, and then
remains unchanged as long as the motion is synchronous. If at the moment of motion start the
master velocity is zero, the motion starts synchronously and C is equal to the difference
between initial values of APOS and MPOS.
If the ACSC_AMF_POSITIONLOCK flag is specified, the method activates a position-lock
mode of slaved motion. When synchronized, the APOS axis reference strictly follows the
MPOS:

APOS = MPOS

The Left and Right values define the allowed area of changing the APOS value. The MPOS
value is not limited and can exceed the limits. In this case, the motion comes out from
synchronism, and the APOS value remains (stalls) in one of the limits until the change of MPOS
allows following again.
If the method fails, the Error object is filled with the error description.

Example

Sub SlaveStalled_Sample()
Dim MFormula As String
'Master value is calculated as
‘feedback position of the axis T with
‘scale factor equal 2

October 30, 2006 247 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

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

Syntax
object.Spline(Flags, Axis, Period)

Parameters
Name Type Description

October 30, 2006 248 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it
until the Go method is executed.
• ACSC_AMF_RELATIVE: use the coordinates of
each point as relative. The first point is relative to
the instant position when the motion starts; the
second point is relative to the first, etc. If the flag is
not specified, the coordinates of each point are
absolute.
Flags [in] long • ACSC_AMF_VARTIME: the time interval
between adjacent points is non-uniform and is
specified along with each added point. If the flag is
not specified, the interval is uniform and is
specified in the Period argument.
• ACSC_AMF_CYCLIC: use the point sequence as a
cyclic array: after the last point come to the first
point and continue.
• ACSC_AMF_CUBIC: use a cubic interpolation
between the specified points (third-order spline).
• If the flag is not specified, linear interpolation is
used (first-order spline).
• If the flag is specified and the
ACSC_AMF_VARTIME is not specified, the
controller builds PV spline motion.
• If the flag is specified and the
ACSC_AMF_VARTIME is specified, the
controller builds PVT spline motion.
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Period [in] double Time interval between adjacent points. The parameter
is used only if the ACSC_AMF_VARTIME flag is not
specified.

Return Value
None.

Remarks
The method initiates a single-axis spline motion. To execute multi-axis spline motion, use
SplineM.
The method waits for the controller response.

October 30, 2006 249 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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.
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 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 X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Create the arbitrary path motion to
axis X
'use a cubic interpolation between the
'specified Points with uniform interval
500
'ms
Call Ch.Spline(Ch.ACSC_AMF_CUBIC, Ch.ACSC_AXIS_X, 500)

October 30, 2006 250 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'Add some points


For Index = 0 To 5
Points(0) = 100 * Index
Points(1) = 20000 * Index
Call Ch.AddPVPoint(Ch.ACSC_AXIS_X, Points(0), Points(1))
Next Index
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

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

Syntax
object.SplineM(Flags, Axes, Period)

Parameters
Name Type Description

October 30, 2006 251 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• ACSC_AMF_WAIT: plan the motion but don’t
start it until the GoM method is executed.
• ACSC_AMF_RELATIVE: the coordinates of each
point are relative. The first point is relative to the
instant position when the motion starts; the second
point is relative to the first, etc. If the flag is not
specified, the coordinates of each point are
absolute.
• ACSC_AMF_VARTIME: the time interval
between adjacent points is non-uniform and is
specified along with each added point. If the flag is
not specified, the interval is uniform and is
specified in the Period argument.
• ACSC_AMF_CYCLIC: the motion uses the point
sequence as a cyclic array: after the last point the
motion comes to the first point and continues.
• ACSC_AMF_CUBIC: use a cubic interpolation
between the specified points (third-order spline). If
the flag is not specified, linear interpolation is used
(first-order spline). [In the present version third-
order spline is not supported].
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Period [in] double Time interval between adjacent points. The parameter
is used only if the ACSC_AMF_VARTIME flag is not
specified.

Return Value
None.

Remarks
The method initiates a multi-axis spline motion. To execute a single-axis spline motion, use
Spline.
The method waits for the controller response.
The controller response indicates that the command was accepted and the motion was planned
successfully. The method cannot wait or validate the end of the motion. To wait for the motion
end, use the WaitMotionEnd method.

October 30, 2006 252 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
On Error GoTo except
'Enable axes XY
Call Ch.EnableM(Axes)
'Create the arbitrary path motion to
axes XY

'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

October 30, 2006 253 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.170 Split
The method breaks down a previously created axis group.

Syntax
object.Split(Axes)

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

Remarks
The method breaks down an axis group created before by the Group method. The Axes
parameter 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.

October 30, 2006 254 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub Split_Sample()
Dim Axes(4)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
Axes(3) = Ch.ACSC_AXIS_T
Axes(4) = -1
On Error GoTo except
'Group of axes XYZT
Call Ch.Group(Axes)
'Split the group of axes XYZT
Call Ch.Split(Axes)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.171 SplitAll
The method breaks down all axis groups created before.

Syntax
object.SplitAll()

Parameters
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.

October 30, 2006 255 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub SplitAll_Sample()
Dim Axes(4)
Axes(0) = Ch.ACSC_AXIS_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = Ch.ACSC_AXIS_Z
Axes(3) = Ch.ACSC_AXIS_T
Axes(4) = -1
On Error GoTo except
'Group of axes XYZT
Call Ch.Group(Axes)
'Split the group of axes XYZT
Call Ch.SplitAll
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.172 StopBuffer
The method stops the execution of ACSPL+ program in the specified buffer(s).

Syntax
object.StopBuffer(Buffer)

Parameters
Name Type Description
Buffer [in] long Buffer number, from 0 to 9.
Use ACSC_NONE instead of the buffer number, to
stop the execution of all programs in all buffers.

Return Value
None.

Remarks
The method stops ACSPL+ program execution in the specified buffer or in all buffers if the
parameter Buffer is ACSC_NONE.
The method has no effect if the program in the specified buffer is not running.

October 30, 2006 256 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.173 StopCollect
The method terminates data collection.

Syntax
object.StopCollect()

Parameters
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
WaitCollectEnd method.
The temporal data collection runs until the StopCollect method is executed.
The method terminates the data collection prematurely. The application can determine the
number of actually collected samples from the S_DCN variable and the actual sampling period
from the S_DCP variable.
If the method fails, the Error object is filled with the error description.

October 30, 2006 257 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Example

Sub StopCollect_Sample()
'Matrix consisting of two rows with 1000
'columns each
Dim ArrayName As String
ArrayName = "DCA(2)(1000)"
'Positions of axes X and Y will be
collected
Dim Vars As String
Vars = "FPOS(0)” & Chr$(13)& FPOS(1)"
On Error GoTo except
'Enable axis X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait till axis X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
Call Ch.ExtToPoint(Ch.ACSC_AMF_VELOCITY Or Ch.ACSC_AMF_ENDVELOCITY,
Ch.ACSC_AXIS_X, 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_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.174 StopPeg
The method stops PEG.

Syntax
object.StopPeg(Axis)

October 30, 2006 258 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axis [in] long PEG axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

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.PegI(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

5.175 Stopper
The method provides a smooth transition between two segments of segmented motion.

Syntax
object.Stopper(Axes)

October 30, 2006 259 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y, etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.

Return Value
None.

Remarks
The controller builds the motion so that the vector velocity follows a smooth velocity diagram.
The segments define the projection of the vector velocity to axis velocities. If all segments are
connected smoothly, axis velocity is also smooth. However, if the user defined a path 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_X
Axes(1) = Ch.ACSC_AXIS_Y
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 XY

October 30, 2006 260 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

October 30, 2006 261 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.176 SuspendBuffer
The method suspends the execution of ACSPL+ program in the specified program buffer(s).

Syntax
object.SuspendBuffer(Buffer)

Parameters
Name Type Description
Buffer [in] long Buffer number, from 0 to 9.
Use ACSC_NONE instead of the buffer number, to
suspend the execution of all programs in all buffers.

Return Value
None.

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

Example

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

October 30, 2006 262 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

5.177 Track
The method initiates a single-axis track motion.

Syntax
object.Track(Flags, Axis)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include the following
flag:
ACSC_AMF_WAIT: plan the motion but don’t start it
until the method Go is executed.
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.

Return Value
None.

Remarks
The method initiates a single-axis track motion. After the motion is initialized, PTP motion will
be generated with every change in 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 X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait axis X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Start up immediately the motion of the
axis
'X

October 30, 2006 263 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.Track(0, Ch.ACSC_AXIS_X)


'Target position to 5000
Call Ch.Transaction("TPOS0=5000")
End If
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.178 ToPoint
The method initiates a single-axis motion to the specified point.

Syntax
object.ToPoint(Flags, Axis, Point)

Parameters
Name Type Description
Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it
until the method Go is executed.
ACSC_AMF_RELATIVE: the Point value is relative
to the end point of the previous motion. If the flag is not
specified, the Point specifies an absolute coordinate.
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Point [in] double Coordinate of the target point.

Return Value
None.

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

October 30, 2006 264 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

Example

Sub ToPoint_Sample()
On Error GoTo except
'Enable axis X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait axis X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
'Relative motion of axis X to target
point
'of 10000
Call Ch.ToPoint(Ch.ACSC_AMF_RELATIVE, Ch.ACSC_AXIS_X, 10000)
'Wait till motion ends
Call Ch.WaitMotionEnd(Ch.ACSC_AXIS_X, 10000)
'Finish the motion
'End of the multi-point motion
Call Ch.EndSequence(Ch.ACSC_AXIS_X)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.179 ToPointM
The method initiates a multi-axis motion to the specified point.

Syntax
object.ToPointM(Flags, Axes, Point)

Parameters
Name Type Description

October 30, 2006 265 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Flags [in] long Bit-mapped parameter that can include one or more of
the following flags:
• ΑCSC_AMF_WAIT: plan the motion but don’t
start it until the method GoM is executed.
• ACSC_AMF_RELATIVE: the Point values are
relative to the end point of the previous motion. If
the flag is not specified, the Point specifies absolute
coordinates.
• ACSC_AMF_MAXIMUM: not to use the motion
parameters from the leading axis but to calculate
the maximum allowed motion velocity,
acceleration, deceleration, and jerk of the involved
axes.
Axes [in] variant Array of axes. Each element specifies one involved
axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. After the last axis, one
additional element must be located that contains –1
and marks the end of the array.
For the full list of the axis properties, see Section 6.4,
Axis Definitions.
Point [in] variant Array of the target coordinates. The number and order
of values must correspond to the Axes array. The Point
must specify a value for each element of Axes except
the last –1 element.

Return Value
None.

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,
useWaitMotionEnd 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.

October 30, 2006 266 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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_X
Axes(1) = Ch.ACSC_AXIS_Y
Axes(2) = -1
Point(0) = 10000
Point(1) = 10000
On Error GoTo except
'Enable axes XY
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

5.180 Transaction
The method executes one transaction with the controller, i.e. it sends a command and receives
a controller response.

Syntax
object.Transaction (Command)

Parameters

October 30, 2006 267 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Name Type Description


Command [in] string Command to be sent.

Return Value
String.

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

Example

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

5.181 UploadBuffer
The method uploads ACSPL+ program from the specified program buffer.

Syntax
object.UploadBuffer(Buffer)

Parameters
Name Type Description
Buffer [in] long Number of a program buffer in the controller.

October 30, 2006 268 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.182 WaitCollectEnd
The method waits for the end of data collection.
Syntax
object.WaitCollectEnd(Timeout)

Parameters
Name Type Description
Timeout [in] long Maximum waiting time in milliseconds.
If Timeout is INFINITE, the method's time-out
interval never elapses.

Return Value
None.

October 30, 2006 269 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Remarks
The method does not return while the system data collection is in progress and the specified
time-out interval has not elapsed. The method verifies the S_ST.#DC system flag.
If the method fails, the Error object is filled with the error description.

Example

Sub WaitCollectEnd_Sample()
On Error GoTo except
'Wait data collection ends during 10
sec
Call Ch.WaitCollectEnd(10000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.183 WaitInput
The method waits for the specified state of digital input.

Syntax
object.WaitInput (Port, Bit, State, Timeout)

Parameters
Name Type Description
Port [in] long Number of input port: 0 corresponds to IN0, 1 – to IN1,
etc.
Bit [in] long Selects one bit from the port, from 0 to 31.
State [in] long Specifies a desired state of the input, 0 or 1.
Timeout [in] long Maximum waiting time in milliseconds.
If Timeout is INFINITE, the method's time-out
interval never elapses.

Return Value
None.

Remarks
The basic configuration of the SPiiPlus PCI model provides only 16 inputs. Therefore, the Port
must be 0, and the Bit can be specified from 0 to 15.

October 30, 2006 270 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.184 WaitLogicalMotionEnd
The method waits for the logical end of a motion.

Syntax
object.WaitLogicalMotionEnd (Axis, Timeout)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
The axis must be either a single axis not included in any
group or a leading axis of a group.
Timeout [in] long Maximum waiting time in milliseconds.
If Timeout is INFINITE, the method's time-out
interval never elapses.

Return Value
None.

Remarks
The method does not return while the specified axis is involved in a motion and the specified
time-out interval has not elapsed.

October 30, 2006 271 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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
'X during 10 sec
Call Ch.WaitLogicalMotionEnd(Ch.ACSC_AXIS_X, 10000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.185 WaitMotionEnd
The method waits for the end of a motion.

Syntax
object.WaitMotionEnd (Axis, Timeout)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
Timeout [in] long Maximum waiting time in milliseconds.
If Timeout is INFINITE, the method's time-out
interval never elapses.

Return Value
None.

Remarks
The method does not return while the specified axis is involved in a motion, the motor has not
settled in the final position and the specified time-out interval has not elapsed.

October 30, 2006 272 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 X
during
'10 sec
Call Ch.WaitMotionEnd(Ch.ACSC_AXIS_X, 10000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.186 WaitMotorEnabled
The method waits for the specified state of the specified motor.

Syntax
object.WaitMotorEnabled (Axis, State, Timeout)

Parameters
Name Type Description
Axis [in] long Axis: ACSC_AXIS_X corresponds to X,
ACSC_AXIS_Y – to Y etc. For the full list of the axis
properties, see Section 6.4, Axis Definitions.
State [in] long 1 – the method wait for the motor enabled,
0 – the method wait for the motor disabled.
Timeout [in] long Maximum waiting time in milliseconds.
If Timeout is INFINITE, the method's time-out
interval never elapses.

Return Value
None.

October 30, 2006 273 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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 X
Call Ch.Enable(Ch.ACSC_AXIS_X)
'Wait motor X enabled during 5 sec
Call Ch.WaitMotorEnabled(Ch.ACSC_AXIS_X, 1, 5000)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.187 WaitProgramEnd
The method waits for the program termination in the specified buffer.

Syntax
object.WaitProgramEnd (Buffer, Timeout)

Parameters
Name Type Description
Buffer [in] long Buffer number, from 0 to 9.
Timeout [in] long Maximum waiting time in milliseconds.
If Timeout is INFINITE, the method's time-out
interval never elapses.

Return Value
None.

Remarks
The method does not return while the ACSPL+ program in the specified buffer is in progress
and the specified time-out interval has not elapsed.
If the method fails, the Error object is filled with the error description.

October 30, 2006 274 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.188 WriteDPRAMInteger
The method writes 32-bit integer to the DPRAM.

Syntax
object.WriteDPRAMInteger(address,Value)

Parameters
Name Type Description
Address [in] long Address has to be even number from 128 to 508
Value [in] long Value to be written

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.

October 30, 2006 275 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Note
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 WriteDPRAMInteger_Sample()
On Error GoTo except
'Write to DPRAM address 0xA0 the value
100
Call Ch.WriteDPRAMInteger(160, 100)
Exit Sub
except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub

5.189 WriteDPRAMReal
The method writes 64-bit Real to the DPRAM.

Syntax
object.WriteDPRAMReal(address, Value)

Parameters
Name Type Description
Address [in] long Address has to be even number from 128 to 508
Value [in] double Value to be written

Return Value
The method returns non-zero on success.
If the method fails, the Error object is filled with the error description.

October 30, 2006 276 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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

5.190 WriteVariable
The method writes a value defined as VARIANT to the controller variable(s).

Syntax
object.WriteVariable(Value, Variable, Nbuf, [From1], [To1], [From2], [To2])

Parameters
Name Type Description
Value [in] variant Value to be assigned to the Variable. The Value can
contain an integer or real number(s). The Value can be
scalar, one-dimensional array (vector) or two-
dimensional array (matrix).
Variable [in] string Name of the controller variable.
NBuf [in] long Number of the program buffer for local variable or
ACSC_NONE for global and standard variable.
From1, To1 [in] long Default value: ASCS_NONE.
Index range (first dimension) starting from zero of the
Variable (not of the Value).
From2, To2 [in] long Default value: ASCS_NONE.
Index range (second dimension) starting from zero of
the Variable (not of the Value).

October 30, 2006 277 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Return Value
None.

Remarks
This method writes Value to a specified Variable. The Variable can be scalar, vector (one-
dimensional array) or matrix (two-dimensional array).
The variable can be either a standard controller variable, user global variable or a user local
variable.
Standard and user global variables have global scope. Therefore, parameter 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 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)
The From1 and To1 should be equal and specify row number. The From2 and To2 should
be equal and specify column number.
• Writing 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 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 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 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.

October 30, 2006 278 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

If indexes (From1, To1, From2, To2) are specified, their values must correspond to Value
Dimensions described below

Table 37 Value Dimension Indeces


Value Dimension Indeces
Scalar From1=To1 and From2=To2
Vector of size N (To1-From1+1=N and To2=From2) or
(To1=From1 and To2-From2+1=N)
Matrix of size NxM To1-From1+1=N and To2-From2+1=M

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
Matrix(Row, Colomn) = 2
Next Colomn
Next Row
'Initialize SubVector
SubVector(0) = 3
SubVector(1) = 3

October 30, 2006 279 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

'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 - standard variable
Call Ch.WriteVariable(Scalar, "BAUD", Ch.ACSC_NONE)

'Writing vector(one-dimensional array)


to
'whole variable
'Parameters: Vector - Value to be assigned to the Variable
' "VEL" - controller variable name
' Ch.ACSC_NONE - standard 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 - standard variable

October 30, 2006 280 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

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)
'Writing value to sub-vector (more then one element) of vector
'Reading sub-vector with indexes from 1 to 5
'Parameters: SubVector - Value to be assigned to the Variable
' "VEL" - controller variable name
' Ch.ACSC_NONE - standard variable
' 2 – From1
' 3 – To1
Call Ch.WriteVariable(SubVector, "VEL", Ch.ACSC_NONE, 2, 3)

'Writing value to row or part of row of matrix


'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the controller
'Parameters: SubVector - Value to be assigned to the Variable
' "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 1 – From1
' 1 – To1
' 2 – From2
' 3 – To2

October 30, 2006 281 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Call Ch.WriteVariable(SubVector, "MyMatrix", Ch.ACSC_NONE, 1, 1, 2, 3)

'Writing value to column or part of column of matrix


'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the controller
'Parameters: SubVector - Value to be assigned to the Variable
' "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 0 – From1
' 1 – To1
' 2 – From2
' 2 – To2
Call Ch.WriteVariable(SubVector, "MyMatrix", Ch.ACSC_NONE, 0, 1, 2, 2)

'Writing value to sub-matrix of matrix


'Assumed that MyMatrix variable is declared as global MyMatrix(3)(4)
in the controller
'Parameters: SubVector - Value to be assigned to the Variable
' "MyMatrix – user variable name
' Ch.ACSC_NONE - global variable
' 0 – From1
' 1 – To1
' 1 – From2
' 2 – To2
Call Ch.WriteVariable(SubMatrix, "MyMatrix", Ch.ACSC_NONE, 0, 1, 1, 2)

except:
MyErrorMsg 'See Error Handling in Visual Basic
End Sub
End Sub

5.191 WriteLogFile
The method writes to log file.

Syntax
object.WriteLogFile(Buf, Count)

October 30, 2006 282 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Parameters
Name Type Description
Buf [in] string String to be written to log file.

Return Value
None.

Remarks
The method writes data from a buffer to log file. The log file should be previously opened by
the method OpenLogFile.
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 method OpenLogFile, 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 filled 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

October 30, 2006 283 Detailed Method Descriptions


SPiiPlus COM Library Version 5.20 Programmer’s Guide

6 Properties

6.1 General

Table 38 General Properties


Name Value Description
ACSC_NONE -1 Placeholder for redundant values,
like the second index in a one-
dimensional array
ACSC_INT_TYPE 1 Integer type of the variable
ACSC_REAL_TYPE 2 Real type of the variable
ACSC_MAX_LINE 100000 Maximum number of lines in the
program buffer
ACSC_COUNTERCLOCKWISE 1 Counterclockwise rotation
ACSC_CLOCKWISE -1 Clockwise rotation
ACSC_POSITIVE_DIRECTION 1 A move in positive direction
ACSC_NEGATIVE_DIRECTION -1 A move in negative direction

6.2 General Communication Options

Table 39 General Communication Options


Name Value Description
ACSC_COMM_USE_CHECKSUM 0x00000001 The communication mode when each
command is sent to the controller
with checksum and the controller
also responds with checksum.
ACSC_COMM_ 0x00000002 When a hardware error is detected in
AUTORECOVER_HW_ERROR the communication channel and this
bit is set, the library automatically
repeats the transaction, without
counting iterations. By default, this
flag is not set.

October 30, 2006 284 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

6.3 Ethernet Communication Options

Table 40 Ethernet Communication Options


Name Value Description
ACSC_SOCKET_DGRAM_PORT 700 The library opens Ethernet
communication using the
connectionless socket and UDP
communication protocol.
ACSC_SOCKET_STREAM_PORT 701 The library opens Ethernet
communication using the
connection-oriented socket and TCP
communication protocol.

6.4 Axis Definitions

Table 41 Axis Definitions


Name Value Description
ACSC_AXIS_X 0 Axis X
ACSC_AXIS_Y 1 Axis Y
ACSC_AXIS_Z 2 Axis Z
ACSC_AXIS_T 3 Axis T
ACSC_AXIS_A 4 Axis A
ACSC_AXIS_B 5 Axis B
ACSC_AXIS_C 6 Axis C
ACSC_AXIS_D 7 Axis D

6.5 Motion Flags

Table 42 Motion Flags (page 1 of 2)


Name Value Description
ACSC_AMF_WAIT 0x00000001 The controller plans the motion but
doesn’t start it until the Go method is
executed.
ACSC_AMF_RELATIVE 0x00000002 The value of the point coordinate is
relative to the end point coordinate of
the previous motion.
ACSC_AMF_VELOCITY 0x00000004 The motion uses the specified
velocity instead of the default
velocity.

October 30, 2006 285 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 42 Motion Flags (page 2 of 2)


Name Value Description
ACSC_AMF_ENDVELOCITY 0x00000008 The motion comes to the end point
with the specified velocity
ACSC_AMF_POSITIONLOCK 0x00000010 The slaved motion uses position lock.
If the flag is not specified, velocity
lock is used.
ACSC_AMF_VELOCITYLOCK 0x00000020 The slaved motion uses velocity lock.
ACSC_AMF_CYCLIC 0x00000100 The motion uses the point sequence
as a cyclic array: after positioning to
the last point it does positioning to
the first point and continues.
ACSC_AMF_VARTIME 0x00000200 The time interval between adjacent
points of the spline (arbitrary path)
motion is non-uniform and is
specified along with an each added
point. If the flag is not specified, the
interval is uniform.
ACSC_AMF_CUBIC 0x00000400 Use a cubic interpolation between the
specified points (third-order spline)
for the spline (arbitrary path) motion.
If the flag is not specified, linear
interpolation is used (first-order
spline). [In the present version third-
order spline is not supported].
ACSC_AMF_EXTRAPOLATED 0x00001000 Segmented slaved motion: if a master
value travels beyond the specified
path, the last or the first segment is
extrapolated.
ACSC_AMF_STALLED 0x00002000 Segmented slaved motion: if a master
value travels beyond the specified
path, the motion stalls at the last or
first point.
ACSC_AMF_MAXIMUM 0x00004000 Multi-axis motion does not use the
motion parameters from the leading
axis but calculates the maximum
allowed motion velocity,
acceleration, deceleration and jerk of
the involved axes.
ACSC_AMF_SYNCHRONOUS 0x00008000 Position Event Generation (PEG):
Start PEG synchronously with the
motion sequence.

October 30, 2006 286 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

6.6 Data Collection Flags

Table 43 Data Collection Flags


Name Value Description
ACSC_DCF_TEMPORAL 0x00000001 Temporal data collection. The
sampling period is calculated
automatically according to the
collection time.
ACSC_DCF_CYCLIC 0x00000002 Cyclic data collection uses the
collection array as a cyclic buffer and
continiues infinitely. When the array
is full, each new sample overwrites
the oldest sample in the array.

6.7 Motor State Flags

Table 44 Motor State Flags


Name Value Description
ACSC_MST_ENABLE 0x00000001 Motor is enabled
ACSC_MST_INPOS 0x00000010 Motor has reached a target position.
ACSC_MST_MOVE 0x00000020 Motor is moving.
ACSC_MST_ACC 0x00000040 Motor is accelerating.

6.8 Axis State Flags

Table 45 Axis State Flags (page 1 of 2)


Name Value Description
ACSC_AST_LEAD 0x00000001 Axis is leading in a group.
ACSC_AST_DC 0x00000002 Axis data collection is in progress.
ACSC_AST_PEG 0x00000004 PEG for the specified axis is in
progress.
ACSC_AST_MOVE 0x00000020 Axis is moving.
ACSC_AST_ACC 0x00000040 Axis is accelerating.
ACSC_AST_SEGMENT 0x00000080 Construction of segmented motion
for the specified axis is in progress.

October 30, 2006 287 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 45 Axis State Flags (page 2 of 2)


Name Value Description
ACSC_AST_VELLOCK 0x00000100 Slave motion for the specified axis is
synchronized to master in velocity
lock mode.
ACSC_AST_POSLOCK 0x00000200 Slave motion for the specified axis is
synchronized to master in position
lock mode.

6.9 Index and Mark State Flags

Table 46 Index and Mark State Flags


Name Value Description
ACSC_IST_IND 0x00000001 Primary encoder index of the
specified axis is latched.
ACSC_IST_IND2 0x00000002 Secondary encoder index of the
specified axis is latched.
ACSC_IST_MARK 0x00000004 MARK1 signal has been generated
and position of the specified axis was
latched.
ACSC_IST_MARK2 0x00000008 MARK2 signal has been generated
and position of the specified axis was
latched.

6.10 Program State Flags

Table 47 Program State Flags


Name Value Description
ACSC_PST_COMPILED 0x00000001 Program in the specified buffer is
compiled.
ACSC_PST_RUN 0x00000002 Program in the specified buffer is
running.
ACSC_PST_SUSPEND 0x00000004 Program in the specified buffer is
suspended after the step execution or
due to breakpoint in debug mode.
ACSC_PST_DEBUG 0x00000020 Program in the specified buffer is
executed in debug mode, i.e.
breakpoints are active.
ACSC_PST_AUTO 0x00000080 Auto routine in the specified buffer is
running.

October 30, 2006 288 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

6.11 Safety Control Masks

Table 48 Safety Control Masks


Name Value Description Type
ACSC_SAFETY_RL 0x00000001 Right Limit Motor fault
ACSC_SAFETY_LL 0x00000002 Left Limit Motor fault
ACSC_SAFETY_RL2 0x00000004 Preliminary Right Limit Motor fault
ACSC_SAFETY_LL2 0x00000008 Preliminary Left Limit Motor fault
ACSC_SAFETY_HOT 0x00000010 Motor Overheat Motor fault
ACSC_SAFETY_SRL 0x00000020 Software Right Limit Motor fault
ACSC_SAFETY_SLL 0x00000040 Software Left Limit Motor fault
ACSC_SAFETY_ENCNC 0x00000080 Primary Encoder Not Motor fault
Connected
ACSC_SAFETY_ENC2NC 0x00000100 Secondary Encoder Not Motor fault
Connected
ACSC_SAFETY_DRIVE 0x00000200 Driver Alarm Motor fault
ACSC_SAFETY_ENC 0x00000400 Primary Encoder Error Motor fault
ACSC_SAFETY_ENC2 0x00000800 Secondary Encoder Error Motor fault
ACSC_SAFETY_PE 0x00001000 Position Error Motor fault
ACSC_SAFETY_CPE 0x00002000 Critical Position Error Motor fault
ACSC_SAFETY_VL 0x00004000 Velocity Limit Motor fault
ACSC_SAFETY_AL 0x00008000 Acceleration Limit Motor fault
ACSC_SAFETY_CL 0x00010000 Current Limit Motor fault
ACSC_SAFETY_SP 0x00020000 Servo Processor Alarm Motor fault
ACSC_SAFETY_PROG 0x02000000 Program Error System fault
ACSC_SAFETY_MEM 0x04000000 Memory Overuse System fault
ACSC_SAFETY_TIME 0x08000000 Time Overuse System fault
ACSC_SAFETY_ES 0x10000000 Emergency Stop System fault
ACSC_SAFETY_INT 0x20000000 Servo Interrupt System fault
ACSC_SAFETY_INTGR 0x40000000 Integrity Violation System fault

Note
See the SPiiPlus ACSPL+ Programmer’s Guide for detailed
explanations of faults.

October 30, 2006 289 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

6.12 Interrupt Types

Table 49 Interrupt Types


Name Value Description
ACSC_INTR_PEG 3 Position event signal (PEG) has
been generated.
ACSC_INTR_MARK1 7 MARK1 signal has been
generated.
ACSC_INTR_MARK2 8 MARK2 signal has been
generated.
ACSC_INTR_EMERGENCY 15 EMERGENCY STOP signal has
been generated.
ACSC_INTR_PHYSICAL_MOTION_END 16 Physical motion has finished.
ACSC_INTR_LOGICAL_MOTION_END 17 Logical motion has finished.
ACSC_INTR_MOTION_FAILURE 18 Motion has been interrupted due to
a fault.
ACSC_INTR_MOTOR_FAILURE 19 Motor has been disabled due to a
fault.
ACSC_INTR_PROGRAM_END 20 ACSPL+ program has finished.
ACSC_INTR_COMMAND 21 A line of ACSPL+ commands has
been executed in a dynamic buffer.
ACSC_INTR_ACSPL_PROGRAM 22 ACSPL+ program has generated
the interrupt by INTERRUPT
command.
ACSC_INTR_INPUT 23 Digital input has changed from 0 to
1.
ACSC_INTR_MOTION_START 24 Physical motion has started.
ACSC_INTR_MOTION_PHASE_CHANGE 25 Motion profile changed the phase
ACSC_INTR_TRIGGER 26 AST.#TRIGGER bit went high
ACSC_INTR_MESSAGE 31 Communication interrupt (the
controller raises this interrupt after
sending a complete message to the
host)

October 30, 2006 290 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

6.13 Interrupt Masks

Table 50 Interrupt Masks


Bit Name Bit Description Interrupt
ACSC_MASK_AXIS_X 0 Axis X ACSC_INTR_PEG,
ACSC_INTR_MARK1,
ACSC_MASK_AXIS_Y 1 Axis Y ACSC_INTR_MARK2,
ACSC_MASK_AXIS_Z 2 Axis Z ACSC_INTR_PHYSICAL_MOTION_E
ND,
ACSC_MASK_AXIS_T 3 Axis T ACSC_INTR_LOGICAL_MOTION_E
ND,
ACSC_MASK_AXIS_A 4 Axis A ACSC_INTR_MOTION_FAILURE,
ACSC_MASK_AXIS_B 5 Axis B ACSC_INTR_MOTOR_FAILURE,
ACSC_INTR_MOTION_START,
ACSC_MASK_AXIS_C 6 Axis C ACSC_INTR_MOTION_PHASE_CHA
NGE ,
ACSC_MASK_AXIS_D 7 Axis D
ACSC_INTR_TRIGGER
ACSC_MASK_BUFFER_0 0 Buffer 0 ACSC_INTR_PROGRAM_END,
ACSC_MASK_BUFFER_1 1 Buffer 1 ACSC_INTR_COMMAND,
ACSC_INTR_ACSPL_PROGRAM
ACSC_MASK_BUFFER_2 2 Buffer 2
ACSC_MASK_BUFFER_3 3 Buffer 3
ACSC_MASK_BUFFER_4 4 Buffer 4
ACSC_MASK_BUFFER_5 5 Buffer 5
ACSC_MASK_BUFFER_6 6 Buffer 6
ACSC_MASK_BUFFER_7 7 Buffer 7
ACSC_MASK_BUFFER_8 8 Buffer 8
ACSC_MASK_BUFFER_9 9 Buffer 9
ACSC_MASK_INPUT_0 0.3 Inputs IN(0).0 ACSC_INTR_INPUT
… 1 … IN(0).31
ACSC_MASK_INPUT_31

6.14 Configuration Keys

Table 51 Configuration Keys (page 1 of 2)


Key Name Key Description
ACSC_CONF _WORD1_KEY 1 Bit 6 defines HSSI route, bit 7 defines
source for interrupt generation.
ACSC_CONF _INT_EDGE_KEY 3 Sets the interrupt edge to be positive or
negative.
ACSC_CONF _ENCODER_KEY 4 Sets encoder type: A&B or analog.

October 30, 2006 291 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 51 Configuration Keys (page 2 of 2)


Key Name Key Description
ACSC_CONF_OUT_KEY 29 Sets the specified output pin to be one
of the following:
OUT0
PEG
Brake
ACSC_CONF _MFLAGS9_KEY 204 Controls value of MFLAGS.9
ACSC_CONF_DIGITAL_SOURCE_KEY 205 Assigns use of OUT0 signal: general
purpose output or PEG output.
ACSC_CONF_SP_OUT_PINS_KEY 206 Reads SP output pins.
ACSC_CONF_BRAKE_OUT_KEY 229 Controls brake method.

October 30, 2006 292 Properties


SPiiPlus COM Library Version 5.20 Programmer’s Guide

7 Events
SPiiPlus COM Library has events for the following types of interrupts:

Table 52 Events and Interrupts


Event Interrupt
PEG ([in] long Param) ACSC_INTR_PEG
MARK1 ([in] long Param) ACSC_INTR_MARK1
MARK2 ([in] long Param) ACSC_INTR_MARK2
EMERGENCY ([in] long Param) ACSC_INTR_EMERGENCY
PHYSICALMOTIONEND ([in] long Param) ACSC_INTR_PHYSICAL_MOTION_END
LOGICALMOTIONEND ([in] long Param) ACSC_INTR_LOGICAL_MOTION_END
MOTIONFAILURE ([in] long Param) ACSC_INTR_MOTION_FAILURE
MOTORFAILURE ([in] long Param) ACSC_INTR_MOTOR_FAILURE
PROGRAMEND ([in] long Param) ACSC_INTR_PROGRAM_END
ACSPLCOMMAND ([in] long Param) ACSC_INTR_COMMAND
ACSPLPROGRAM ([in] long Param) ACSC_INTR_ACSPL_PROGRAM
INPUT [in] long Param) ACSC_INTR_INPUT
MESSAGE ([in] long Param). ACSC_INTR_MESSAGE
MOTIONSTART([in] long Param). ACSC_INTR_MOTION_START
MOTIONPHASECHANGE ACSC_INTR_MOTION_PHASE_CHANGE
TRIGGER ACSC_INTR_TRIGGER

The bit-mapped event parameter Param is an interrupt mask that determines which
axis/buffer/input a given interrupt was generated for. See Section 6.13, Interrupt Masks for a
description of Param for each interrupt.

October 30, 2006 293 Events


SPiiPlus COM Library Version 5.20 Programmer’s Guide

8 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: SpiiPlusCom510.Channel.
• A string with a description of the error and the SPiiPlus Error Codes (see Section 8.4). For
example:
Communication Initialization failure. Error – 132
• HRESULT - a 32-bit standard COM value representing the method return status. To get the
SPiiPlus error code from HRESULT, use ParseCOMErrorCode (see Section 5.122). For
more information about HRESULT, refer to Microsoft documentation.

8.1 Error Handling in Visual Basic


The following code illustrates error handling in Visual Basic:
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
If communication is not established, the following error message appears:

October 30, 2006 294 Error Handling


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Figure 2 Communication not Established Message - Visual Basic

8.2 Error Handling Example in LabVIEW 7

Figure 3 Error Handling Example in LabView 7


If communication is not established, the error cluster will be filled:

Figure 4 LabVIEW Error Message

October 30, 2006 295 Error Handling


SPiiPlus COM Library Version 5.20 Programmer’s Guide

8.3 Error Handling Example in C#


private void OpenCommSerial()
{
try
{
Ch.OpenCommSerial(1, 115200);
}
catch (COMException Ex)
{
ErorMsg(Ex);
}
private void ErorMsg(COMException Ex)
{
string Str = "Error from " + Ex.Source + "\n\r";
Str = Str + Ex.Message + "\n\r";
Str = Str + "HRESULT:"+String.Format("0x{0:X}",(Ex.ErrorCode));
MessageBox.Show(Str);
}
If communication is not established, the message box will appear:

Figure 5 C# Error Message

8.4 Error Codes

Note
Any error code greater than 1000 is a controller error defined in the
SPiiPlus ACSPL+ Programmer’s Guide.

October 30, 2006 296 Error Handling


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 53 (page 1 of 4)
Error Description
102 No such file or directory.
This error is returned by the OpenLogFile method if a component of a path does not
specify an existing directory.
103 The FW version does not support the current C Library version.
This error is returned by one of the OpenComm methods. Upgrde the FW of the
controller.
109 Internal library error: Invalid file handle.
113 File permission denied.
This error is returned by the OpenLogFile method if attempt was made to open a
read-only file, or file’s sharing mode does not allow a write operation.
122 Internal library error: Cannot open Log file.
124 Too many open files.
This error is returned by the OpenLogFile method if no more file handles available.
128 No space left on device.
This error is returned by the WriteLogFile method if no more space for writing is
available on the device (for example, when the disk is full).
130 Timeout expired.
This error indicates that during specified timeout the controller did not respond or
response was invalid.
132 Communication initialization failure.
This error is returned by one of the Open*** methods in the following cases:
the specified communication parameters are invalid
the corresponding physical connection is not established
the controller does not respond for specified communication channel.
133 Internal library error: Creating communication object failure.
134 Invalid communication handle.
Specified communication handle must be a handle returned by one of the Open***
methods.
135 All channels are busy.
The maximum number of the concurrently opened communication channels is 10.
136 Invalid name of Log file.
This error is returned by the OpenLogFile method if the specified log file name is
invalid or more than 256 characters.
137 Received message is too long (more than size of user buffer).
This error cannot be returned and is present for compatibility with previous versions
of the library.
138 The program string is long.
This error is returned by one of the an AppendBuffer or LoadBuffer method if
ACSPL+ program contains a string longer than 2032 bytes.

October 30, 2006 297 Error Handling


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 53 (page 2 of 4)
Error Description
139 Method parameters are invalid.
140 History buffer is closed.
141 Name of variable must be specified.
142 Error in index specification.
This error is returned by the ReadVariable, ReadVariableAsScalar,
ReadVariableAsVector, ReadVariableAsMatrix, WriteVariable methods if the
parameters From1, To1, From2, To2 were specified incorrectly.
143 Controller reply contains less values than expected.
This error is returned by the ReadVariable, ReadVariableAsScalar,
ReadVariableAsVector, ReadVariableAsMatrixmethods.
147 Internal error: Error of the history buffer initialization.
150 Unsolicited messages buffer is closed.
151 Callback registration error.
This error is returned by the EnableEvent method for any of the communication
channels.
In the present version of library, only PCI Bus communication supports user
callbacks.
152 Callback method has been already installed.
This error is returned by the EnableEvent method if the application tries to enable
another event for the same interrupt that was already used. Only one event can be
enabled for each interrupt.
153 Checksum of the controller response is incorrect.
154 Internal library error: The controller replies sequence is invalid.
155 Internal library error: WaitForSingleObject method returns error.
157 Internal library error: Error of the unsolicited messages buffer initialization.
162 The library cannot send to the specified communication channel.
Check physical connection with the controller (or settings) and try to reconnect.
163 The library cannot receive from the specified communication channel.
Check physical connection with the controller (or settings) and try to reconnect.
164 Internal library error: Sending of the chain is failed.
179 Internal library error: Thread local storage error.
180 PCI driver initialization error. Returned by the GetPCICards method in the
following cases:
• SpiiPlus PCI driver is not installed correctly
• The version of the SpiiPlus PCI Bus driver is incorrectly - in this case, it is
necessary to reinstall the SpiiPlus PCI driver (WINDRIVER) and the library.
190 Cannot access DPRAM directly through any channel but PCI and Direct.
Returned by DPRAM access methods, when attempting to call them with Serial or
Ethernet channels.

October 30, 2006 298 Error Handling


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 53 (page 3 of 4)
Error Description
191 Problem occurred while activating one of SpiiPlus device drivers. Returned by
OpenCommPCI.
192 Invalid DPRAM address was specified
Returned by DPRAM access methods, when attempting to access illegal address
193 This version of simulator does not support work with DPRAM.
Returned by DPRAM access methods, when attempting to access old version
Simulator that does not support DPRAM.
194 Problem in SpiiPlus PCI Hardware was detected. Returned by OpenCommPCI
195 Returned by methods that work with host file system when a specified filename is not
found.
Check the path and filename.
196 Returned by methods that analyze SPiiPlus application files when application file
format is incorrect.
Check application file and replace with a valid file.
197 The application cannot establish communication with the SPiiPlus UMD.
Returned by one of the OpenComm methods.
Check the following:
• SPiiPlus UMD is loaded (whether the UMD icon appears in the Task tray).
• SPiiPlus UMD shows an error message.
• In case of remote connection, access from a remote application is enabled.
198 The controller does not reply for more than 20 seconds.
Returned by any method that exchanges data with the controller.
Check the following:
• Controller is powered on (MPU LED is green)
• Controller connected properly to host
• Controller executes a time consuming command like compilation of a large
program, save to flash, load to flash, etc.
199 The DLL and the UMD versions are not compatible.
Returned by one of the OpenComm methods.
Verify that the files ACSCL.DLL and ACSCSRV.EXE are of the same version.
502 No interrupt
504 Interrupt period
506 No interrupt notification event
508 SPii failure
601 Error in array and/or index definition
602 Communication channel is already open

October 30, 2006 299 Error Handling


SPiiPlus COM Library Version 5.20 Programmer’s Guide

Table 53 (page 4 of 4)
Error Description
603 Argument Value has incorrect type
604 Argument Value is not initialized

October 30, 2006 300 Error Handling

You might also like