S Pi i P L US
C Library Reference




 Programmer’s Guide
       Version 6.50
V e r s i o n 6 . 5 0 , 31 January 2009
COPYRIGHT
Copyright ® 1999 - 2009 ACS Motion Control Ltd.
Changes are periodically...
Programmer’s Guide

Changes in Version 6.50


Page     Change
-        The following C functions were added:
         acsc...
C Library Reference Version 6.50                                                                   Programmer’s Guide


Ta...
C Library Reference Version 6.50                                                                Programmer’s Guide

4.1.13...
C Library Reference Version 6.50                                                                 Programmer’s Guide

4.8.2...
C Library Reference Version 6.50                                                                      Programmer’s Guide

...
C Library Reference Version 6.50                                                                   Programmer’s Guide

4.2...
C Library Reference Version 6.50                                                                   Programmer’s Guide

4.2...
C Library Reference Version 6.50                                                                  Programmer’s Guide

6.1....
C Library Reference Version 6.50                                                                   Programmer’s Guide

6.7...
C Library Reference Version 6.50                                                                         Programmer’s Guid...
C Library Reference Version 6.50                                                             Programmer’s Guide


List of ...
C Library Reference Version 6.50                                                                       Programmer’s Guide
...
C Library Reference Version 6.50                                          Programmer’s Guide


1            Introduction
T...
C Library Reference Version 6.50                                      Programmer’s Guide

Table 1     Related SPiiPlus Too...
C Library Reference Version 6.50                                          Programmer’s Guide

Table 2      Collateral Docu...
C Library Reference Version 6.50                                    Programmer’s Guide


1.5        Statement Text and Ico...
C Library Reference Version 6.50                                         Programmer’s Guide


2            SPiiPlus C Libr...
C Library Reference Version 6.50                                             Programmer’s Guide

The host application is p...
C Library Reference Version 6.50                                         Programmer’s Guide


2.6          Programming Lan...
C Library Reference Version 6.50                                           Programmer’s Guide

•   Communication history
 ...
C Library Reference Version 6.50                                         Programmer’s Guide

•   Support for Windows 2000/...
C Library Reference Version 6.50                                           Programmer’s Guide


2.10         Callbacks
The...
C Library Reference Version 6.50                                         Programmer’s Guide

•  In all other channels, cal...
C Library Reference Version 6.50                                           Programmer’s Guide

In all other channels, the ...
C Library Reference Version 6.50                                          Programmer’s Guide




 When a thread activates ...
C Library Reference Version 6.50                             Programmer’s Guide


                            buf,        ...
C Library Reference Version 6.50                            Programmer’s Guide


else
{
       printf(“transaction error: ...
C Library Reference Version 6.50                                         Programmer’s Guide


3            Using the SPiiP...
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
Upcoming SlideShare
Loading in …5
×

S Pii Plus+C+Library+Programmer+Guide

1,571 views
1,464 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,571
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

S Pii Plus+C+Library+Programmer+Guide

  1. 1. S Pi i P L US C Library Reference Programmer’s Guide Version 6.50
  2. 2. V e r s i o n 6 . 5 0 , 31 January 2009 COPYRIGHT Copyright ® 1999 - 2009 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. Web Site: www.AcsMotionControl.com Information: info@AcsMotionControl.com Tech Support: support@AcsMotionControl.com ACS Motion Control, Ltd. Ramat Gabriel Industrial Park POB 5668 Migdal HaEmek, 10500 ISRAEL Tel: (972) (4) 6546440 Fax: (972) (4) 6546443 ACS Motion Control, Inc. 6575 City West Parkway Eden Prairie, MN 55344 Tel: 800-545-2980 Tel. 763-559-7669 Fax. 763-559-0110 ACS Motion Control (Korea) Digital Empire Building D-191 980-3, Youngtong-dong, Youngtong-gu, Suwon, Geonggi-do, 443-813, Korea Tel: +82-31-202-3541 Fax: +82-31-202-3542 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. 31 January 2009 ii Programmer’s Guide
  3. 3. Programmer’s Guide Changes in Version 6.50 Page Change - The following C functions were added: acsc_OpenCommEthernetTCP acsc_OpenCommEthernetUDP acsc_GetConnectionsList acsc_TerminateConnection acsc_DataCollection acsc_LoadDataToController acsc_UploadDataFromController acsc_RegisterEmergencyStop acsc_UnregisterEmergencyStop acsc_AnalyzeApplication acsc_SaveApplication acsc_FreeApplication acsc_LoadApplication acsc_ControllerReboot acsc_ControllerFactoryDefault - The following C functions are obsolete: acsc_Collect acsc_CollectB acsc_LoadFileToIntegerVariable acsc_LoadFileToRealVariable acsc_OpenCommEthernet Version 6.50, 31 January 2009 iii Programmer’s Guide
  4. 4. C Library Reference Version 6.50 Programmer’s Guide Table of Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Organization of this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Related SPiiPlus Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 SPiiPlus Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.4 Conventions Used in this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.5 Statement Text and Icons Used in this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2 SPiiPlus C Library Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1 Operation Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 Communication Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2.1 Run-Time Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2.2 Log Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3 C Library Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.4 Communication Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.5 Controller Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.6 Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.7 Supplied Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.8 Highlights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.9 Use of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.10 Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.11 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.12 Hardware Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.13 Dual-Port RAM (DPRAM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.14 Non-Waiting Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3 Using the SPiiPlus C Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1 Library Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.2 Building C/C++ Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.3 Redistribution of User Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.1 Redistributed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.2 File Destinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.3 Kernel Mode Driver Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4 C Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.1 Communication Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.1.1 acsc_OpenCommSerial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.1.2 acsc_OpenCommEthernetTCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.1.3 acsc_OpenCommEthernetUDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.1.4 acsc_OpenCommDirect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.1.5 acsc_OpenCommPCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.1.6 acsc_GetPCICards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.1.7 acsc_SetServer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.1.8 acsc_SetServerExt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.1.9 acsc_SetServerExtLogin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.1.10 acsc_CloseComm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.1.11 acsc_Send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 4.1.12 acsc_Receive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 31 January 2009 iv Table of Contents
  5. 5. C Library Reference Version 6.50 Programmer’s Guide 4.1.13 acsc_Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.1.14 acsc_Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 4.1.15 acsc_WaitForAsyncCall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4.1.16 acsc_CancelOperation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.1.17 acsc_GetEthernetCards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.1.18 acsc_GetConnectionsList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.1.19 acsc_TerminateConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.2 Service Communication Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.2.1 acsc_GetCommOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.2.2 acsc_GetDefaultTimeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 4.2.3 acsc_GetErrorString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 4.2.4 acsc_GetLastError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.2.5 acsc_GetLibraryVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.2.6 acsc_GetTimeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 4.2.7 acsc_SetIterations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.2.8 acsc_SetCommOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 4.2.9 acsc_SetTimeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.2.10 acsc_SetQueueOverflowTimeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4.2.11 acsc_GetQueueOverflowTimeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 4.3 ACSPL+ Program Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 4.3.1 acsc_AppendBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.3.2 acsc_ClearBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4.3.3 acsc_CompileBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.3.4 acsc_DownloadBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 4.3.5 acsc_LoadBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 4.3.6 acsc_LoadBufferIgnoreServiceLines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 4.3.7 acsc_LoadBuffersFromFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 4.3.8 acsc_RunBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 4.3.9 acsc_StopBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 4.3.10 acsc_SuspendBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 4.3.11 acsc_UploadBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 4.4 Read and Write Variables Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 4.4.1 acsc_ReadInteger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 4.4.2 acsc_WriteInteger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 4.4.3 acsc_ReadReal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4.4.4 acsc_WriteReal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.5 Load/Upload Data To/From Controller Functions . . . . . . . . . . . . . . . . . . . . . . . . 84 4.5.1 acsc_LoadDataToController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.5.2 acsc_UploadDataFromController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 4.6 Multiple Thread Synchronization Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 4.6.1 acsc_CaptureComm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 4.6.2 acsc_ReleaseComm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 4.7 History Buffer Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 4.7.1 acsc_OpenHistoryBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 4.7.2 acsc_CloseHistoryBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 4.7.3 acsc_GetHistory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 4.8 Unsolicited Messages Buffer Management Functions . . . . . . . . . . . . . . . . . . . . . 95 4.8.1 acsc_OpenMessageBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 31 January 2009 v Table of Contents
  6. 6. C Library Reference Version 6.50 Programmer’s Guide 4.8.2 acsc_CloseMessageBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 4.8.3 acsc_GetSingleMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 4.8.4 acsc_GetMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 4.9 Log File Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 4.9.1 acsc_SetLogFileOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 4.9.2 acsc_OpenLogFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 4.9.3 acsc_CloseLogFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 4.9.4 acsc_WriteLogFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 4.9.5 acsc_FlushLogFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 4.10 System Configuration Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 4.10.1 acsc_SetConf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 4.10.2 acsc_GetConf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 4.11 Setting and Reading Motion Parameters Functions . . . . . . . . . . . . . . . . . . . . . . 108 4.11.1 acsc_SetVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 4.11.2 acsc_GetVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 4.11.3 acsc_SetAcceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 4.11.4 acsc_GetAcceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 4.11.5 acsc_SetDeceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.11.6 acsc_GetDeceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 4.11.7 acsc_SetJerk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 4.11.8 acsc_GetJerk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 4.11.9 acsc_SetKillDeceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 4.11.10 acsc_GetKillDeceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 4.11.11 acsc_SetVelocityImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 4.11.12 acsc_SetAccelerationImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 4.11.13 acsc_SetDecelerationImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 4.11.14 acsc_SetJerkImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 4.11.15 acsc_SetKillDecelerationImm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 4.11.16 acsc_SetFPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 4.11.17 acsc_GetFPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 4.11.18 acsc_SetRPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 4.11.19 acsc_GetRPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 4.11.20 acsc_GetFVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 4.11.21 acsc_GetRVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 4.12 Axis/Motor Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 4.12.1 acsc_Commut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 4.12.2 acsc_Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 4.12.3 acsc_EnableM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 4.12.4 acsc_Disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 4.12.5 acsc_DisableAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 4.12.6 acsc_DisableExt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 4.12.7 acsc_DisableM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 4.12.8 acsc_Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 4.12.9 acsc_Split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 4.12.10 acsc_SplitAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 4.13 Motion Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 4.13.1 acsc_Go . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 4.13.2 acsc_GoM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 31 January 2009 vi Table of Contents
  7. 7. C Library Reference Version 6.50 Programmer’s Guide 4.13.3 acsc_Halt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 4.13.4 acsc_HaltM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 4.13.5 acsc_Kill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 4.13.6 acsc_KillAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 4.13.7 acsc_KillM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 4.13.8 acsc_KillExt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 4.13.9 acsc_Break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 4.13.10 acsc_BreakM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 4.14 Point-to-Point Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 4.14.1 acsc_ToPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 4.14.2 acsc_ToPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 4.14.3 acsc_ExtToPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 4.14.4 acsc_ExtToPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 4.15 Track Motion Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 4.15.1 acsc_Track . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 4.15.2 acsc_SetTargetPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 4.15.3 acsc_GetTargetPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 4.16 Jog Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 4.16.1 acsc_Jog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 4.16.2 acsc_JogM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 4.17 Slaved Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 4.17.1 acsc_SetMaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 4.17.2 acsc_Slave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 4.17.3 acsc_SlaveStalled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 4.18 Multi-Point Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 4.18.1 acsc_MultiPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 4.18.2 acsc_MultiPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 4.19 Arbitrary Path Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 4.19.1 acsc_Spline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 4.19.2 acsc_SplineM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 4.20 PVT Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 4.20.1 acsc_AddPVPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 4.20.2 acsc_AddPVPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 4.20.3 acsc_AddPVTPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 4.20.4 acsc_AddPVTPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 4.21 Segmented Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 4.21.1 acsc_Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 4.21.2 acsc_Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 4.21.3 acsc_ExtLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 4.21.4 acsc_Arc1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 4.21.5 acsc_ExtArc1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 4.21.6 acsc_Arc2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 4.21.7 acsc_ExtArc2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 4.21.8 acsc_Stopper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 4.21.9 acsc_Projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 4.22 Points and Segments Manipulation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 4.22.1 acsc_AddPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 4.22.2 acsc_AddPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 31 January 2009 vii Table of Contents
  8. 8. C Library Reference Version 6.50 Programmer’s Guide 4.22.3 acsc_ExtAddPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 4.22.4 acsc_ExtAddPointM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 4.22.5 acsc_EndSequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 4.22.6 acsc_EndSequenceM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 4.23 Data Collection Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 4.23.1 acsc_DataCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 4.23.2 acsc_StopCollect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 4.23.3 acsc_WaitCollectEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 4.24 Status Report Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 4.24.1 acsc_GetMotorState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 4.24.2 acsc_GetAxisState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 4.24.3 acsc_GetIndexState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 4.24.4 acsc_ResetIndexState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 4.24.5 acsc_GetProgramState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 4.25 Input/Output Access Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 4.25.1 acsc_GetInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 4.25.2 acsc_GetInputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 4.25.3 acsc_GetOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 4.25.4 acsc_GetOutputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 4.25.5 acsc_SetOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 4.25.6 acsc_SetOutputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 4.25.7 acsc_GetAnalogInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 4.25.8 acsc_GetAnalogOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 4.25.9 acsc_SetAnalogOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 4.25.10 acsc_GetExtInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 4.25.11 acsc_GetExtInputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 4.25.12 acsc_GetExtOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 4.25.13 acsc_GetExtOutputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 4.25.14 acsc_SetExtOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 4.25.15 acsc_SetExtOutputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 4.26 Safety Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 4.26.1 acsc_GetFault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 4.26.2 acsc_SetFaultMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 4.26.3 acsc_GetFaultMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 4.26.4 acsc_EnableFault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 4.26.5 acsc_DisableFault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 4.26.6 acsc_SetResponseMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 4.26.7 acsc_GetResponseMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 4.26.8 acsc_EnableResponse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 4.26.9 acsc_DisableResponse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 4.26.10 acsc_GetSafetyInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 4.26.11 acsc_GetSafetyInputPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 4.26.12 acsc_GetSafetyInputPortInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 4.26.13 acsc_SetSafetyInputPortInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 4.26.14 acsc_FaultClear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 4.26.15 acsc_FaultClearM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 4.27 Wait-for-Condition Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 4.27.1 acsc_WaitMotionEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 31 January 2009 viii Table of Contents
  9. 9. C Library Reference Version 6.50 Programmer’s Guide 4.27.2 acsc_WaitLogicalMotionEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 4.27.3 acsc_WaitForAsyncCall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 4.27.4 acsc_WaitProgramEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 4.27.5 acsc_WaitMotorEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 4.27.6 acsc_WaitInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 4.27.7 acsc_WaitUserCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 4.27.8 acsc_WaitMotorCommutated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 4.28 Callback Registration Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 4.28.1 acsc_SetCallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 4.28.2 acsc_SetCallbackExt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 4.28.3 acsc_SetInterruptMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 4.28.4 acsc_GetInterruptMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 4.28.5 acsc_SetCallbackPriority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 4.29 Variables Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 4.29.1 acsc_DeclareVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 4.29.2 acsc_ClearVariables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 4.30 Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 4.30.1 acsc_GetFirmwareVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 4.30.2 acsc_GetSerialNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 4.31 Error Diagnosis Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 4.31.1 acsc_GetMotorError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 4.31.2 acsc_GetMotionError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 4.31.3 acsc_GetProgramError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 4.32 Dual Port RAM (DPRAM) Access Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 4.32.1 acsc_ReadDPRAMInteger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 4.32.2 acsc_WriteDPRAMInteger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 4.32.3 acsc_ReadDPRAMReal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 4.32.4 acsc_WriteDPRAMReal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 4.33 Position Event Generation (PEG) Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 4.33.1 acsc_PegInc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 4.33.2 acsc_PegRandom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 4.33.3 acsc_AssignPins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 4.33.4 acsc_StopPeg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 4.34 Emergency Stop Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 4.34.1 acsc_RegisterEmergencyStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 4.34.2 acsc_UnregisterEmergencyStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 4.35 Application Save/Load Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 4.35.1 acsc_AnalyzeApplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 4.35.2 acsc_LoadApplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 4.35.3 acsc_SaveApplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 4.35.4 acsc_FreeApplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 4.36 Reboot Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 4.36.1 acsc_ControllerReboot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 4.36.2 acsc_ControllerFactoryDefault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 5 Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 6 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 6.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 31 January 2009 ix Table of Contents
  10. 10. C Library Reference Version 6.50 Programmer’s Guide 6.1.1 ACSC_SYNCHRONOUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 6.1.2 ACSC_INVALID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 6.1.3 ACSC_NONE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 6.1.4 ACSC_IGNORE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 6.1.5 ACSC_INT_TYPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 6.1.6 ACSC_REAL_TYPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 6.1.7 ACSC_MAX_LINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 6.1.8 ACSC_COUNTERCLOCKWISE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 6.1.9 ACSC_CLOCKWISE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 6.1.10 ACSC_POSITIVE_DIRECTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 6.1.11 ACSC_NEGATIVE_DIRECTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 6.2 General Communication Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 6.2.1 ACSC_COMM_USECHECKSUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 6.2.2 ASCS_COMM_AUTORECOVER_HW_ERROR . . . . . . . . . . . . . . . . . . . . . 377 6.3 Ethernet Communication Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 6.3.1 ACSC_SOCKET_DGRAM_PORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 6.3.2 ACSC_SOCKET_STREAM_PORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 6.4 Axis Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 6.4.1 ACSC_AXIS_X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 6.4.2 ACSC_AXIS_Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 6.4.3 ACSC_AXIS_Z . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 6.4.4 ACSC_AXIS_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 6.4.5 ACSC_AXIS_A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 6.4.6 ACSC_AXIS_B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 6.4.7 ACSC_AXIS_C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 6.4.8 ACSC_AXIS_D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 6.5 Motion Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 6.5.1 ACSC_AMF_WAIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 6.5.2 ACSC_AMF_RELATIVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 6.5.3 ACSC_AMF_VELOCITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 6.5.4 ACSC_AMF_ENDVELOCITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 6.5.5 ACSC_AMF_POSITIONLOCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 6.5.6 ACSC_AMF_VELOCITYLOCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 6.5.7 ACSC_AMF_CYCLIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 6.5.8 ACSC_AMF_VARTIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 6.5.9 ACSC_AMF_CUBIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 6.5.10 ACSC_AMF_EXTRAPOLATED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 6.5.11 ACSC_AMF_STALLED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 6.5.12 ACSC_AMF_MAXIMUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 6.5.13 ACSC_AMF_SYNCHRONOUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 6.6 Data Collection Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 6.6.1 ACSC_DCF_TEMPORAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 6.6.2 ACSC_DCF_CYCLIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 6.6.3 ACSC_DCF_SYNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 6.6.4 ACSC_DCF_WAIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 6.7 Motor State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 6.7.1 ACSC_MST_ENABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 6.7.2 ACSC_MST_INPOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 31 January 2009 x Table of Contents
  11. 11. C Library Reference Version 6.50 Programmer’s Guide 6.7.3 ACSC_MST_MOVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 6.7.4 ACSC_MST_ACC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 6.8 Axis State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 6.8.1 ACSC_AST_LEAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 6.8.2 ACSC_AST_DC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 6.8.3 ACSC_AST_PEG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 6.8.4 ACSC_AST_MOVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 6.8.5 ACSC_AST_ACC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 6.8.6 ACSC_AST_SEGMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 6.8.7 ACSC_AST_VELLOCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 6.8.8 ACSC_AST_POSLOCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 6.9 Index and Mark State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 6.9.1 ACSC_IST_IND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 6.9.2 ACSC_IST_IND2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 6.9.3 ACSC_IST_MARK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 6.9.4 ACSC_IST_MARK2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 6.10 Program State Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 6.10.1 ACSC_PST_COMPILED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 6.10.2 ACSC_PST_RUN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 6.10.3 ACSC_PST_SUSPEND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 6.10.4 ACSC_PST_DEBUG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 6.10.5 ACSC_PST_AUTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 6.11 Safety Control Masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 6.11.1 ACSC_SAFETY_RL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 6.11.2 ACSC_SAFETY_LL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 6.11.3 ACSC_SAFETY_RL2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 6.11.4 ACSC_SAFETY_LL2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 6.11.5 ACSC_SAFETY_HOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 6.11.6 ACSC_SAFETY_SRL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 6.11.7 ACSC_SAFETY_SLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 6.11.8 ACSC_SAFETY_ENCNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 6.11.9 ACSC_SAFETY_ENC2NC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 6.11.10 ACSC_SAFETY_DRIVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 6.11.11 ACSC_SAFETY_ENC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 6.11.12 ACSC_SAFETY_ENC2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 6.11.13 ACSC_SAFETY_PE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 6.11.14 ACSC_SAFETY_CPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 6.11.15 ACSC_SAFETY_VL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 6.11.16 ACSC_SAFETY_AL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 6.11.17 ACSC_SAFETY_CL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 6.11.18 ACSC_SAFETY_SP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 6.11.19 ACSC_SAFETY_PROG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 6.11.20 ACSC_SAFETY_MEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 6.11.21 ACSC_SAFETY_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 6.11.22 ACSC_SAFETY_ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 6.11.23 ACSC_SAFETY_INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 6.11.24 ACSC_SAFETY_INTGR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 6.12 Callback Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 31 January 2009 xi Table of Contents
  12. 12. C Library Reference Version 6.50 Programmer’s Guide 6.12.1 Hardware Callback Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 6.12.1.1 ACSC_INTR_PEG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 6.12.1.2 ACSC_INTR_MARK1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 6.12.1.3 ACSC_INTR_MARK2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 6.12.1.4 ACSC_INTR_EMERGENCY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 6.12.2 Software Callback Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 6.12.2.1 ACSC_INTR_PHYSICAL_MOTION_END . . . . . . . . . . . . . . . . . . . . . . . 393 6.12.2.2 ACSC_INTR_LOGICAL_MOTION_END . . . . . . . . . . . . . . . . . . . . . . . . 393 6.12.2.3 ACSC_INTR_MOTION_FAILURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 6.12.2.4 ACSC_INTR_MOTOR_FAILURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 6.12.2.5 ACSC_INTR_PROGRAM_END . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 6.12.2.6 ACSC_INTR_COMMAND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 6.12.2.7 ACSC_INTR_ACSPL_PROGRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 6.12.2.8 ACSC_INTR_INPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 6.12.2.9 ACSC_INTR_MOTION_START . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 6.12.2.10 ACSC_INTR_MOTION_PHASE_CHANGE . . . . . . . . . . . . . . . . . . . . . . . 394 6.12.2.11 ACSC_INTR_TRIGGER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 6.12.2.12 ACSC_INTR_MESSAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 6.13 Callback Interrupt Masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 6.14 Configuration Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 7 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 7.1 ACSC_WAITBLOCK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 7.2 ACSC_PCI_SLOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 7.3 ACSC_HISTORYBUFFER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 7.4 ACSC_CONNECTION_DESC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 7.5 Application Save/Load Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 7.5.1 ACSC_APPSL_STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 7.5.2 ACSC_APPSL_SECTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 7.5.3 ACSC_APPSL_ATTRIBUTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 7.5.4 ACSC_APPSL_INFO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 8 Enums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 8.1 ACSC_LOG_DETALIZATION_LEVEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 8.2 ACSC_LOG_DATA_PRESENTATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 8.3 ACSC_APPSL_FILETYPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 9 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 9.1 Reciprocated Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 9.1.1 ACSPL+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 9.1.2 Immediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 9.2 Communication Terminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 31 January 2009 xii Table of Contents
  13. 13. C Library Reference Version 6.50 Programmer’s Guide List of Figures Figure 1 C Library Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Figure 2 Emergency Stop Button. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 31 January 2009 xiii List of Figures
  14. 14. C Library Reference Version 6.50 Programmer’s Guide List of Tables Table 1 Related SPiiPlus Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Table 2 Collateral Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Table 3 Text Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Table 4 Hardware Interrupt Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Table 5 Communication Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Table 6 Service Communication Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Table 7 ASSPL+ Program Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Table 8 Read and Write Variables Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Table 9 Load File to ACSPL+ Variables Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Table 10 Multiple Thread Synchronization Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Table 11 History Buffer Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Table 12 Unsolicited Messages Buffer Management Functions. . . . . . . . . . . . . . . . . . . . . . . . . . 95 Table 13 Log File Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Table 14 System Configuration Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Table 15 Setting and Reading Motion Parameters Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Table 16 Axis/Motor Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Table 17 Motion Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Table 18 Point-to-Point Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Table 19 Track Motion Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Table 20 Jog Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Table 21 Slaved Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Table 22 Multi-point Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Table 23 Arbitrary Path Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Table 24 PVT Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 Table 25 Segmented Motion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Table 26 Points and Segments Manipulation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Table 27 Data Collection Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 Table 28 Status Report Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Table 29 Input/Output Access Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Table 30 Safety Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 Table 31 Wait-for-Condition Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 Table 32 Callback Registration Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 Table 33 Variables Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 Table 34 Service Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 Table 35 Error Diagnosis Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 Table 36 Dual Port RAM (DPRAM) Access Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 Table 37 Position Event Generation (PEG) Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 Table 38 Emergency Stop Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Table 39 Application Save/Load Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 Table 40 Reboot Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 Table 41 Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 Table 42 Callback Interrupt Masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Table 43 Configuration Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 31 January 2009 xiv List of Tables
  15. 15. C Library Reference Version 6.50 Programmer’s Guide 1 Introduction The SPiiPlus C Library supports the creation of a user application that operates on a PC host computer and communicates with SPiiPlus motion controllers. The SPiiPlus C 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 Organization of this Guide This guide is organized as follows: • Chapter 2 "SPiiPlus C Library Overview" • Chapter 3 "Using the SPiiPlus C Library" • Chapter 4 "C Library Functions" • Chapter 5 "Error Codes" • Chapter 6 "Constants" • Chapter 7 "Structures" • Chapter 8 "Enums" • Chapter 9 "Sample Programs" 1.2 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. Version 6.50, 31 January 2009 1 Introduction
  16. 16. C Library Reference Version 6.50 Programmer’s Guide Table 1 Related SPiiPlus Tools Tool Description 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 C#, Visual Basic, LabView, 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. 1.3 SPiiPlus Documentation Table 2 Collateral Documentation (page 1 of 2) 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 Command & Variable Complete description of all variables and commands in the Reference Guide ACSPL+ programming language. 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) Analyzer? Guide is a powerful servo analysis GUI for ACS Motion Control SPiiPlus motion controllers. Version 6.50, 31 January 2009 2 Introduction
  17. 17. C Library Reference Version 6.50 Programmer’s Guide Table 2 Collateral Documentation (page 2 of 2) Document Description SPiiPlus Modbus User’s Guide Describes Modbus setup and register address. SPiiPlus SA, SA-LT and SAR- Installation and hardware connection with the SPiiPlus SA LT Hardware Guide SPiiPlus SA-LT, and SAR-LT Controllers SPiiPlus 3U-LT & SPiiPlus 3U- Installation and hardware connection with the SPiiPlus 3U HP Hardware Guide Controller. 1.4 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. 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. Italic Blue Text Indicates name of referenced document. | Used in command syntax to indicate input of one alternative or another. Used in GUI descriptions to indicate 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. Version 6.50, 31 January 2009 3 Introduction
  18. 18. C Library Reference Version 6.50 Programmer’s Guide 1.5 Statement Text and Icons Used in this Guide Note Notes include helpful information or tips. Caution A Caution describes a condition that may result in damage to equipment. Warning A Warning describes a condition that may result in serious bodily injury or death. Advanced Indicates a topic for advanced users. Model Highlights a specification, procedure, condition, or statement that depends on the product model. Version 6.50, 31 January 2009 4 Introduction
  19. 19. C Library Reference Version 6.50 Programmer’s Guide 2 SPiiPlus C Library Overview 2.1 Operation Environment The SPiiPlus C Library supports Microsoft® Windows® 2000, XP (32-bit and 64-bit), and Vista (32-bit and 64-bit). The previous version (v.4.50) of the C Library does not support remote access under Windows XP with Service Pack 2. The reason is that Service Pack 2 prevents unauthorized remote access. To provide authorized remote access in all supported versions of Windows, C Library v.5.0 and above supports the NTLM authentication protocol that performs security handshaking between the server and client. The protocol determines if the client have appropriate access rights to the machine that runs the C Library User-Mode Driver (UMD). Authorized remote access is supported in Windows 2000, Windows XP (Service Pack 1, Service Pack 2 and Service Pack 3), and Vista. 2.2 Communication Log 2.2.1 Run-Time Logging The UMD logs constantly at run-time. The data is stored in binary format in an internal cyclic buffer and is translated to text just before it is written to file. 2.2.2 Log Types The user may choose one of two mutually exclusive log types: • Dump on Request – all the binary data that is stored in the internal binary buffer and is flushed by explicit request to the file, see acsc_FlushLogFile. • Continuous – there is a background thread that takes care of periodic file update. It reads the binary buffer and performs text formatting to the file. 2.3 C Library Concept The C Library is a software package that allows Host-based applications to communicate with the SPiiPlus controller in order to program, send commands, and query controller status. The C Library includes user-mode and kernel-mode drivers that perform various communication tasks. 31 January 2009 5 SPiiPlus C Library Overview
  20. 20. C Library Reference Version 6.50 Programmer’s Guide The host application is provided with a robust C Function API to make calls the C Library which in turn communicates with the SPiiPlus Controller through the controller drivers. The controller then returns the reply to the to the caller application. The host application may contact C Library from remote location by setting its IP address or the machine name. Set the IP address with the acsc_SetServer function. Up to four host applications may communicate with the controller simultaneously via a single physical connection. Host Computer Remote Computer Host Application 1 Host Application 2 Remote C Library Application SPiiPlus SPiiPlus SPiiPlus SPiiPlus Figure 1 C Library Concept 2.4 Communication Channels The SPiiPlus C Library supports all communication channels provided by SPiiPlus motion controllers: • Serial (RS-232) • Ethernet (point-to-point and Network) • PCI Bus 2.5 Controller Simulation The SPiiPlus C Library includes the controller simulator operating on the same PC as the user application. The simulator provides execution of the user application without the physical controller for debugging and demonstration purposes. 31 January 2009 6 SPiiPlus C Library Overview
  21. 21. C Library Reference Version 6.50 Programmer’s Guide 2.6 Programming Languages The library directly supports development of C/C++ applications. Visual Basic®, C# or other languages can also be used with a little additional effort. For languages other than C/C++, the SPiiPlus COM library is recommended. 2.7 Supplied Components The library includes a DLL, a device driver, an import library, and a header file for C/C++ compilers. 2.8 Highlights • Unified support of all communication channels (Serial, Ethernet, PCI Bus) All functions except acsc_OpenComm*** functions are identical for all communication channels. The user application remains substantially the same and works through any of the available communication channels. • Controller simulator as an additional communication channels All library functions can work with the Simulator exactly as with the actual controller. The user 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. • Support of multi-threaded user application The user application can consist of several threads. Each thread can call SPiiPlus C Library functions simultaneously. The library also provides special functions for the synchronization SPiiPlus C functions called from concurrent threads. • Automatic synchronization and mutual exclusion of concurrent threads Both waiting and non-waiting calls of SPiiPlus C functions can be used from different threads without any blocking or affect one to another. The library provides automatic synchronization and mutual exclusion of concurrent threads so the threads are not delayed one by another. Each thread operates with its maximum available rate. • Concurrent support of up to 10 communication channels in one application One application can open up to 10 communication channels simultaneously. Different communication channels are usually connected to different controllers. However, two or more communication channels can be connected to one controller. For example, one application can communicate with one controller through both Ethernet and serial links. • Acknowledgement for each controller command 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. This applies for both waiting and non-waiting calls. 31 January 2009 7 SPiiPlus C Library Overview
  22. 22. C Library Reference Version 6.50 Programmer’s Guide • Communication history The library supports the storage of all messages sent to and received from the controller in a memory buffer. The application can retrieve the full or partial contents of the buffer and can clear the history buffer. • Separate processing of unsolicited messages Most messages sent from the controller to the host are responses to the host commands. However, the controller can send unsolicited messages, for example, because of executing the disp command. The library separates the unsolicited messages from the overall message flow and provides special function for handling unsolicited messages. • Rich set of functions for setting and reading parameters, motion, program management, I/O ports, safety controls, and other. • Two calling modes Most library functions can be called in either waiting or non-waiting mode. In waiting mode, the calling thread does not continue until the controller acknowledges the command execution. In non-waiting mode, a function returns immediately and the actual work of sending the command and receiving acknowledgement is performed by the internal thread of the library. • Debug Tools The library provides different 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. • Setting user callback functions for predefined events The possibility exists to set a callback function that will be called when a specified event occurs in the controller. This lets you define a constant reaction by the user host application to events inside the controller without polling the controller status (see Section 2.10 Callbacks). • Wait-for-Condition Functions To facilitate user programming, the library includes functions that delay the calling thread until a specific condition is satisfied. Some of the functions periodically pole the relevant controller status until the condition is true, or the time out expired. Some of these functions are based on the callback mechanism, see Section 2.10 Callbacks. The functions with this option are: • acsc_WaitMotionEnd • acsc_WaitLogicalMotionEnd • acsc_WaitProgramEnd • acsc_WaitInput These functions will use the callback mechanism if the callback to the relevant event is set, otherwise polling is used. 31 January 2009 8 SPiiPlus C Library Overview
  23. 23. C Library Reference Version 6.50 Programmer’s Guide • Support for Windows 2000/XP (32-bit and 64-bit)/Vista (32-bit and 64-bit) The user application that communicates through the library takes no notice of the operational environment. The library itself chooses the proper device driver and conceals all differences between the operating systems from the user application. 2.9 Use of Functions Each library function performs a specific controller operation. To perform its task, the function sends one or more commands to the controller and validates the controller responses. Because the SPiiPlus C functions follow the C syntax and have self-explaining names, the application developer is not required to be an expert in ACSPL+ language. However, the most time-critical part of an application often needs to be executed in the controller and not in the host. This part still requires ACSPL+ programming. To use the SPiiPlus C Library functions from C/C++ environment, it is necessary to include the header file ACSC.h and the import library file ACSC_x86.lib or ACSC_x64.lib, whichever is appropriate, to the project. An example of a function is the following that implements a motion to the specified point: int acsc_ToPoint(HANDLE Handle, int Flags, int Axis, double Point, ACSC_WAITBLOCK* Wait) Where: • Handle is a communication handle returned by one of the acsc_OpenComm*** functions. • Flags are a bit-mapped parameter that can include one or more motion flags. For example: ACSC_AMF_WAIT Plan the motion, but don’t start until the acsc_Go function is called 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 is an axis of the motion where ACSC_AXIS_X corresponds to X, ACSC_AXIS_Y – to Y, and so on. • Point is a coordinate of the target point. • Wait is used for non-waiting calls. Non-waiting calls are discussed in the next section. 31 January 2009 9 SPiiPlus C Library Overview
  24. 24. C Library Reference Version 6.50 Programmer’s Guide 2.10 Callbacks There is an option to define an automatic response in the user application to several events inside the controller. The user specifies a function that will be called when certain event occurs. This approach helps user application to avoid polling of the controller status and only to execute the defined reaction when it is needed. The library may set several callbacks in the same time. Every one of them runs in its own thread and doesn’t delay the others. Callbacks are supported in all communication channels. The library hides the difference from the application, so that the application handles the callbacks in all channels in the same way. The events that may have a callback functions are: • Hardware detected events • PEG • MARK1 and MARK2 • Emergency Stop • Software detected events • Physical motion end • Logical motion end • Motion failure • Motor failure • ACSPL+ program end • ACSPL+ line execution • ACSPL + “interrupt” command execution • Digital input goes high • Motion start • Motion profile phase change • Trigger function detects true trigger condition • Controller sent complete message on a communication channel 2.11 Timing When working with PCI bus, the callbacks are initiated through physical interrupts generated by the controller. In the Simulator, the interrupt mechanism is emulated with OS mechanisms. In all other kinds of communication, the controller sends an alert message over the communication channel in order to inform the host about the event. Although the implementation is transparent, the timing is different varies for each communication channel as follows: • In PCI communication, the callbacks are based upon PCI interrupts and response is very fast (sub-millisecond level). 31 January 2009 10 SPiiPlus C Library Overview
  25. 25. C Library Reference Version 6.50 Programmer’s Guide • In all other channels, callback operation includes sending/receiving a message that requires much more time. Specific figures depend on the communication channel rate. From the viewpoint of the Callback Mechanism, all communication channels are functionally equivalent, but differ in timing. 2.12 Hardware Interrupts Hardware events (Emergency Stop, PEG and MARK) are detected by the controllers HW and an interrupt on PCI bus is generated automatically, while on other communication channels those events are recognized by the Firmware and only then an alert message may be sent. That is why there is a difference in the definition of the Event condition for different communication channels. Table 4 Hardware Interrupt Generation Callback Condition of PCI Condition of Alert Message (all Interrupt channels except PCI) Emergency stop The interrupt is The message is sent when the S_FAULT.#ES generated on positive or bit changes from zero to one. negative edge of the The message is disabled if S_FMASK.#ES is input ES signal.The edge zero. is selected by S_SAFINI.#ES bit. Mark 1 and Mark The interrupt is The message is sent when the corresponding 2 generated on positive IST.#MARK or IST.#MARK2 bit changes edge of the from zero to one. corresponding Mark signal. PEG The interrupt is The message is sent when corresponding generated on negative AST.#PEG bit changes from one to zero. edge of PEG pulse. 2.13 Dual-Port RAM (DPRAM) The DPRAM is a memory block that is accessible from the host and from the controller. This feature provides fast data exchange between the host and the controller. The SPiiPlus controller provides 1024 bytes of dual-port ram memory (DPRAM). Relative address range of DPRAM is from byte 0 to byte 0x3FF. The first 128 bytes (relative addresses from 0 to 0x080) are reserved for system use. The rest of the memory is free for the user needs. The DPRAM functions are available with any communication channel, however it is important to remember that only PCI bus communication provide real physical access to controllers DPRAM and works very fast (sub-millisecond level). 31 January 2009 11 SPiiPlus C Library Overview
  26. 26. C Library Reference Version 6.50 Programmer’s Guide In all other channels, the DPRAM operation is simulated. Each operation includes communication with the controller. Specific figures depend on the communication channel rate. Using DPRAM communication in a non-PCI communication channel is recommended if an application is primarily intended for PCI channel, but requires full compatibility with other communication channels. 2.14 Non-Waiting Calls There are three possible approaches regarding when a library function returns control to the calling thread: • Waiting call The function waits for the controller response and then returns. For many commands, the controller response does not signal the completion of the operation. The controller response only acknowledges that the controller accepted the command and started the process of its execution. For example, the controller responds to a motion command when it has planned the motion, but has not executed yet. • Non-waiting call The library function initiates transmission of the command to the controller and returns immediately without waiting for the controller response. An internal library thread sends the command to the controller and retrieves the result. To get the result of operation the application calls the acsc_WaitForAsyncCall function. • Non-waiting call with neglect of operation results The same as the previous call, only the library does not retrieve the controller response. This mode can be useful when the application ignores the controller responses. Most library functions can be called in either waiting or non-waiting mode. The pointer Wait to the ACSC_WAITBLOCK structure provides the selection between waiting and non- waiting modes as follows: • Zero Wait (NULL character) defines a waiting call. The function does not return until the controller response is received. Note Do not use ‘0’ as the Null character. • If Wait is a valid pointer, the call is non-waiting and the function returns immediately. • If Wait is ACSC_IGNORE, the call is non-waiting and will neglect of the operation result. ACSC_WAITBLOCK is defined as follows: Structure: ACSC_WAITBLOCK { HANDLE Event; int Ret; }; 31 January 2009 12 SPiiPlus C Library Overview
  27. 27. C Library Reference Version 6.50 Programmer’s Guide When a thread activates a non-waiting call, the library passes the request to an internal thread that sends the command to the controller and then monitors the controller responses. When the controller responds to the command, the internal thread stores the response in the internal buffers. The calling thread can retrieve the controller response with help of the acsc_WaitForAsyncCall function and validate the completion result in the Ret member of the structure. Up to 256 non-waiting calls can be activated before any acsc_WaitForAsyncCall is called. It is important to understand that acsc_WaitForAsyncCall must be called for every non-waiting call. Otherwise, the response will be stored forever in the library’s internal buffers. A call, which is called when more then 256 calls are already activated is delayed for a certain time and waits until acsc_WaitForAsyncCall is called by one of the previous calls. If the time expires, an ACSC_COMMANDSQUEUEFULL error is returned. By default, this time-out is zero. This means that the call number 257 immediately returns with the ACSC_COMMANDSQUEUEFULL error . Note If you work with multiple non-waiting calls and the ACSC_COMMANDSQUEUEFULL error pops up all the time, the structure of your application is too demanding. This means that you are trying to activate more than 256 calls without retrieving the results. If the error message pops up occasionally, try increasing the timeout. Time-out is controlled by acsc_GetQueueOverflowTimeout and acsc_SetQueueOverflowTimeout functions. The following example shows how to perform waiting and non-waiting calls. In this example the acsc_WaitForAsyncCall function was used. Any function that has Wait as a parameter can be used to perform waiting and non-waiting calls. #include “ACSC.h” Char* cmd = “?$r”; // get motors state char buf[101]; int Received; ACSC_WAITBLOCK wait; // example of the waiting call of acsc_Transaction if (!acsc_Transaction( Handle, // communication handle cmd, // pointer to the buffer that // contains command to be executed strlen(cmd), // size of this buffer 31 January 2009 13 SPiiPlus C Library Overview
  28. 28. C Library Reference Version 6.50 Programmer’s Guide buf, // input buffer that receives // controller response 100, // size of this buffer &Received, // number of characters that were //actually received NULL // waiting call { printf(“transaction error: %dn”, acsc_GetLastError()); } // example of non-wainig call of acsc_Transaction if (acsc_Transaction(Handle,cmd,strlen(cmd),buf,100,&Received,&wait)) { // something doing here …. // retrieve controller response if (acsc_WaitForAsyncCall(Handle, buf, &Received, &wait, 5000)) { buf[Received] = ‘0’; printf(“Motors state: %sn”, buf); } else { acsc_GetErrorString(Handle, wait.Ret, buf, 100, &Received); buf[Received] = ‘0’; printf(“error: %sn”, buf); } } 31 January 2009 14 SPiiPlus C Library Overview
  29. 29. C Library Reference Version 6.50 Programmer’s Guide else { printf(“transaction error: %dn”, acsc_GetLastError()); } // Example of non-waiting call of acsc_Transaction with neglect of the // operation result. Function does not wait for the controller response. // The call of acsc_WaitForAsyncCall has no sense because it does not // return the controller response for this calling mode. If (acsc_Transaction( Handle,cmd,strlen(cmd),buf, 100, &Received, ACSC_IGNORE)) { printf(“transaction error: %dn”, acsc_GetLastError()); } 31 January 2009 15 SPiiPlus C Library Overview
  30. 30. C Library Reference Version 6.50 Programmer’s Guide 3 Using the SPiiPlus C Library 3.1 Library Structure The C Library is built from several levels, from Kernel-mode drivers on one end, to high level C function APIs on the other, and include: • ACSPCI32.SYS (for 32-bit), ACSPCI64.SYS (for 64-bit), WINDRVR6.SYS – Kernel- mode drivers for low-level communication support. These drivers are automatically installed and registered when the user installs the SPiiPlus software package. These drivers are required for communication with the controller through the PCI bus. • ACSCSRV.EXE – User-mode driver for high-level communication support. When this driver is active, there is an icon in the notification area at the bottom-right corner of the screen. This driver is necessary for all communication channels. The driver is automatically installed and registered when the user installs the SPiiPlus software package. • ACSCL_X86.DLL – Dynamic Link Library that contains the API functions. The DLL is installed in the SYSTEM32 directory, so it is accessible to all host applications. It is designed to operate in a 32-bit environment. • ACSCL_X64.DLL – Dynamic Link Library that contains the API functions. The DLL is installed in the SYSTEM32 directory, so it is accessible to all host applications. It is designed to operate in a 64-bit environment. • ACSCL_X86.LIB – Static LIB file required for a C/C++ project to access the DLL functions. It is designed to operate in a 32-bit environment. • ACSCL_X64.LIB – Static LIB file required for a C/C++ project to access the DLL functions. It is designed to operate in a 64-bit environment. Note A 32-bit software development should link against ACSCL_X86.LIB. A 64-bit software development should link against ACSCL_X64.LIB. • ACSC.H – C header file with API functions and Constant declarations. 3.2 Building C/C++ Applications To facilitate using the C Library in user applications, the installation includes the ACSC.H, and ACSC_x86.LIB or ACSC_x64.LIB files. The files are not required for running the C Library, and are only used for building user applications. In order to use the C Library functions in your application, proceed as follows: 1. Copy files from Program FilesACS Motion ControlSPiiPlus …ACSC to the project directory. Include file ACSCL_X86.LIB, or ACSCL_X86.LIB (as appropriate), in your C/C++ project. 31 January 2009 16 Using the SPiiPlus C Library

×