SPiiPlus C Library Reference Programmers Guide
SPiiPlus C Library Reference Programmers Guide
Programmer's Guide
May 2024
Document Revision: 3.14.01
SPiiPlus C Library Reference Programmer's Guide
COPYRIGHT
Changes are periodically made to the information in this document. Changes are published as release notes and later
incorporated into revisions of this document.
No part of this document may be reproduced in any form without prior written permission from ACS Motion Control.
TRADEMARKS
EtherCAT® is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
Any other companies and product names mentioned herein may be the trademarks of their respective owners.
PATENTS
www.acsmotioncontrol.com
NOTICE
The information in this document is deemed to be correct at the time of publishing. ACS Motion Control reserves the right to
change specifications without notice. ACS Motion Control is not responsible for incidental, consequential, or special damages
of any kind in connection with using this document.
Version 3.14.01 2
SPiiPlus C Library Reference Programmer's Guide
Revision History
Date Revision Description
September
3.12.01 Corrected acsc_SaveApplication example
2022
May 2022 3.12 New Version Release, NURBS, SPATH, PEG functions
Version 3.14.01 3
SPiiPlus C Library Reference Programmer's Guide
September
2.40.10 Updated number of buffers to 63
2017
September
01 First Release
2014
Version 3.14.01 4
SPiiPlus C Library Reference Programmer's Guide
Related Documentation
Documents listed in the following table provide additional information related to this document.
Authorized users can download the latest versions of the documents from ACS Downloads.
Document Description
SPiiPlus Command & Command and variables of high level language for
Variable Reference Guide programming SPiiPlus controllers.
SPiiPlus COM Library COM Methods, Properties, and Events for Communication with
Reference Guide the Controller
PEG and MARK Operations A guide to the PEG and MARK operations for the SPiiPlus family
Application Notes of controllers.
SPiiPlus ADK Suite v2.50 Describes new features and changes introduced since the last
Release Notes SPiiPlus ADK Suite version 2.40 release.
Version 3.14.01 5
SPiiPlus C Library Reference Programmer's Guide
Format Description
Blue Hyperlink
Flagged Text
Version 3.14.01 6
SPiiPlus C Library Reference Programmer's Guide
Table of Contents
1. Introduction 27
1.1 Document Scope 27
2. SPiiPlus C Library Overview 28
2.1 Communication Log 28
2.1.1 Run-Time Logging 28
2.1.2 Log Types 28
2.2 C Library Concept 28
2.3 Communication Channels 29
2.4 Controller Simulation 29
2.5 Programming Languages 29
2.6 Supplied Components 29
2.7 Highlights 29
2.8 Use of Functions 31
2.9 Callbacks 32
2.9.1 Timing 33
2.9.2 Hardware Interrupts 33
2.10 Dual-Port RAM (DPRAM) 33
2.11 Shared Memory 34
2.12 Non-Waiting Calls 34
3. Using the SPiiPlus C Library 37
3.1 Library Structure 37
3.2 Building C/C++ Applications 37
3.3 Redistribution of User Application 38
3.3.1 Redistributed Files 38
3.3.2 File Destinations 38
3.3.3 Kernel Mode Driver Registration 39
4. C Library Functions 41
4.1 Communication Functions 42
4.1.1 acsc_OpenCommSerial 43
4.1.2 acsc_OpenCommEthernetTCP 44
4.1.3 acsc_OpenCommEthernetUDP 45
4.1.4 acsc_OpenCommSimulator 46
Version 3.14.01 7
SPiiPlus C Library Reference Programmer's Guide
4.1.5 acsc_CloseSimulator 46
4.1.6 acsc_OpenCommPCI 47
4.1.7 acsc_GetPCICards 48
4.1.8 acsc_SetServerExtLogin 49
4.1.9 acsc_CloseComm 50
4.1.10 acsc_Transaction 51
4.1.11 acsc_Command 53
4.1.12 acsc_CancelOperation 54
4.1.13 acsc_GetEthernetCardsExt 55
4.1.14 acsc_GetConnectionsList 58
4.1.15 acsc_GetConnectionInfo 59
4.1.16 acsc_TerminateConnection 60
4.2 Service Communication Functions 61
4.2.1 acsc_GetCommOptions 62
4.2.2 acsc_GetDefaultTimeout 63
4.2.3 acsc_GetErrorString 63
4.2.4 acsc_GetLastError 64
4.2.5 acsc_GetLibraryVersion 65
4.2.6 acsc_GetTimeout 66
4.2.7 acsc_SetIterations 66
4.2.8 acsc_SetCommOptions 67
4.2.9 acsc_SetTimeout 68
4.2.10 acsc_SetQueueOverflowTimeout 69
4.2.11 acsc_GetQueueOverflowTimeout 69
4.3 ACSPL+ Program Management Functions 70
4.3.1 acsc_AppendBuffer 71
4.3.2 acsc_ClearBuffer 73
4.3.3 acsc_CompileBuffer 74
4.3.4 acsc_LoadBuffer 75
4.3.5 acsc_LoadBufferIgnoreServiceLines 77
4.3.6 acsc_LoadBuffersFromFile 78
4.3.7 acsc_RunBuffer 79
4.3.8 acsc_StopBuffer 81
4.3.9 acsc_SuspendBuffer 82
Version 3.14.01 8
SPiiPlus C Library Reference Programmer's Guide
4.3.10 acsc_UploadBuffer 83
4.3.11 acsc_DefineControllerProtection 84
4.3.12 acsc_RemoveControllerProtection 86
4.3.13 acsc_TemporarilyDisableVariableProtection 87
4.3.14 acsc_RestoreVariableProtection 88
4.4 Read and Write Variables Functions 89
4.4.1 acsc_ReadInteger 89
4.4.2 acsc_WriteInteger 91
4.4.3 acsc_ReadReal 93
4.4.4 acsc_WriteReal 95
4.4.5 acsc_ReadString 96
4.4.6 acsc_WriteString 98
4.4.7 acsc_ReadStruct 99
4.4.8 acsc_WriteStruct 100
4.5 Load/Upload Data To/From Controller Functions 102
4.5.1 acsc_LoadDataToController 102
4.5.2 acsc_UploadDataFromController 105
4.6 Multiple Thread Synchronization Functions 107
4.6.1 acsc_CaptureComm 107
4.6.2 acsc_ReleaseComm 108
4.7 History Buffer Management Functions 108
4.7.1 acsc_OpenHistoryBuffer 109
4.7.2 acsc_CloseHistoryBuffer 109
4.7.3 acsc_GetHistory 110
4.8 Unsolicited Messages Buffer Management Functions 111
4.8.1 acsc_OpenMessageBuffer 112
4.8.2 acsc_CloseMessageBuffer 113
4.8.3 acsc_GetSingleMessage 113
4.8.4 acsc_GetMessage 114
4.9 Log File Management Functions 116
4.9.1 acsc_SetLogFileOptions 116
4.9.2 acsc_OpenLogFile 117
4.9.3 acsc_CloseLogFile 118
4.9.4 acsc_WriteLogFile 118
Version 3.14.01 9
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 10
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 11
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 12
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 13
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 14
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 15
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 16
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 17
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 18
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 19
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 20
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 21
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 22
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 23
SPiiPlus C Library Reference Programmer's Guide
List Of Figures
Figure 3-1. C Library Concept 29
Figure 5-1. Emergency Stop Button 488
Version 3.14.01 24
SPiiPlus C Library Reference Programmer's Guide
List of Tables
Table 5-1. Communication Functions 42
Table 5-2. Service Communication Functions 61
Table 5-3. ACSPL+ Program Management Functions 70
Table 5-4. Read and Write Variables Functions 89
Table 5-5. Load File to ACSPL+ Variables Functions 102
Table 5-6. Multiple Thread Synchronization Functions 107
Table 5-7. History Buffer Management Functions 108
Table 5-8. Unsolicited Messages Buffer Management Functions 111
Table 5-9. Log File Management Functions 116
Table 5-10. SPiiPlusSC Log File Management Functions 121
Table 5-11. System Configuration Functions 124
Table 5-12. Setting and Reading Motion Parameters Functions 134
Table 5-13. Axis/Motor Management Functions 162
Table 5-14. Motion Management Functions 174
Table 5-15. Point-to-Point Motion Functions 187
Table 5-16. Track Motion Control Functions 203
Table 5-17. Jog Functions 207
Table 5-18. Slaved Motion Functions 211
Table 5-19. Multi-Point Motion Functions 217
Table 5-20. Arbitrary Path Motion Functions 222
Table 5-21. PVT Functions 229
Table 5-22. Segmented Motion Functions 236
Table 5-23. Points and Segments Manipulation Functions 296
Table 5-24. Data Collection Functions 306
Table 5-25. Status Report Functions 317
Table 5-26. Input/Output Access Functions 325
Table 5-27. Safety Control Functions 344
Table 5-28. Wait-for-Condition Functions 368
Table 5-29. Callback Registration Functions 378
Table 5-30. Variables Management Functions 387
Table 5-31. Service Functions 390
Version 3.14.01 25
SPiiPlus C Library Reference Programmer's Guide
Version 3.14.01 26
SPiiPlus C Library Reference Programmer's Guide
1. Introduction
1. Introduction
1.1 Document Scope
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.
Version 3.14.01 27
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
Version 3.14.01 28
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
2.7 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.
Version 3.14.01 29
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
Version 3.14.01 30
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
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:
Version 3.14.01 31
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
ACSC_AMF_
Plan the motion, but don’t start until the acsc_Go function is called.
WAIT
ACSC_AMF_ The Point value is relative to the end-point of the previous motion. If the flag
RELATIVE is not specified, the Point specifies an absolute coordinate.
2.9 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
Version 3.14.01 32
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
2.9.1 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).
> 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.
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.
Version 3.14.01 33
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
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).
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.
Shared Memory is applicable only to the SPiiPlusSC. For details of the SPiiPlus SC see the
SPiiPlusSC Motion Controller User Guide.
Shared Memory refers to a 100 KByte section of the memory where variables used by both the
SPiiPlus SC RTOS processes and the Windows processes are stored. Access to the shared memory by
the Windows applications does not affect the RTOS execution. Special C read and write functions
have been incorporated to access the Shared Memory (see Shared Memory Functions).
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.
Version 3.14.01 34
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
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.
> 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;};
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.
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.
#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
Version 3.14.01 35
SPiiPlus C Library Reference Programmer's Guide
2. SPiiPlus C Library Overview
Version 3.14.01 36
SPiiPlus C Library Reference Programmer's Guide
3. Using the SPiiPlus C Library
> ACSC.H – C header file with API functions and Constant declarations.
Version 3.14.01 37
SPiiPlus C Library Reference Programmer's Guide
3. Using the SPiiPlus C Library
accessible to the application. The library installation puts the file in the SYSTEM32 directory,
where it can be found by any application.
> ACSCL_X64.DLL – ACS Motion Control© C Library API for 64-bit environment
> ACSPCI32.SYS – ACS Motion Control© kernel-mode PCI Device Driver (for 32-bit
environment)
> ACSPCI64.SYS – ACS Motion Control© kernel-mode PCI Device Driver (for 64-bit
environment)
> ACS.ESTOP.EXE – ACS Motion Control© SPiiPlus Emergency Stop
> ACSCSRV.EXE – ACS Motion Control© SPiiPlus User Mode Driver (UMD)
Version 3.14.01 38
SPiiPlus C Library Reference Programmer's Guide
3. Using the SPiiPlus C Library
In order to provide WinDriver information for Windows "Plug and Play," redistribute INF files as
follows:
> ACSPCI.INF
> WINDRVR6.INF
The INF files are required only for registration process; they should be placed in well-
known destinations.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run a new
string value named “ACSCSRV”
The string should contain the full path to the location of ACSCSRV.EXE.
On start-up Windows will start the UMD on the current machine for each user that logs in.
Version 3.14.01 39
SPiiPlus C Library Reference Programmer's Guide
3. Using the SPiiPlus C Library
Version 3.14.01 40
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4. C Library Functions
This chapter describes each of the functions available in the SPiiPlus C Library. The functions are
arranged in functional groups.
For each function there is a:
> Description - A short description of the use of the function
> Syntax - The calling syntax
> Arguments - List and definition of function arguments
> Return value - A description of the value, if any, that the function returns
> Comments - Where relevant, additional information on the function
> Example - Short code example in C language
The functions are grouped in the following categories:
> Communication Functions
> Service Communication Functions
> ACSPL+ Program Management Functions
> Read and Write Variables Functions
> Load/Upload Data To/From Controller Functions
> Multiple Thread Synchronization Functions
> History Buffer Management Functions
> Unsolicited Messages Buffer Management Functions
> Log File Management Functions
> SPiiPlusSC Log File Management Functions
> System Configuration Functions
> Setting and Reading Motion Parameters Functions
> Axis/Motor Management Functions
> Motion Management Functions
> Point-to-Point Motion Functions
> Track Motion Control Functions
> Jog Functions
> Slaved Motion Functions
> Multi-Point Motion Functions
> Arbitrary Path Motion Functions
> PVT Functions
> Segmented Motion Functions
> Points and Segments Manipulation Functions
Version 3.14.01 41
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Function Description
acsc_OpenCommPCI Opens communication with the SPiiPlus PCI via PCI Bus.
Version 3.14.01 42
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Function Description
4.1.1 acsc_OpenCommSerial
Description
The function opens communication with the controller via a serial port.
Syntax
HANDLE acsc_OpenCommSerial(int Channel, int Rate)
Arguments
Rate This parameter must be equal to the controller variable IOBAUD for the
successful link with the controller. If ACSC_AUTO constant is passed, the
function will automatically determine the baud rate.
Return Value
If the function succeeds, the return value is a valid communication handle. The handle must be used
in all subsequent function calls that refer to the open communication channel.
If the function fails, the return value is ACSC_INVALID (-1).
Version 3.14.01 43
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Comments
After a channel is open, any SPiiPlus C function works with the channel irrespective of the physical
nature of the channel.
Example
4.1.2 acsc_OpenCommEthernetTCP
Description
The function opens communication with the controller via Ethernet using TCP protocol.
Syntax
int acsc_OpenCommEthernetTCP(char* Address, int Port)
Arguments
Return Value
If the function succeeds, the return value is a valid communication handle. The handle must be used
in all subsequent function calls that refer to the open communication channel.
If the function fails, the return value is ACSC_INVALID (-1).
Comments
None.
Version 3.14.01 44
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
HANDLE hComm=(HANDLE)-1;
int Port = 703;
hComm = acsc_OpenCommEthernetTCP("10.0.0.1",Port);
if (hComm == ACSC_INVALID)
{
printf("Error while opening communication: %d\n",
acsc_GetLastError());
return -1;
}
4.1.3 acsc_OpenCommEthernetUDP
Description
The function opens communication with the controller via Ethernet using the UDP protocol.
Syntax
int acsc_OpenCommEthernetUPD(char* Address, int Port)
Arguments
Return Value
If the function succeeds, the return value is a valid communication handle. The handle must be used
in all subsequent function calls that refer to the open communication channel.
If the function fails, the return value is ACSC_INVALID (-1).
Comments
None
Example
HANDLE hComm=(HANDLE)-1;
int Port = 704;
hComm = acsc_OpenCommEthernetUDP("10.0.0.1",Port);
if (hComm == ACSC_INVALID)
Version 3.14.01 45
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
{
printf("Error while opening communication: %d\n",
acsc_GetLastError());
return -1;
}
4.1.4 acsc_OpenCommSimulator
Description
The function executes the SPiiPlus stand-alone simulator via SPiiPlus User ModeDriver in the case
that it is not running.
The function connects to the simulator via TCP/IP protocol.
Syntax
HANDLE acsc_OpenCommSimulator()
Return value
If the function succeeds, then the return value is a HANDLE that is used as a standing connection to
the simulator.
If the function fails, then the return value is ACSC_INVALID (-1) and an appropriate error is set.
Error codes (in case of failure)
ACSC_SIMULATOR_RUN_EXT – if the ports set for simulator in UMD are taken by another application.
ACSC_SIMULATOR_NOT_SET – in case a simulator execution attempt was made without setting a
simulator executable and default simulator executable was not found.
Example
4.1.5 acsc_CloseSimulator
Description
The function Stops the SPiiPlus simulator via UMD in the case that it is running.
Syntax
int acsc_CloseSimulator()
Return value
If the function succeeds,: return value = 1.
Version 3.14.01 46
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.1.6 acsc_OpenCommPCI
Description
The function opens a communication channel with the controller via PCI Bus.
Up to 4-communication channels can be open simultaneously with the same SPiiPlus card through
the PCI Bus.
Syntax
HANDLE acsc_OpenCommPCI(int SlotNumber)
Arguments
Return Value
If the function succeeds, the return value is a valid communication handle. The handle must be used
in all subsequent function calls that refer to the open communication channel.
If the function fails, the return value is ACSC_INVALID (-1).
Comments
To open PCI communication the host PC, one or more controller cards must be inserted into the
computer PCI Bus.
After a channel is open, any SPiiPlus C function works with the channel irrespective of the physical
nature of the channel.
Example
Version 3.14.01 47
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.1.7 acsc_GetPCICards
Description
The function retrieves information about the controller cards inserted in the computer PCI Bus.
Syntax
int acsc_GetPCICards(ACSC_PCI_SLOT* Cards, int Count, int* ObtainedCards)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function scans the PCI Bus for the inserted controller cards and fills the Cards array with
information about the detected cards.
The Structure ACSC_PCI_SLOT is defined as follows:
Structure: ACSC_PCI_SLOT {int BusNumber; int SlotNumber; int Function;};
Where:
> BusNumber = bus number
> SlotNumber = slot number of the controller card
> Function = PCI function of the controller card
Within these arguments, SlotNumber can be used in the acsc_OpenCommPCI call to open
communication with a specific card. Other members have no use in the SPiiPlus C Library.
If no controller cards are detected, the function assigns the ObtainedCards with zero and does not
fill the Cards array. If one or more controller cards are detected, the function assigns the
ObtainedCards with a number of detected cards and places one ACSC_PCI_SLOT structure per each
detected card into the Cards array.
If the size of Cards array specified by the Count parameter is less than the number of detected cards,
the function assigns the ObtainedCards with a number of actually detected cards, but fills only the
Count elements of the Cards array.
Version 3.14.01 48
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
ACSC_PCI_SLOT CardsList[16];
int DetectedCardsCount;
if (acsc_GetPCICards(CardsList, // pointer to the declared array
// to save the detected
// cards information
16, // size of this array
&DetectedCardsCount // number of cards that were
// actually detected
))
{
printf("Found %d SB1218PCI cards\n", DetectedCardsCount);
}
else
{
printf("error while scanning PCI bus: %d\n", acsc_GetLastError());
}
4.1.8 acsc_SetServerExtLogin
Description
The function defines the User Mode Driver (UMD) host IP address, and port along with passing login
data.
Syntax
int acsc_SetServerExtLogin(char *IP, int Port, char *Username, char *Password,
char *Domain)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Version 3.14.01 49
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Comments
Use the function only if the application needs to establish communication with a controller through a
remote computer.
If the function is not called, by default, all connections are established through the local computer.
Only a controller connected to the local computer by a serial cable, PCI bus or Ethernet can be
accessed.
The function sets the IP address and port number of the User Mode Driver (UMD) host and logs the
user in. Once the function is called all acsc_OpenCommxxx calls will attempt to establish
communication via the UMD that was specified in the most recent acsc_SetServrExtLogin call. In
order to establish communication via a different UMD host acsc_SetServrExtLogin has to be called
again.
Applications can simultaneously communicate through several communication servers. Use the
following pattern to open communication channels through several servers:
Example
acsc_SetServerExtLogin("10.0.0.13",7777,"Mickey","viva11","ACS-Motion")
Handle=acsc_OpenCommPCI(-1)//Will attempt to find active UMD running on
host
//"10.0.0.13" and listenning on Port 7777
//on the host attempting to login as "Mickey"
//and open communication with PCI card at that host
4.1.9 acsc_CloseComm
Description
The function closes communication via the specified communication channel.
Syntax
int acsc_CloseComm(HANDLE Handle)
Arguments
Version 3.14.01 50
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function closes the communication channel and releases all system resources related to the
channel. If the function closes communication with the Simulator, the function also terminates the
Simulator.
Each acsc_OpenComm*** call in the application must have the corresponding acsc_CloseComm call
in order to return the resources to the system.
Example
if (!acsc_CloseComm(Handle))
{
printf("error closing communication: %d\n", acsc_GetLastError());
}
4.1.10 acsc_Transaction
Description
The function executes one transaction with the controller, i.e. it sends a command and receives a
controller response.
Syntax
int acsc_Transaction (HANDLE Handle, char* OutBuf, int OutCount, char* InBuf,
int InCount, int* Received, ACSC_WAITBLOCK* Wait)
Any ASCII command being sent to the controller must end with the '\r' (13) character,
otherwise it will not be recognized as valid.
Arguments
Version 3.14.01 51
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The full operation of transaction includes the following steps:
1. Send OutCount characters from OutBuf to the controller.
2. Waits until the controller response is received or the timeout occurs. In the case of timeout,
set Received to zero, store error value and return.
3. Store the controller response in InBuf. If the controller response is longer than InCount,
store only InCount characters.
4. Writes to Received the exact number of the characters stored in InBuf.
5. Analyzes the controller response, and set the error value if the response indicates an error.
If the Wait argument is NULL, the call is waiting and the function does not return until the full
operation is finished.
If the Wait argument points to a valid ACSC_WAITBLOCK structure, the call is non-waiting and the
function returns immediately after the first step. An internal library thread executes the rest of the
operation. The calling thread can validate if the operation finished and can retrieve the operation
result using the acsc_WaitForAsyncCall function.
Example
Version 3.14.01 52
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.1.11 acsc_Command
Description
The function sends a command to the controller and analyzes the controller response.
Syntax
int acsc_Command (HANDLE Handle, char* OutBuf, int OutCount,
ACSC_WAITBLOCK* Wait)
Any ASCII command being sent to the controller must end with '\r' (13) character,
otherwise it will not be recognized as valid.
Arguments
Version 3.14.01 53
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function is similar to acsc_Transaction except that the controller response is not transferred to
the calling thread. The function is used mainly for the commands that the controller responds to
with a prompt. In this case, the exact characters that constitute the prompt are irrelevant for the
calling thread. The function provides analysis of the prompt, and if the operation fails, the calling
thread can obtain the error code.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.1.12 acsc_CancelOperation
Description
The function cancels any asynchronous (non-waiting) call or all operations with the specified
communication handle.
Version 3.14.01 54
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Syntax
int acsc_CancelOperation(HANDLE Handle, ACSC_WAITBLOCK* Wait)
Arguments
Pointer to the ACSC_WAITBLOCK structure that was passed to the function that
Wait
initiated the asynchronous (non-waiting) call.
Return Value
If the function succeeds, the return value is non-zero. The corresponding asynchronous call was
successfully canceled.
If the function fails, the return value is zero.
Comments
If Wait points to a valid ACSC_WAITBLOCK structure, the function cancels the corresponding call with
the error ACSC_OPERATIONABORTED. If the corresponding call was not found the error ACSC_
CANCELOPERATIONERROR will be returned by acsc_GetLastErrorfunction.
If Wait is NULL, the function cancels all of the waiting and non-waiting calls for the specified
communication handle.
Example
4.1.13 acsc_GetEthernetCardsExt
Description
The function detects available controllers through a standard Ethernet connection and retrieves the
IP address, serial number, part number, and firmware version, which are stored in an ACSC_
CONTROLLER_INFO struct. By default, the function searches the local network segment. The default
setting can be changed, as described below.
Syntax
int acsc_GetEthernetCardsExt(ACSC_CONTROLLER_INFO * ControllerInfo, unsigned long
ControllerInfoSize, int Max, int*Ncontrollers, unsigned long BroadcastAddress)
Version 3.14.01 55
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Arguments
ACSC_CONTROLLER_INFO array.
Fills an array of ACSC_CONTROLLER_INFO structs containing:
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Function Execution
The function executes as follows:
1. Broadcasts a message to the network
2. Collects all received replies
3. Filters out all replies sent by nodes other than the SPiiPlus controller
4. The function then stores controller's IP addresses in the IP address field in the ControllerInfo
array and assigns the number of detected controllers to Ncontrollers.
5. Broadcasts a private messages to each ip address field in ControllerInfo array. The
messages ask for the controller serial number, part number and firmware version, then the
function stores them in the relevant field and returns.
If the size of the IPaddresses array appears too small for all detected controllers (Ncontrollers >
Max), only Max addresses are stored in the array.
If the size of the ACSC_CONTROLLER_INFO struct is smaller then the offset of the struct fields, return
ACSC_INVALIDPARAMETERS.
In order to convert the in_addr structure to a dot-delineated string, use the inet_ntoa() Microsoft
Windows function.
Version 3.14.01 56
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Broadcasting Considerations
If BroadcastAddress needs to be specified as other than ACSC_NONE, use the inet_addr Microsoft
Windows function to convert the desired broadcast IP address from a dot-delineated string to an
integer parameter.
The function uses the following broadcasting message:
"ACS-TECH80\r"
The target port for broadcasting is 700. A node that doesn't support port 700 simply does not see
the broadcast message. If a node other than the controller supports port 700, the node receives the
message. However, since the message format is meaningful only for SPiiPlus controllers, any other
node that receives the message either ignores it or responds with an error message that is filtered
out by the function.
Normally, the user specifies ACSC_NONE in the BroadcastAddress parameter. In this case, the
function uses broadcast address 255.255.255.255. The address causes broadcasting in a local
segment of the network. If the host computer is connected to several local segments (multi-home
node), the broadcast message is sent to all connected segments.
The user may wish to specify explicit broadcast addresses in the following cases:
> To reduce the broadcast area. In a multi-home node, the specific address can restrict
broadcasting to one of the connected segments.
> To extend the broadcast area. If a wide area network (WAN) is supported, a proper
broadcasting address can broadcast to the entire WAN, or part of the WAN.
For information about how to use broadcast addresses, refer to the network documentation.
The function uses the following message to get controller serial number:
"?SN\r"
The function uses the following message to get controller part number:
"?PN\r"
The function uses the following message to get controller firmware version:
"?VR\r"
If the inet_ntoa function does not work properly, try to add "Ws2_32.lib" in Linker>Input> Additional
Dependencies. Alternatively you can add “#pragma comment(lib, "Ws2_32.lib")” to one of the source
files in your project.
Example
ACSC_CONTROLLER_INFO ControllerInfo[100];
int Ncontrollers;
char *DotStr;
char Version[100];
Version 3.14.01 57
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
int I;
if (!acsc_GetEthernetCardsExt(ControllerInfo,100, &Ncontrollers,ACSC_
NONE, sizeof(ACSC_CONTROLLER_INFO)))
{
printf("Error %d\n", acsc_GetLastError());
}
for(I=0;I<Ncontrollers;I++)
{
DotStr=inet_ntoa(ControllerInfo [I].IpAddress);
printf("Controller IP address: %s\n", DotStr);
printf("Controller serial number: %s\n", ControllerInfo [I].
SrialNumber);
printf("Controller part number: %s\n", ControllerInfo [I].PartNumber);
printf("Controller firmware version: %s\n", ControllerInfo [I].Version);
}
4.1.14 acsc_GetConnectionsList
Description
The function retrieves all currently opened connections on the active server and their details.
Syntax
int acsc_GetConnectionsList(ACSC_CONNECTION_DESC* ConnectionsList,
int MaxNumConnections, int* NumConnections)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
If the size of the ConnectionsList array appears too small for all detected connections (Connections >
MaxNumConnections), only MaxNumConnections connections are stored in the array.
Version 3.14.01 58
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
This function can be used to check if there are some unused connections that remain from an
application that did not close the communication channel or were not gracefully closed (terminated
or killed).
Each connection from returned list can be terminated only by the acsc_TerminateConnection
function.
Example
int NConnections;
ACSC_CONNECTION_DESC Connections[100];
int I;
char app_name[]="needed_app.exe";
if (!acsc_GetConnectionsList(Connections, 100, &NConnections))
{
printf("Error %d\n", acsc_GetLastError());
}
for(I=0;I<NConnections;I++)
{
if ((strcmp(Connections[I].Application, app_name)==0) &&
(OpenProcess(0,0,Connections[I].ProcessId) == NULL))
// Check if process is
//still running by OpenProcess() function,
//only if it was executed on local PC.
{
if (!acsc_TerminateConnection(&(Connections[i])))
{
printf("Error closing communication of %s application: %d\n",
Connections[I].Application, acsc_GetLastError());
}
else
{
printf("Communication of %s application is successfully closed!\n",
Connections[I].Application);
}
}
}
4.1.15 acsc_GetConnectionInfo
Description
The function is used to retrieve the details of opened communication channel.
Syntax
int acsc_GetConnectionInfo(HANDLE Handle,
ACSC_CONNECTION_INFO* ConnectionInfo)
Version 3.14.01 59
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
ACSC_CONNECTION_INFO ConnectionInfo;
if (!acsc_GetConnectionInfo(Handle, &ConnectionInfo))
{
printf("acsc_GetConnectionInfo(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.1.16 acsc_TerminateConnection
Description
The function terminates a given communication channel (connection) of the active server.
Syntax
int acsc_TerminateConnection(ACSC_CONNECTION_DESC* Connection)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
This function can be used to terminate an unused connection that remains from an application that
did not close the communication channel or was not gracefully closed (terminated or killed). The
Connection parameter should be passed as it was retrieved by acsc_GetConnectionsList function.
Version 3.14.01 60
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
int NConnections;
ACSC_CONNECTION_DESC Connections[100];
int I;
char app_name[]="needed_app.exe";
acsc_SetServerExtLogin("10.0.0.13",7777,”Greg”,”MyPassword”,”ACS-
Motion”);
if (!acsc_GetConnectionsList(Connections, 100, &NConnections))
{
printf("Error %d\n", acsc_GetLastError());
}
for(I=0;I<NConnections;I++)
{
if ((strcmp(Connections[I].Application, app_name)==0) &&
(OpenProcess(Connections[I].ProcessId) == NULL))
// Check if process is still
//running by OpenProcess() function, only
//if it was executed on local PC.
{
if (!acsc_TerminateConnection(&(Connections[i])))
{
printf("Error closing communication of %s application: %d\n",
Connections[I].Application, acsc_GetLastError());
}
else
{
printf("Communication of %s application is successfully closed!\n",
Connections[I].Application);
}
}
}
Function Description
Version 3.14.01 61
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Function Description
4.2.1 acsc_GetCommOptions
Description
The function retrieves the communication options.
Syntax
int acsc_GetCommOptions(HANDLE Handle, unsigned int* Options)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current communication options. To set the communication option call
acsc_SetCommOptions.
Version 3.14.01 62
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
4.2.2 acsc_GetDefaultTimeout
Description
The function retrieves default communication timeout.
Syntax
int acsc_GetDefaultTimeout(HANDLE Handle)
Arguments
Return Value
If the function succeeds, the return value is the default time-out value in milliseconds.
If the function fails, the return value is zero.
Comments
The value of the default time-out depends on the type of established communication channel.
Time-outalsodepends on the baud rate value for serial communication.
Example
4.2.3 acsc_GetErrorString
Description
The function retrieves the explanation of an error code.
Syntax
int acsc_GetErrorString(HANDLE Handle, int ErrorCode, char* ErrorStr, int Count,
int* Received)
Version 3.14.01 63
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Arguments
ErrorStr Pointer to the buffer that receives the text explanation of ErrorCode.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the string that contains the text explanation of the error code returned by the
acsc_GetLastError, acsc_GetMotorError, and acsc_GetProgramError functions.
The function will not copy more than Count characters to the ErrorStr buffer. If the buffer is too small,
the error explanation can be truncated.
For the SPiiPlus C Library error codes, the function returns immediately with the text explanation. For
the controller’s error codes, the function refers to the controller to get the text explanation.
Example
char ErrorStr[256];
int ErrorCode, Received;
ErrorCode = acsc_GetLastError();
if (acsc_GetErrorString(Handle, // communication handle
ErrorCode, // error code
ErrorStr, // buffer for the error explanation
255, // available buffer length
&Received // number of actually received bytes
)
{
ErrorStr[Received] = '\0';
printf("function returned error: %d (%s)\n", ErrorCode, ErrorStr);
}
4.2.4 acsc_GetLastError
Description
The function returns the calling thread’s last-error code value. The last-error code is maintained on a
per-thread basis. Multiple threads do not overwrite each other’s last-error code.
Version 3.14.01 64
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Syntax
int acsc_GetLastError()
Arguments
This function has no arguments.
Return Value
The return value is the calling thread’s last-error code value.
Comments
It is necessary to call acsc_GetLastError immediately when some functions return zero value. This is
because all of the functions rewrite the error code value when they are called.
For a complete List of Error Codes, see Error Codes.
Example
4.2.5 acsc_GetLibraryVersion
Description
The function retrieves the SPiiPlus C Library version number.
Syntax
unsigned int acsc_GetLibraryVersion()
Arguments
This function has no arguments.
Return Value
The return value is the 32-bit unsigned integer value, which specifies the binary version number.
Comments
The SPiiPlus C Library version consists of four (or fewer) numbers separated by points: #.#.#.#. The
binary version number is represented by 32-bit unsigned integer value. Each byte of this value
specifies one number in the following order: high byte of high word – first number, low byte of high
word – second number, high byte of low word – third number and low byte of low word – forth
number. For example version “2.10” has the following binary representation (hexadecimal format):
0x020A0000.
First two numbers in the string form are obligatory. Any release version of the library consists of two
numbers. The third and fourth numbers specify an alpha or beta version, special or private build, or
other version.
Example
Version 3.14.01 65
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.2.6 acsc_GetTimeout
Description
The function retrieves communication timeout.
Syntax
int acsc_GetTimeout(HANDLE Handle)
Arguments
Return Value
If the function succeeds, the return value is the current timeout value in milliseconds.
If the function fails, the return value is zero.
Example
4.2.7 acsc_SetIterations
Description
The function sets the number of iterations in one transaction.
Syntax
int acsc_SetIterations(HANDLE Handle, int Iterations)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Version 3.14.01 66
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Comments
If, after the transmission of command to the controller, the controller response is not received
during the predefined time, the library repeats the transmission of command. The number of those
iterations is defined by the Iterations parameter for each communication channel independently.
Most of the SPiiPlus C functions perform communication with the controller by transactions (i.e., they
send commands and wait for responses) that are based on the acsc_Transaction function.
Therefore,the changing of number of iterations can have an influence on the behavior of the user
application.
The default the number of iterations for all communication channels is 2.
Example
if (!acsc_SetIterations(Handle, 2))
{
printf("number of iterations setting error: %d\n",
acsc_GetLastError());
}
4.2.8 acsc_SetCommOptions
Description
The function sets the communication options.
Syntax
int acsc_SetCommOptions(HANDLE Handle, unsigned int Options)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Version 3.14.01 67
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Comments
The function sets the communication options. To get current communication option, call acsc_
GetCommOptions.
To add some communication options to the current configuration, modify an Option parameter that
has been filled in by a call to acsc_GetCommOptions. This ensures that the other communication
options will have same values.
Example
4.2.9 acsc_SetTimeout
Description
The function sets the communication timeout.
Syntax
int acsc_SetTimeout(HANDLE Handle, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets the communication timeout.
All of the subsequent waiting calls of the functions will wait for the controller response Timeout in
milliseconds. If the controller does not respond to the sent command during this time, SPiiPlus C
functions return with zero value. In this case, the call of acsc_GetLastError will return the ACSC_
TIMEOUT error.
Version 3.14.01 68
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
if (!acsc_SetTimeout(Handle, 5000))
{
printf("timeout set error: %d\n", acsc_GetLastError());
}
4.2.10 acsc_SetQueueOverflowTimeout
Description
The function sets the Queue Overflow Timeout.
Syntax
int acsc_SetQueueOverflowTimeout (HANDLE Handle, int Delay)
Arguments
Return Value
If the function fails, the return value is zero.
Comments
The function sets Queue Overflow Timeout value in milliseconds. See also Non-Waiting Calls.
Example
if (!acsc_ SetQueueOverflowTimeout(Handle,100))
{
printf("Queue Overflow Timeout setting error: %d\n",
acsc_GetLastError());
}
4.2.11 acsc_GetQueueOverflowTimeout
Description
The function retrieves the Queue Overflow Timeout.
Syntax
int acsc_GetQueueOverflowTimeout(HANDLE Handle)
Arguments
Version 3.14.01 69
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is the current Queue Overflow Timeout value in
milliseconds.
If the function fails, the return value is ACSC_NONE.
Comments
See Non-Waiting Calls for an explanation about Queue Overflow Timeout.
Example
Function Description
Version 3.14.01 70
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Function Description
4.3.1 acsc_AppendBuffer
Description
The function appends one or more ACSPL+ lines to the program in the specified buffer.
Syntax
int acsc_AppendBuffer(HANDLE Handle, int Buffer, char* Program, int Count,
ACSC_WAITBLOCK* Wait)
Arguments
Version 3.14.01 71
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function appends one or more ACSPL+ lines to the program in the specified buffer. If the buffer
already contains any program, the new text is appended to the end of the existing program.
No compilation or syntax check is provided during downloading. In fact, any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy, the
compile command must be executed after downloading.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Version 3.14.01 72
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.3.2 acsc_ClearBuffer
Description
The function deletes the specified ACSPL+ program lines in the specified program buffer.
Syntax
int acsc_ClearBuffer(HANDLE Handle, int Buffer, int FromLine, int ToLine,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function deletes the specified ACSPL+ program lines in the specified program buffer.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Version 3.14.01 73
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.3.3 acsc_CompileBuffer
Description
The function compiles ACSPL+ program in the specified program buffer(s).
Syntax
int acsc_CompileBuffer(HANDLE Handle, int Buffer, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
The function returns non-zero if it succeeded to perform the compile operation on the buffer, such
that the communication channel is OK, the specified buffer is not running and compile operation
was performed. However, it does not mean that compilation succeeded. If the return value is zero,
compile operation could not be performed by some reason.
In order to get information about compilation results, use acsc_ReadInteger to read PERR [X], which
contains the last error that occurred in buffer X. If PERR [X] is zero, the buffer was compiled
successfully.
Otherwise, PERR [X] tells you about the error that occurred during the compilation.
Version 3.14.01 74
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Comments
The function compiles ACSPL+ program in the specified program buffer or all programs in all buffers
if the parameter Buffer is ACSC_NONE.
If attempting to compile the D-Buffer, all other buffers will be stopped and put in a non-
compiled state.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the program was compiled successfully.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.3.4 acsc_LoadBuffer
Description
The function clears the specified program buffer and then loads ACSPL+ program to this buffer.
Syntax
int acsc_LoadBuffer(HANDLE Handle, int Buffer, char* Program, int Count,
ACSC_WAITBLOCK* Wait)
Arguments
Version 3.14.01 75
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function clears the specified program buffer and then loads ACSPL+ program to this buffer.
No compilation or syntax check is provided during downloading. Any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy, the
compile command must be executed after downloading.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Version 3.14.01 76
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.3.5 acsc_LoadBufferIgnoreServiceLines
Description
The function clears the specified program buffer and then loads ACSPL+ to this buffer.
All lines that start with # are ignored.
This function is obsolete and is maintained only for backwards compatibility. When
loading files saved from the MultiDebugger and MMI use the acsc_LoadBuffersFromFile
function.
Syntax
int acsc_LoadBufferIgnoreServiceLines(HANDLE Handle, int Buffer, char* Program,
int Count, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function clears the specified program buffer and then loads ACSPL+ program to this buffer.
Version 3.14.01 77
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
No compilation or syntax check is provided during downloading. Any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy, the
compile command must be executed after downloading.
You can use this function in order to load program from a file created by SPiiPlus MMI
Program Manager if it contains a program in only one buffer. If there are programs in
more than one buffer, they will all be appended because the separators are ignored.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.3.6 acsc_LoadBuffersFromFile
Description
The function opens a file that contains one or more ACSPL+ programs allocated to several buffers
and download the programs to the corresponding buffers.
Syntax
int acsc_LoadBuffersFromFile(HANDLE Handle, char *Filename,
ACSC_WAITBLOCK* Wait)
Arguments
Version 3.14.01 78
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function analyzes the file, determines which program buffers should be loaded, clears them and
then loads ACSPL+ programs to those buffers.
SPiiPlus software tools save ACSPL+ programs in the following format:
The number of buffers in a file may change from 0 to 63 (depending on controller), without any
default order.
No compilation or syntax check is provided during downloading. Any text, not only a correct
program, can be inserted into a buffer. In order to compile the program and check its accuracy, the
compile command must be executed after downloading.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.3.7 acsc_RunBuffer
Description
The function starts up ACSPL+ program in the specified buffer.
Syntax
int acsc_RunBuffer(HANDLE Handle, int Buffer, char* Label,
ACSC_WAITBLOCK* Wait)
Version 3.14.01 79
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function starts up ACSPL+ program in the specified buffer. The execution starts from the
specified label, or from the first line if the label is not specified.
If the program was not compiled before, the function first compiles the program and then starts it. If
an error was encountered during compilation, the program does not start.
If the program was suspended by the acsc_SuspendBuffer function, the function resumes the
program execution from the point where the program was suspended.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the program in the specified buffer was started successfully.
The function does not wait for the program end. To wait for the program end, use the acsc_
WaitProgramEnd function.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Version 3.14.01 80
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.3.8 acsc_StopBuffer
Description
The function stops the execution of ACSPL+ program in the specified buffer(s).
Syntax
int acsc_StopBuffer(HANDLE Handle, int Buffer, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function stops ACSPL+ program execution in the specified buffer or in all buffers if the
parameter Buffer is ACSC_NONE.
The function has no effect if the program in the specified buffer is not running.
Version 3.14.01 81
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.3.9 acsc_SuspendBuffer
Description
The function suspends the execution of ACSPL+ program in the specified program buffer(s).
Syntax
int acsc_SuspendBuffer(HANDLE Handle, int Buffer, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Version 3.14.01 82
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Comments
The function suspends ACSPL+ program execution in the specified buffer or in all buffers if the
parameter Buffer is ACSC_NONE. The function has no effect if the program in the specified buffer is
not running.
To resume execution of the program in the specified buffer, call the acsc_RunBuffer function.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.3.10 acsc_UploadBuffer
Description
The function uploads ACSPL+ program from the specified program buffer.
Syntax
int acsc_UploadBuffer(HANDLE Handle, int Buffer, int Offset, char* Program,
int Count, int* Received, ACSC_WAITBLOCK* Wait)
Arguments
Version 3.14.01 83
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
4.3.11 acsc_DefineControllerProtection
Description
The function applies protection for controller, reboots controller and waits for process completion.
Syntax
int acsc_DefineControllerProtection (HANDLE Handle, int Flags, int * NoEditBuffers, int *
NoViewBuffers, char* StandardVariables, const char * Password, int Timeout)
Version 3.14.01 84
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Arguments
(Optional)
Array of buffer constants. Each element specifies one involved
buffer:
ACSC_BUFFER_0 corresponds to buffer 0, ACSC_BUFFER_1 to buffer
NoEditBuffers
1, etc.
After the last buffer, one additional element must be located that
contains -1 which marks the end of the array.
Set this argument to ACSC_NONE if not used.
(Optional)
Array of buffer constants. Each element specifies one involved
buffer: ACSC_BUFFER_0 corresponds to buffer 0, ACSC_BUFFER_1 to
NoViewBuffers buffer 1, etc.
After the last buffer, include one additional element containing -1 to
mark the end of the array.
Set this argument to ACSC_NONE if not used.
(Optional)
Array of variables to be protected. Only with primary protection. The
StandartVariables string contains chained variables names separated by '\r'(13)
character.
Set this argument to NULL if not used.
Version 3.14.01 85
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Application and removal of controller protection involves writing to flash memory. Exceeding the
rated number of flash memory writes (about 100,000) risks damage to the memory device.
Example
if (!acsc_DefineControllerProtection(hComm, ACSC_PRIMARY_PROTECTION |
ACSC_VARIABLES_PROTECTION |ACSC_ALLOW_SYSTEM_RECONFIGURATION,
NoEditBuffers, NoViewBuffers, standardVariables, "1234", 150000))
{ printf("acsc_DefineControllerProtection ():Error Occurred -%d\n",
acsc_GetLastError());
return;
}
4.3.12 acsc_RemoveControllerProtection
Description
The function removes protection, reboots controller, and waits for process completion.
Syntax
int acsc_RemoveControllerProtection (HANDLE Handle, int Flags, const char * Password, int Timeout)
Arguments
Password Password.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Version 3.14.01 86
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Comments
Application and removal of controller protection involves writing to flash memory. Exceeding the
rated number of flash memory writes (about 100,000) risks damage to the memory device.
Example
if (!acsc_RemoveControllerProtection(hComm, ACSC_SECONDARY_PROTECTION,
"7777", 150000))
{ printf("acsc_RemoveControllerProtection ():Error Occurred -%d\n",
acsc_GetLastError());
return;
}
4.3.13 acsc_TemporarilyDisableVariableProtection
Description
The function allows modification and saving of protected variables. Related only for primary
protection.
Syntax
int acsc_TemporarilyDisableVariableProtection (HANDLE Handle, const char * Password, ACSC_
WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Application and removal of controller protection involves writing to flash memory. Exceeding the
rated number of flash memory writes (about 100,000) risks damage to the memory device.
Version 3.14.01 87
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
4.3.14 acsc_RestoreVariableProtection
Description
The function restores variable protection that was temporarily disabled.
Syntax
int acsc_RestoreVariableProtection (HANDLE Handle, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Application and removal of controller protection involves writing to flash memory. Exceeding the
rated number of flash memory writes (about 100,000) risks damage to the memory device.
Example
if (!acsc_RestoreVariableProtection(hComm, ACSC_SYNCHRONOUS))
{
printf("acsc_RestoreVariableProtection ():Error Occurred -%d\n",
acsc_GetLastError());
Version 3.14.01 88
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
return;
}
Function Description
4.4.1 acsc_ReadInteger
Description
The function reads value(s) from integer variable.
Syntax
int acsc_ReadInteger(HANDLE Handle, int NBuf, char* Var, int From1, int To1,
int From2, int To2, int* Values, ACSC_WAITBLOCK* Wait)
Arguments
Number of program buffer for local variable or ACSC_NONE for global and
NBuf
standard variable.
Version 3.14.01 89
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function reads specified integer variable or array.
The variable can be a standard controller variable, a user global variable, or a user local variable.
Standard and user global variables have global scope. Therefore, parameter Nbuf must be ACSC_
NONE (-1) for these classes of variables.
User local variable exists only within a buffer. The buffer number must be specified for user local
variable.
If the variable is scalar, all indexes From1, To1, From2, To2 must be ACSC_NONE. The function reads
the requested value and assigns it to the variable pointed by Values.
If the variable is a one-dimensional array, From1, To1 must specify the index range and From2, To2
must be ACSC_NONE. Array Values must be of size To1-From1+1 at least. The function reads all
requested values from index From1 to index To1 inclusively and stores them in the Values array.
If the variable is a two-dimensional array, From1, To1 must specify the index range of the first
dimension and From2, To2 must specify the index range of the second dimension. Array Values
must be of size (To1-From1+1)x(To2-From2+1) values at least. The function uses the Values array in
such a way: first, the function reads To2-From2+1 values from row From1 and fills the Values array
elements from 0 to To2-From2, then reads To2-From2+1 values from raw From1+1 and fills the
Values array elements from To2-From2+1 to 2*(To2-From2)+1, etc.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Values and Wait items until a call to the acsc_WaitForAsyncCall function.
Version 3.14.01 90
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
4.4.2 acsc_WriteInteger
Description
The function writes value(s) to integer variable.
Syntax
int acsc_WriteInteger(HANDLE Handle, int NBuf, char* Var, int From1, int To1,
int From2, int To2, int* Values, ACSC_WAITBLOCK* Wait)
Arguments
Number of program buffer for local variable or ACSC_NONE for global and
NBuf
standard variable.
Var Pointer to the null-terminated character string contained name of the variable.
Version 3.14.01 91
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes to a specified integer variable or array.
The variable can be a standard controller variable, user global or user local.
Standard and user global variables have global scope. Therefore, parameter Nbuf must be ACSC_
NONE (-1) for these classes of variables.
User local variable exists only within a buffer. The buffer number must be specified for user local
variable.
If the variable is scalar, all indexes From1, To1, From2, To2 must be ACSC_NONE (-1). The function
writes the value pointed by Values to the specified variable.
If the variable is a one-dimensional array, From1, To1 must specify the index range and From2, To2
must be ACSC_NONE (-1). Array Values must contain To1-From1+1 values at least. The function writes
the values to the specified variable from index From1 to index To1 inclusively.
If the variable is a two-dimensional array, From1, To1 must specify the index range of the first
dimension and From2, To2 must specify the index range of the second dimension. Array Values
must contain (To1-From1+1)x(To2-From2+1) values at least. The function uses the Values array as
follows: first, the function retrieves the Values elements from 0 to To2-From2 and writes them to
row From1 of the specified controller variable, then retrieves the Values elements from To2-From2+1
to 2*(To2-From2)+1 and writes them to row From1+1 of the specified controller variable, etc.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Version 3.14.01 92
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
4.4.3 acsc_ReadReal
Description
The function reads value(s) from a real variable.
Syntax
int acsc_ReadReal(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2,
int To2, double* Values, ACSC_WAITBLOCK* Wait)
Arguments
Number of program buffer for local variable or ACSC_NONE for global and
NBuf
standard variable.
Var Pointer to the null-terminated character string contained name of the variable.
Version 3.14.01 93
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function reads specified real variable or array.
The variable can be a standard controller variable, user global variable, or user local variable.
ACSPL+ and user global variables have global scope. Therefore, parameter Nbuf must be ACSC_
NONE (-1) for these classes of variables.
User local variable exists only within a buffer. The buffer number must be specified for user local
variable.
If the variable is scalar, all indexes From1, To1, From2, To2 must be ACSC_NONE. The function reads
the requested value and assigns it to the variable pointed by Values.
If the variable is a one-dimensional array, From1, To1 must specify the index range and From2, To2
must be ACSC_NONE. Array Values must be of size To1-From1+1 at least. The function reads all
requested values from index From1 to index To1 inclusively and stores them in the Values array.
If the variable is a two-dimensional array, From1, To1 must specify the index range of the first
dimension and From2, To2 must specify the index range of the second dimension. Array Values
must be of size (To1-From1+1)x(To2-From2+1) values at least. The function uses the Values array in
such a way: first, the function reads To2-From2+1 values from row From1 and fills the Values array
elements from 0 to To2-From2, then reads To2-From2+1 values from raw From1+1 and fills the
Values array elements from To2-From2+1 to 2*(To2-From2)+1, etc.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Values and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
Version 3.14.01 94
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.4.4 acsc_WriteReal
Description
The function writes value(s) to the real variable.
Syntax
int acsc_WriteReal(HANDLE Handle, int NBuf, char* Var, int From1, int To1,
int From2, int To2, double* Values, ACSC_WAITBLOCK* Wait)
Arguments
Number of program buffer for local variable or ACSC_NONE for global and
NBuf
standard variable.
Var Pointer to the null-terminated character string contained name of the variable.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes to the specified real variable or array.
The variable can be a standard controller variable, user global or user local.
Standard and user global variables have global scope. Therefore, parameter Nbuf must be ACSC_
NONE (-1) for these classes of variables.
Version 3.14.01 95
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
User local variable exists only within a buffer. The buffer number must be specified for user local
variable.
If the variable is scalar, all indexes From1, To1, From2, To2 must be ACSC_NONE (-1). The function
writes the value pointed by Values to the specified variable.
If the variable is a one-dimensional array, From1, To1 must specify the index range and From2, To2
must be ACSC_NONE (-1). Array Values must contain To1-From1+1 values at least. The function writes
the values to the specified variable from index From1 to index To1 inclusively.
If the variable is a two-dimensional array, From1, To1 must specify the index range of the first
dimension and From2, To2 must specify the index range of the second dimension. Array Values
must contain (To1-From1+1)x(To2-From2+1) values at least. The function uses the Values array in
such a way: first, the function retrieves the Values elements from 0 to To2-From2 and writes them
to row From1 of the specified controller variable, then retrieves the Values elements from To2-
From2+1 to 2*(To2-From2)+1 and writes them to row From1+1 of the specified controller variable, etc.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.4.5 acsc_ReadString
Description
The function retrieves String type values from ACSPL+ standard or user defined String variables or
arrays.
Syntax
int acsc_ReadString(HANDLE Handle, int NBuf, char* Var, int From1, int
To1, int From2, int To2, char* Values, unsigned char CellSize, ACSC_
WAITBLOCK* Wait);
Version 3.14.01 96
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Arguments
Number of program buffer for local variable or ACSC_NONE (-1) for global
NBuf
and standard variable.
Values (out
Pointer to the buffer that receives requested values.
parameter)
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Version 3.14.01 97
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
4.4.6 acsc_WriteString
Description
The function writes values to ACSPL standard or user defined String variables or arrays.
Syntax
Arguments
Number of program buffer for local variable or ACSC_NONE (-1) for global and
NBuf
standard variable.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Version 3.14.01 98
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Example
char buff[5][20];
for (int i = 0; i < 5; i++) {
sprintf_s(buff[i], "C_str_%d_boo", i);
}
4.4.7 acsc_ReadStruct
Description
The function retrieves Struct values from ACSPL+ Struct variables or arrays.
Syntax
acsc_ReadStruct(HANDLE Handle, int NBuf, const char* Var, int From, int To, void* Values, int
ValuesSize, ACSC_WAITBLOCK* Wait)
Arguments
Number of program buffer for local struct variable or ACSC_NONE (-1) for
NBuf
global struct variable.
Values (out
Pointer to the buffer that receives requested values.
parameter)
Version 3.14.01 99
SPiiPlus C Library Reference Programmer's Guide
4. C Library Functions
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
LocalSruct localVar;
4.4.8 acsc_WriteStruct
Description
The function writes struct values to ACSPL+ struct variables or arrays.
Syntax
acsc_WriteStruct(HANDLE Handle, int NBuf, const char* Var, int From, int To, void* Values, int
ValuesSize, ACSC_WAITBLOCK* Wait)
Number of program buffer for local struct variable or ACSC_NONE (-1) for
NBuf
global struct variable.
Values (out
A pointer to a buffer that contains the data to be written to the buffer.
parameter)
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
struct LocalSruct1
{
int x[2];
double y[4];
char str2[11];
};
struct LocalSruct
{
int a[3][2];
double b[4];
char str1[2][11];
LocalSruct1 structvar;
};
#pragma pack(pop) // Restore the previous packing alignment
LocalSruct localVar =
{{ {1, 2}, {3, 4}, {5, 6} },
{1.1, 2.2, 3.3, 4.4},
{ "hello", "world" },
{ {7, 8}, {5.5, 6.6, 7.7, 8.8}, "structvar" }
};
Function Description
4.5.1 acsc_LoadDataToController
Description
The function writes value(s) from text file to SPiiPlus controller (variable or file).
Syntax
int acsc_LoadDataToController(HANDLE Handle,int Dest, char* DestName, int From1,
int To1, int From2, int To2, char* SrcFileName, int SrcNumFormat,
bool bTranspose, ACSC_WAITBLOCK* Wait)
Arguments
Number of program buffer for local variable, ACSC_NONE for global and
Dest standard variable. ACSC_FILE for loading directly to file on flash memory
(only arrays can be written directly into controller files).
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes to a specified variable (scalar/array) or directly to a binary file on the controller's
flash memory. The variable can be an ACSPL+ variable, user global or user local.
The input file (pointed to by the SrcFileName argument) must be in ANSI format, otherwise error 168,
ACSC_INVALID_FILE_FORMAT, is returned.
ACSPL+ and user global variables have global scope. Therefore, Dest must be ACSC_NONE (-1) for
these classes of variables. User local variable exists only within a buffer. The buffer number must be
specified for user local variable.
If Dest is ACSC_NONE (-1) and there is no global variable with the name specified by DestName, it
would be defined. Arrays will be defined with dimensions (To1+1, To2+1).
If performing loading directly to a file, From1, To1, From2 and To2 are meaningless.
If the variable is scalar, the From1, To1, From2, and To2 arguments must be ACSC_NONE (-1). The
function writes the value from the file specified by SrcFileName to the variable specified by Name.
If the variable is a one-dimensional array, From1, To1 must specify the index range and the From2,
To2 must be ACSC_NONE (-1). The text file, pointed to by the SrcFileName argument, must contain
To1 to From1+1 values, at least. The function writes the values to the specified variable from the
From1 index to the To1 index inclusively.
If the variable is a two-dimensional array, From1, To1 must specify the index range of the first
dimension and From2, To2 must specify the index range of the second dimension. The text file,
pointed to by the SrcFileName argument, must contain ((To1-From1+1) x (To2-From2+1)) values, at
least; otherwise, an error will occur.
The function uses the text file as follows:
1. The function retrieves the To2-From2+1 values and writes them to row From1 of the
specified controller variable
2. Then retrieves next To2-From2+1 values and writes them to row From1+1 of the specified
controller variable, etc.
If bTranspose is TRUE, the function actions are inverted. It takes To1-From1+1 values and
writes them to column From2 of the specified controller variable, then retrieves next
To1-From1+1 values and writes them to column From2+1 of the specified controller
variable, etc.
The text file is processed line-by-line; any characters except numbers, dots, commas and exponent
'e' are translated as separators between the numbers. A line that starts with no digits is considered
as comment and ignored.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function has been made.
Example
{
printf("transaction error: %d\n", acsc_GetLastError());
}
UserArr.TXT has this structure:
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ……………
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ……………
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ……………
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ……………
…
…
4.5.2 acsc_UploadDataFromController
Description
This function writes value(s) from the SPiiPlus controller (variable or file) to a text file.
Syntax
int acsc_UploadDataFromController(HANDLE Handle, int Src, char * SrcName,
int SrcNumFormat, int From1, int To1, int From2, int To2, char* DestFileName,
char* DestNumFormat, bool bTranspose, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes data to the specified file from a specified variable (scalar/array) or directly from a
binary file in the controller's flash memory.
The variable can be a standard ASCPL+ variable, user global or user local. The ASCPL+ and user global
variables have global scope. In this case, the Src argument has to be ACSC_NONE (-1) for these
classes of variables. User local variable exists only within a buffer. The buffer number has to be
specified for user local variable.
If the variable (or file) with the name specified by SrcName does not exist, an error occurs.
If loading directly from the file, From1, To1, From2 and To2 are meaningless.
If the variable is a scalar, all From1, To1, From2 and To2 values must be ACSC_NONE (-1). The function
writes the value from variable specified by SrcName to the file specified by DestFileName.
If the variable is a one-dimensional array, From1, To1 must specify the index range, and From2, To2
must be ACSC_NONE (-1). The function writes the values from the specified variable from the From1
value to the To1 value, inclusively, to the file specified by DestFileName.
If the variable is a two-dimensional array, From1, To1 must specify the index range of the first
dimension, and From2, To2 must specify the index range of the second dimension. The function
uses the variable as follows: first, the function retrieves the To2-From2+1 values from the row
specified in From1 and writes them to the file specified by DestFileName. It then retrieves To2-
From2+1 values from the From1+1 row and writes them, and so forth.
If bTranspose is TRUE, the function actions are inverted. It takes To1-From1+1 values from the row
specified by From2 and writes them to first column of the destination file. Then retrieves the next
To1-From1 values from row From2+1 and writes them to the next column of the file.
The destination file’s format can be determined by string specified by DestNumFormat. This string
will be used as argument in *printf function.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
4.6.1 acsc_CaptureComm
Description
The function captures a communication channel.
Syntax
int acsc_CaptureComm(HANDLE Handle)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function captures the communication handle for the calling thread and prevents access to this
communication handle from other threads.
If one thread captures the communication handle and another thread calls one of SPiiPlus C Library
functions using the same handle, the second thread will be delayed until the first thread executes
acsc_ReleaseComm.
The function provides ability to execute a sequence of functions without risk of intervention from
other threads.
Example
if (!acsc_CaptureComm(Handle))
{
printf("capture communication error: %d\n", acsc_GetLastError());
4.6.2 acsc_ReleaseComm
Description
The function releases a communication channel.
Syntax
int acsc_ReleaseComm(HANDLE Handle)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function releases the communication handle captured by acsc_CaptureComm and allows other
threads to communicate through the channel.
Example
if (!acsc_ReleaseComm(Handle))
{
printf("release communication error: %d\n", acsc_GetLastError());
}
Function Description
Function Description
4.7.1 acsc_OpenHistoryBuffer
Description
The function opens a history buffer.
Syntax
LP_ACSC_HISTORYBUFFER acsc_OpenHistoryBuffer(HANDLE Handle, int Size)
Arguments
Return Value
The function returns pointer to ACSC_HISTORYBUFFER structure.
If the buffer cannot be allocated, the return value is zero.
Comments
The function allocates a history buffer that stores all commands sent to the controller and all
responses and unsolicited messages received from the controller.
Only one history buffer can be open for each communication handle.
The buffer works as a cyclic buffer. When the amount of the stored data exceeds the buffer size, the
newly stored data overwrites the earliest data in the buffer.
Example
4.7.2 acsc_CloseHistoryBuffer
Description
The function closes the history buffer and discards all stored history.
Syntax
int acsc_CloseHistoryBuffer(HANDLE Handle)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function closes the history buffer and releases the used memory. All information stored in the
buffer is discarded.
Example
if (!acsc_CloseHistoryBuffer(Handle))
{
printf("closing history buffer error: %d\n", acsc_GetLastError());
}
4.7.3 acsc_GetHistory
Description
The function retrieves the contents of the history buffer.
Syntax
int acsc_GetHistory(HANDLE Handle, char* Buf, int Count, int* Received,
BOOL bClear)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the communication history from the history buffer and stores it in the buffer
pointed by Buf.
The communication history includes all commands sent to the controller and all responses and
unsolicited messages received from the controller. The amount of received data does not exceed
the size of the history buffer. The history buffer works as a cyclic buffer: when the amount of the
stored data exceeds the buffer size, the newly stored data overwrites the earliest data in the buffer.
Therefore, as a rule, the retrieved communication history includes only the recently sent commands
and receives responses and unsolicited messages. The depth of the retrieved history depends on
the history buffer size.
The history data is retrieved in historical order, i.e. the earliest message is stored at the beginning of
Buf. The first retrieved message in Buf can be incomplete, because of being partially overwritten in
the history buffer.
If the size of the Buf is less than the size of the history buffer, only the most recent part of the stored
history is retrieved.
Example
int Received;
char Buf[10000];
if (!acsc_GetHistory(Handle, // communication handle
Buf, // pointer to the buffer that receives a
// communication history
10000, // size of this buffer
&Received, // number of characters that were actually
// received
TRUE // clear contents of the history buffer
))
{
printf("getting history error: %d\n", acsc_GetLastError());
}
Function Description
Function Description
4.8.1 acsc_OpenMessageBuffer
Description
The function opens an unsolicited messages buffer.
Syntax
LP_ACSC_HISTORYBUFFER acsc_OpenMessageBuffer(HANDLE Handle, int Size)
Arguments
Return Value
The function returns pointer to ACSC_HISTORYBUFFER structure.
If the buffer cannot be allocated, the return value is zero.
Comments
The function allocates a buffer that stores unsolicited messages from the controller.
Unsolicited messages are messages that the controller sends on its own initiative and not as a
response to command. For example, the DISP command in an ACSPL+ program forces the controller
to send an unsolicited message.
Only one message buffer can be open for each communication handle.
If the message buffer has been open, the library separates unsolicited messages from the controller
responses and stores them in the message buffer. In this case, the acsc_GetMessage function
retrieves unsolicited messages. If the message buffer is not open, acsc_Receive retrieves both
replies and unsolicited messages. If the user application does not call acsc_Receive or acsc_
GetMessage and uses only acsc_Transaction and acsc_Command, the unsolicited messages are
discarded.
The message buffer works as a FIFO buffer: acsc_GetMessage extracts the earliest message stored
in the buffer. If acsc_GetMessage extracts the messages slower than the controller produces them,
buffer overflow can occur, and some messages will be lost. Generally, the greater the buffer, the
less likely is buffer overflow to occur.
Example
4.8.2 acsc_CloseMessageBuffer
Description
The function closes the messages buffer and discards all stored unsolicited messages.
Syntax
int acsc_CloseMessageBuffer(HANDLE Handle)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function closes the message buffer and releases the used memory. All unsolicited messages
stored in the buffer are discarded.
Example
if (!acsc_CloseMessageBuffer(Handle))
{
printf("closing unsolicited messages buffer error: %d\n",
acsc_GetLastError());
}
4.8.3 acsc_GetSingleMessage
Description
The function retrieves single unsolicited message from the buffer. This function only works if you
setup a buffer using acsc_OpenMessageBuffer. If there is no message in the buffer, the function
waits until the message arrives or timeout expires.
Syntax
int acsc_GetSingleMessage (HANDLE Handle, char *Message,int Count,int *Length, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
If message arrives, Length will contain the received message length. If the timeout expires, the
function exits with the ACSC_TIMEOUT error.
Example
int L;
char Buf[10000];
if (!acsc_GetSingleMessage(Handle, // communication handle
Buf, // pointer to the buffer that
// receives unsolicited messages
10000 //Size of the buffer
&L, // number of characters that were actually received
1000 // Wait for 1 second till a message arrives
))
{
printf("getting unsolicited message error: %d\n",
acsc_GetLastError());
}
4.8.4 acsc_GetMessage
Description
The function retrieves unsolicited messages from the buffer. This function only works if you setup a
buffer using acsc_OpenMessageBuffer.
Syntax
int acsc_GetMessage(HANDLE Handle, char* Buf, int Count, int* Received, BOOL bClear)
Arguments
If TRUE, the function clears the contents of the unsolicited messages buffer
bClear after retrieving the message.
If FALSE, the unsolicited messages buffer is not cleared.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves all stored unsolicited messages from the message buffer.
The function always returns immediately. If no, unsolicited message is received, the function assigns
zero to the Received variable.
Parameter Count specifies the buffer size. If a received message contains more than Count
characters, the function transfers to buffer only Count characters, assigns Received with Count
value and returns non-zero. The remaining characters of the message are removed from the
message buffer.
If the Count is equal to or more than the length of the message, the function transfers the whole
message to buffer and assigns variable Received with a number of characters that were actually
transferred.
Example
int Received;
char Buf[10000];
if (!acsc_GetMessage( Handle, // communication handle
Buf, // pointer to the buffer that
// receives unsolicited messages
10000, // size of this buffer
&Received, // number of characters that were
// actually received
TRUE // clear contents of the
// unsolicited messages buffer
))
{
printf("getting unsolicited message error: %d\n",
acsc_GetLastError());
}
Function Description
4.9.1 acsc_SetLogFileOptions
Description
The function sets the log file options.
Syntax
acsc_SetLogFileOptions(HANDLE Handle,
ACSC_LOG_DETALIZATION_LEVEL Detailization,
ACSC_LOG_DATA_PRESENTATION Presentation)
Arguments
Detailization Medium - Value 1: Communication traffic and some internal C Lib process
data will be logged.
Maximum -Value 2: Communication traffic and all internal process data
will be logged.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function configures the log file options. The function may be called before or after the log file is
opened.
Example
4.9.2 acsc_OpenLogFile
Description
The function opens a log file.
Syntax
int acsc_OpenLogFile(HANDLE Handle, char* FileName)
Arguments
FileName Pointer to the null-terminated string contained name or path of the log file.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function opens a binary file that stores all communication history.
Only one log file can be open for each communication handle.
If the log file has been open, the library writes all incoming and outgoing messages to the specified
file. The messages are written to the file in binary format, i.e., exactly as they are received and sent,
including all service bytes.
Unlike the history buffer, the log file cannot be read within the library. The main usage of the log file
is for debug purposes.
Example
if (!acsc_OpenLogFile(Handle, "acs_comm.log"))
{
printf("opening log file error: %d\n", acsc_GetLastError());
}
4.9.3 acsc_CloseLogFile
Description
The function closes the log file.
Syntax
int acsc_CloseLogFile(HANDLE Handle)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
An application must always call the acsc_CloseLogFile before it exits. Otherwise, the data written to
the file might be lost.
Example
if (!acsc_CloseLogFile(Handle))
{
printf("closing log file error: %d\n", acsc_GetLastError());
}
4.9.4 acsc_WriteLogFile
Description
The function writes to log file.
Syntax
int acsc_WriteLogFile(HANDLE Handle, char* Buf, int Count)
Arguments
Buf Pointer to the buffer that contains the string to be written to log file.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes data from a buffer to log file.
The log file has to have been opened previously using acsc_OpenLogFile
Example
4.9.5 acsc_FlushLogFile
Description
This function allows flushing the SPiiPlus UMD (User Mode Driver) internal binary buffer to a
specified text file from the C Library application.
Syntax
acsc_FlushLogFile(char*filename)
Arguments
Comments
If Continuous Log is active, the function will fail
Example
if (!acsc_FlushLogFile( filename))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.9.6 acsc_GetLogData
Description
The function is used to retrieve the data of firmware log.
Syntax
int acsc_GetLogData(HANDLE Handle, char* Buf, int Count, int* Received,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
These functions can only be used with the SPiiPlusSC Motion Controller.
Function Description
acsc_FlushSCLogFile Flushes contents of the SPiiPlusSC log file to a specified text file.
4.10.1 acsc_OpenSCLogFile
Description
The function opens the SPiiPlusSC log file.
Syntax
int acsc_OpenSCLogFile(HANDLE Handle, char* FileName)
Arguments
Pointer to the null-terminated string containing the name or path of the log
FileName
file.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function opens a binary file that stores all SPiiPlusSC log history.
The messages are written to the file in binary format, i.e., exactly as they are received and sent,
including all service bytes.
The main use of the log file is for debug purposes.
Example
if (!acsc_OpenSCLogFile(Handle, "acs_sc.log"))
{
printf("opening SPiiPlus SC log file error: %d\n", acsc_GetLastError());
}
4.10.2 acsc_CloseSCLogFile
Description
The function closes the SPiiPlusSC log file.
Syntax
int acsc_CloseSCLogFile(HANDLE Handle)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
An application must always call the acsc_CloseSCLogFile before it exits; otherwise, the data written
to the file might be lost.
Example
if (!acsc_CloseSCLogFile(Handle))
{
printf("closing log file error: %d\n", acsc_GetLastError());
}
4.10.3 acsc_WriteSCLogFile
Description
The function writes to the SPiiPlusSC log file.
Syntax
int acsc_WriteSCLogFile(HANDLE Handle, char* Buf, int Count)
Arguments
Buf Pointer to the buffer that contains the string to be written to the log file.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes data from a buffer to the SPiiPlusSC log file.
The log file has to have been opened previously using acsc_OpenLogFile
Example
4.10.4 acsc_FlushSCLogFile
Description
The function enables flushing the SPiiPlusSC internal binary buffer to a specified text file from the C
Library application.
Syntax
int acsc_FlushSCLogFile(char*Filename, BOOL bClear)
Arguments
Comments
If Continuous Log is active, the function will fail.
Example
if (!acsc_FlushSCLogFile(filename,TRUE))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
Function Description
4.11.1 acsc_SetConf
Description
The function writes system configuration data.
Syntax
int acsc_SetConf(HANDLE Handle, int Key, int Index, double Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes system configuration data. The Key parameter specifies the feature number and
the Index parameter defines axis or buffer to which it should be applied. Use ACSC_CONF_XXX
constants in the value field. For complete details of system configuration see the description of the
SETCONF function in the SPiiPlus ACSPL+ Programmer’s Guide.
Example
4.11.2 acsc_GetConf
Description
The function reads system configuration data.
Syntax
int acsc_GetConf(HANDLE Handle, int Key, int Index, double *Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function reads system configuration data. The Key parameter specifies the feature number and
the Index parameter defines axis or buffer to which it should be applied. For detailed description of
system configuration see “SPiiPlus ACSPL+ Programmer’s Guide” for the details of the GETCONF
function.
Example
4.11.3 acsc_GetVolatileMemoryUsage
Description
The function retrieves the percentage of the volatile memory load.
Syntax
int _ACSCLIB_ WINAPI acsc_GetVolatileMemoryUsage(HANDLE Handle, double* Value, ACSC_
WAITBLOCK* Wait)
Arguments
Value Pointer to a variable that receives the percentage of the volatile memory load
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
4.11.4 acsc_GetVolatileMemoryTotal
Description
The function retrieves the amount of total volatile memory in bytes.
Syntax
int _ACSCLIB_ WINAPI acsc_GetVolatileMemoryTotal(HANDLE Handle, double* Value, ACSC_
WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
4.11.5 acsc_GetVolatileMemoryFree
Description
The function retrieves the amount of free volatile memory in bytes.
Syntax
int _ACSCLIB_ WINAPI acsc_GetVolatileMemoryFree(HANDLE Handle, double* Value, ACSC_
WAITBLOCK* Wait)
Arguments
Value Pointer to a variable that receives the amount of free volatile memory in bytes
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
if (!acsc_GetVolatileMemoryFree(
Handle, // communication handle
&Value, // received value
NULL // waiting call
))
{
printf("acsc_GetVolatileMemoryFree(): Error Occurred - %d\n",
acsc_GetLastError());
}
4.11.6 acsc_GetNonVolatileMemoryUsage
Description
The function retrieves the percentage of the non-volatile memory load.
Syntax
int _ACSCLIB_ WINAPI acsc_GetNonVolatileMemoryUsage(HANDLE Handle, double* Value, ACSC_
WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
4.11.7 acsc_GetNonVolatileMemoryTotal
Description
The function retrieves the amount of total non-volatile memory in bytes.
Syntax
int _ACSCLIB_ WINAPI acsc_GetNonVolatileMemoryTotal(HANDLE Handle, double* Value, ACSC_
WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
bytes
double Value;
if (!acsc_GetNonVolatileMemoryTotal(
Handle, // communication handle
&Value, // received value
NULL // waiting call
))
{
printf("acsc_GetNonVolatileMemoryTotal(): Error Occurred - %d\n",
acsc_GetLastError());
}
4.11.8 acsc_GetNonVolatileMemoryFree
Description
The function retrieves the amount of free non-volatile memory in bytes.
Syntax
int _ACSCLIB_ WINAPI acsc_GetNonVolatileMemoryFree(HANDLE Handle, double* Value, ACSC_
WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
4.11.9 acsc_SysInfo
Description
The function returns certain system information based on the argument that is specified.
Syntax
int acsc_SysInfo(HANDLE Handle, int Key, double *Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
double Value = 0;
if (!acsc_SysInfo(Handle, ACSC_SYS_MODEL_KEY, &Value, NULL))
{
printf("acsc_SysInfo(): Error Occurred - %d\n", acsc_GetLastError());
return;
}
Function Description
Function Description
4.12.1 acsc_SetVelocity
Description
The function defines a value of motion velocity.
Syntax
int acsc_SetVelocity(HANDLE Handle, int Axis, double Velocity,
ACSC_WAITBLOCK* Wait)
Arguments
The value specifies required motion velocity. The value will be used in the
Velocity subsequent motions except for the master-slave motions and the motions
activated with the ACSC_AMF_VELOCITY flag.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects the motions initiated after the function call. The function has no effect on any
motion that was started or planned before the function call. To change velocity of an executed or
planned motion, use the acsc_SetVelocityImm function.
The function has no effect on the master-slave motions and the motions activated with the ACSC_
AMF_VELOCITY flag.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.2 acsc_GetVelocity
Description
The function retrieves a value of motion velocity.
Syntax
int acsc_GetVelocity(HANDLE Handle, int Axis, double* Velocity,
ACSC_WAITBLOCK* Wait)
Arguments
Velocity Pointer to the variable that receives the value of motion velocity.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the value of the motion velocity. The retrieved value is a value defined by a
previous call of the acsc_SetVelocity function, or the default value if the function was not called
before.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Velocity and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.12.3 acsc_SetAcceleration
Description
The function defines a value of motion acceleration.
Syntax
int acsc_SetAcceleration(HANDLE Handle, int Axis, double Acceleration,
ACSC_WAITBLOCK* Wait)
Arguments
The value specifies required motion acceleration. The value will be used in
Acceleration
the subsequent motions except the master-slave motions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects the motions initiated after the function call. The function has no effect on any
motion that was started or planned before the function call. To change acceleration of an executed
or planned motion, use the acsc_SetAccelerationImm function.
The function has no effect on the master-slave motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.4 acsc_GetAcceleration
Description
The function retrieves a value of motion acceleration.
Syntax
int acsc_GetAcceleration(HANDLE Handle, int Axis, double* Acceleration,
ACSC_WAITBLOCK* Wait)
Arguments
Acceleration Pointer to the variable that receives the value of motion acceleration.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the value of the motion acceleration. The retrieved value is a value defined by
a previous call of the acsc_SetAcceleration function, or the default value if the function was not
called before.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Acceleration and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.12.5 acsc_SetDeceleration
Description
The function defines a value of motion deceleration.
Syntax
int acsc_SetDeceleration(HANDLE Handle, int Axis, double Deceleration,
ACSC_WAITBLOCK* Wait)
Arguments
The value specifies a required motion deceleration. The value will be used
Deceleration
in the subsequent motions except the master-slave motions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects the motions initiated after the function call. The function has no effect on any
motion that was started or planned before the function call. To change deceleration of an executed
or planned motion, use the acsc_SetDecelerationImm function.
The function has no effect on the master-slave motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.6 acsc_GetDeceleration
Description
The function retrieves a value of motion deceleration.
Syntax
int acsc_GetDeceleration(HANDLE Handle, int Axis, double* Deceleration,
ACSC_WAITBLOCK* Wait)
Arguments
Deceleration Pointer to the variable that receives the value of motion deceleration.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the value of the motion deceleration. The retrieved value is a value defined
by a previous call of the acsc_SetDeceleration function, or the default value if the function was not
previously called.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Deceleration and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.12.7 acsc_SetJerk
Description
The function defines a value of motion jerk.
Syntax
int acsc_SetJerk(HANDLE Handle, int Axis, double Jerk, ACSC_WAITBLOCK* Wait)
Arguments
The value specifies a required motion jerk. The value will be used in the
Jerk
subsequent motions except for the master-slave motions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects the motions initiated after the function call. The function has no effect on any
motion that was started or planned before the function call. To change the jerk of an executed or
planned motion, use the acsc_SetJerkImm function.
The function has no effect on the master-slave motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.8 acsc_GetJerk
Description
The function retrieves a value of motion jerk.
Syntax
int acsc_GetJerk(HANDLE Handle, int Axis, double* Jerk,
ACSC_WAITBLOCK* Wait)
Arguments
Jerk Pointer to the variable that receives the value of motion jerk.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the value of the motion jerk. The retrieved value is a value defined by a
previous call of the acsc_SetJerk function, or the default value if the function was not called before.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Jerk and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.12.9 acsc_SetKillDeceleration
Description
The function defines a value of motion kill deceleration.
Syntax
int acsc_SetKillDeceleration(HANDLE Handle, int Axis, double KillDeceleration,
ACSC_WAITBLOCK* Wait)
Arguments
The value specifies a required motion kill deceleration. The value will
KillDeceleration
be used in the subsequent motions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects the motions initiated after the function call. The function has no effect on any
motion that was started or planned before the function call.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.12.10 acsc_GetKillDeceleration
Description
The function retrieves a value of motion kill deceleration.
Syntax
int acsc_GetKillDeceleration(HANDLE Handle, int Axis, double* KillDeceleration,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the value of the motion kill deceleration. The retrieved value is a value
defined by a previous call of the acsc_SetKillDeceleration function, or the default value if the
function was not called before.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
KillDeceleration and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.12.11 acsc_SetVelocityImm
Description
The function defines a value of motion velocity. Unlike acsc_SetVelocity, the function has immediate
effect on any executed or planned motion.
Syntax
int acsc_SetVelocityImm(HANDLE Handle, int Axis, double Velocity,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects:
> The currently executed motion. The controller provides a smooth transition from the instant
current velocity to the specified new value.
> The waiting motions that were planned before the function call.
> The motions that will be commanded after the function call.
The function has no effect on the master-slave motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.12 acsc_SetAccelerationImm
Description
The function defines a value of motion acceleration. Unlike acsc_SetAcceleration, the function has
immediate effect on any executed and planned motion.
Syntax
int acsc_SetAccelerationImm(HANDLE Handle, int Axis, double Acceleration,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects:
> The currently executed motion.
> The waiting motions that were planned before the function call.
> The motions that will be commanded after the function call.
The function has no effect on the master-slave motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.13 acsc_SetDecelerationImm
Description
The function defines a value of motion deceleration. Unlike acsc_SetDeceleration, the function has
immediate effect on any executed and planned motion.
Syntax
int acsc_SetDecelerationImm(HANDLE Handle, int Axis, double Deceleration,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects:
> The currently executed motion.
> The waiting motions that were planned before the function call.
> The motions that will be commanded after the function call.
4.12.14 acsc_SetJerkImm
Description
The function defines a value of motion jerk. Unlike acsc_SetJerk, the function has immediate effect
on any executed and planned motion.
Syntax
int acsc_SetJerkImm(HANDLE Handle, int Axis, double Jerk,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects:
> The currently executed motion.
> The waiting motions that were planned before the function call.
> The motions that will be commanded after the function call.
The function has no effect on the master-slave motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.15 acsc_SetKillDecelerationImm
Description
The function defines a value of motion kill deceleration. Unlike acsc_SetKillDeceleration, the function
has an immediate effect on any executed and planned motion.
Syntax
int acsc_SetKillDecelerationImm(HANDLE Handle, int Axis, double Deceleration,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the controller.
One value can be specified for each axis.
A single-axis motion uses the value of the corresponding axis. A multi-axis motion uses the value of
the leading axis. The leading axis is an axis specified first in the motion command.
The function affects:
> The currently executed motion
> The waiting motions that were planned before the function call
> The motions that will be commanded after the function call
The function has no effect on the master-slave motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.16 acsc_SetFPosition
Description
The function assigns a current value of feedback position.
Syntax
int acsc_SetFPosition(HANDLE Handle, int Axis, double FPosition,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function assigns a current value to the feedback position. No physical motion occurs. The motor
remains in the same position; only the internal controller offsets are adjusted so that the periodic
calculation of the feedback position will provide the required results.
For more information see the explanation of the SET command in the SPiiPlus ACSPL+ Programmer’s
Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.17 acsc_GetFPosition
Description
The function retrieves an instant value of the motor feedback position.
Syntax
int acsc_GetFPosition(HANDLE Handle, int Axis, double* FPosition,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the instant value of the motor feedback
FPosition
position.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves an instant value of the motor feedback position. The feedback position is a
measured position of the motor transferred to user units.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
FPosition and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.12.18 acsc_SetRPosition
Description
The function assigns a current value of reference position.
Syntax
int acsc_SetRPosition(HANDLE Handle, int Axis, double RPosition,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
Comments
The function assigns a current value to the reference position. No physical motion occurs. The motor
remains in the same position; only the internal controller offsets are adjusted so that the periodic
calculation of the reference position will provide the required results.
For more information see explanation of the SET command in the SPiiPlus ACSPL+ Programmer’s
Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.12.19 acsc_GetRPosition
Description
The function retrieves an instant value of the motor reference position.
Syntax
int acsc_GetRPosition(HANDLE Handle, int Axis, double* RPosition,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the instant value of the motor reference
Rposition
position.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves an instant value of the motor reference position. The reference position is a
value calculated by the controller as a reference for the motor.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
RPosition and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.12.20 acsc_GetFVelocity
Description
The function retrieves an instant value of the motor feedback velocity. Unlike acsc_GetVelocity, the
function retrieves the actually measured velocity and not the required value.
Syntax
int acsc_GetFVelocity(HANDLE Handle, int Axis, double* FVelocity,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the instant value of the motor feedback
FVelocity
velocity.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves an instant value of the motor feedback velocity. The feedback velocity is a
measured velocity of the motor transferred to user units.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
FVelocity and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.12.21 acsc_GetRVelocity
Description
The function retrieves an instant value of the motor reference velocity.
Syntax
int acsc_GetRVelocity(HANDLE Handle, int Axis, double* RVelocity,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the instant value of the motor reference
RVelocity
velocity.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves an instant value of the motor reference velocity. The reference velocity is a
value calculated by the controller in the process of motion generation.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
RVelocity and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
4.13.1 acsc_CommutExt
Description
This function initiates a motor commutation.
Syntax
Int acsc_CommutExt(HANDLE handle, int Axis, float Current, int Settle, int Slope, ACSC_WAITBLOCK
*Wait)
Arguments
Current Desired excitation current in percentage 0-100, ACSC_NONE for default value.
Specifies the time it takes for the current to rise to the desired value, ACSC_
Slope
NONE for default value.
Return Values
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function activates a motor. After the activation, the motor begins to follow the reference and
physical motion is available.
Settle can only be set if Current is set. Similarly Slope can only be set if Settle is set.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.13.2 acsc_Enable
Description
The function activates a motor.
Syntax
int acsc_Enable(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function activates a motor. After the activation, the motor begins to follow the reference and
physical motion is available.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.13.3 acsc_EnableM
Description
The function activates several motors.
Syntax
int acsc_EnableM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains -1 which marks the end of the
array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function activates several motors. After the activation, the motors begin to follow the
corresponding reference and physical motions for the specified motors are available.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.13.4 acsc_Disable
Description
The function shuts off a motor.
Syntax
int acsc_Disable(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function shuts off a motor. After shutting off the motor cannot follow the reference and
remains at idle.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.13.5 acsc_DisableAll
Description
The function shuts off all motors.
Syntax
int acsc_DisableAll(HANDLE Handle, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function shuts off all motors. After the shutting off none of motors can follow the
corresponding, reference and all motors remain idle.
If no motors are currently enabled, the function has no effect.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.13.6 acsc_DisableExt
Description
The function shuts off a motor and defines the disable reason.
Syntax
int acsc_DisableExt(HANDLE Handle, int Axis,int Reason,
ACSC_WAITBLOCK* Wait)
Arguments
Integer number that defines the reason of disable. The specified value is
Reason stored in the MERR variable in the controller and so modifies the state of the
disabled motor.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function shuts off a motor. After shutting off the motor cannot follow the reference and
remains at idle.
If Reason specifies one of the available motor termination codes, the state of the disabled motor will
be identical to the state of the motor disabled for the corresponding fault. This provides an
enhanced implementation of user-defined fault response.
If the second parameter specifies an arbitrary number, the motor state will be displayed as
“Kill/disable reason: <number> - customer code. This provides ability to separate different DISABLE
commands in the application.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.13.7 acsc_DisableM
Description
The function shuts off several specified motors.
Syntax
int acsc_DisableM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains -1 which marks the end of the
array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function shuts off several motors. After the shutting off, the motors cannot follow the
corresponding reference and remain idle.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.13.8 acsc_Group
Description
The function creates a coordinate system for a multi-axis motion.
Syntax
int acsc_Group(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains -1 which marks the end of the
array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function creates a coordinate system for a multi-axis motion. The first element of the Axes array
specifies the leading axis. The motion parameters of the leading axis become the default motion
parameters for the group.
An axis can belong to only one group at a time. If the application requires restructuring the axes, it
must split the existing group and only then create the new one. To split the existing group, use acsc_
Split function. To split all existing groups, use the acsc_SplitAll function.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.13.9 acsc_Split
Description
The function breaks down an axis group created before.
Syntax
int acsc_Split(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains -1 which marks the end of the
array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function breaks down an axis group created before by the acsc_Group function. The Axes
parameter must specify the same axes as for the acsc_Group function that created the group. After
the splitting up the group no longer exists.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.13.10 acsc_SplitAll
Description
The function breaks down all axis groups created before.
Syntax
int acsc_SplitAll(HANDLE Handle, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function breaks down all axis groups created before by the acsc_Group function.
The application may call this function to ensure that no axes are grouped. If no groups are currently
existed, the function has no effect.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
Terminates a motion using reduced deceleration profile and defines the kill
acsc_KillExt
reason.
4.14.1 acsc_Go
Description
The function starts up a motion waiting in the specified motion queue.
Syntax
int acsc_Go(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
A motion that was planned with ACSC_AMF_WAIT flag does not start until the acsc_Go function is
executed. Being planned, a motion waits in the appropriate motion queue.
Each axis has a separate motion queue. A single-axis motion waits in the motion queue of the
corresponding axis. A multi-axis motion waits in the motion queue of the leading axis. The leading
axis is an axis specified first in the motion command.
The acsc_Go function initiates the motion waiting in the motion queue of the specified axis. If no
motion waits in the motion queue, the function has no effect.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.14.2 acsc_GoM
Description
The function synchronously starts up several motions that are waiting in the specified motion
queues.
Syntax
int acsc_GoM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains -1 which marks the end of the
array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
A motion that was planned with ACSC_AMF_WAIT flag does not start until the acsc_GoM function is
executed. After being planned, a motion waits in the appropriate motion queue.
Each axis has a separate motion queue. A single-axis motion waits in the motion queue of the
corresponding axis. A multi-axis motion waits in the motion queue of the leading axis. The leading
axis is an axis specified first in the motion command.
The acsc_GoM function initiates the motions waiting in the motion queues of the specified axes. If
no motion waits in one or more motion queues, the corresponding axes are not affected.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.14.3 acsc_Halt
Description
The function terminates a motion using the full deceleration profile.
Syntax
int acsc_Halt(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the function has no effect.
The terminated motion finishes using the full third-order deceleration profile and the motion
deceleration value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.14.4 acsc_HaltM
Description
The function terminates several motions using the full deceleration profile.
Syntax
int acsc_HaltM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains -1 which marks the end of the
array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function terminates all executed motions that involve the specified axes. The terminated
motions can be either single-axis or multi-axis. All other motions waiting in the corresponding
motion queues are discarded and will not be executed.
If no executed motion involves a specified axis, the function has no effect on the corresponding
axis.
The terminated motions finish using the full third-order deceleration profile and the motion
deceleration values.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.14.5 acsc_Kill
Description
The function acsc_Kill terminates a motion using reduced deceleration profile.
Syntax
int acsc_Kill(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the function has no effect.
The terminated motion finishes with the reduced second-order deceleration profile and the kill
deceleration value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.14.6 acsc_KillAll
Description
The function terminates all currently executed motions.
Syntax
int acsc_KillAll(HANDLE Handle, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function terminates all currently executed motions. Any other motion waiting in any motion
queue is discarded and will not be executed.
If no motion is currently executed, the function has no effect.
The terminated motions finish with the reduced second-order deceleration profile and the kill
deceleration values.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.14.7 acsc_KillM
Description
The functionterminates several motions using reduced deceleration profile.
Syntax
int acsc_KillM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains -1 which marks the end of the
array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function terminates all executed motions that involve the specified axes. The terminated
motions can be either single-axis or multi-axis. All other motions waiting in the corresponding
motion queues are discarded and will not be executed.
If no executed motion involves a specified axis, the function has no effect on the corresponding
axis.
The terminated motions finish with the reduced second-order deceleration profile and the kill
deceleration values.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.14.8 acsc_KillExt
Description
The function terminates a motion using reduced deceleration profile and defines the kill reason.
Syntax
int acsc_KillExt(HANDLE Handle, int Axis, int Reason,ACSC_WAITBLOCK* Wait)
Arguments
Integer number that defines the reason of kill. The specified value is stored in
Reason the MERR variable in the controller and so modifies the state of the killed
motor.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function terminates the executed motion that involves the specified axis. The terminated
motion can be either single-axis or multi-axis. Any other motion waiting in the corresponding
motion queue is discarded and will not be executed.
If no executed motion involves the specified axis, the function has no effect.
The terminated motion finishes with the reduced second-order deceleration profile and the kill
deceleration value.
If Reason specifies one of the available motor termination codes, the state of the killed motor will be
identical to the state of the motor killed for the corresponding fault. This provides an enhanced
implementation of user-defined fault response.
If the second parameter specifies an arbitrary number, the motor state will be displayed as
“Kill/disable reason: <number> - customer code. This provides ability to separate different KILL
commands in the application.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
KillDeceleration and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.14.9 acsc_Break
Description
The function terminates a motion immediately and provides a smooth transition to the next motion.
Syntax
int acsc_Break(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function terminates the executed motion that involves the specified axis only if the next motion
is waiting in the corresponding motion queue. The terminated motion can be either single-axis or
multi-axis.
If the motion queue contains no waiting motion, the break command is not executed immediately.
The current motion continues instead until the next motion is planned to the same motion queue.
Only then is the break command executed.
If no executed motion involves the specified axis, or the motion finishes before the next motion is
planned, the function has no effect.
When executing the break command, the controller terminates the motion immediately without any
deceleration profile. The controller builds instead a smooth third-order transition profile to the next
motion.
Use caution when implementing the break command with a multi-axis motion, because the
controller provides a smooth transition profile of the vector velocity. In a single-axis motion, this
ensures a smooth axis velocity. However, in a multi-axis motion an axis velocity can change
abruptly if the terminated and next motions are not tangent to the junction point. To avoid jerk, the
terminated and next motion must be tangent or nearly tangent in the junction point.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.14.10 acsc_BreakM
Description
The function terminates several motions immediately and provides a smooth transition to the next
motions.
Syntax
int acsc_BreakM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function terminates the executed motions that involve the specified axes. Only those motions
are terminated that have the next motion waiting in the corresponding motion queue. The
terminated motions can be either single-axis or multi-axis.
If a motion queue contains no waiting motion, the break command does not immediately affect the
corresponding axis. The current motion continues instead until the next motion is planned to the
same motion queue. Only then, the break command is executed.
If no executed motion involves the specified axis, or the corresponding motion finishes before the
next motion is planned, the function does not affect the axis.
When executing the break command, the controller terminates the motion immediately without any
deceleration profile. Instead, the controller builds a smooth third-order transition profile to the next
motion.
Use caution when implementing the break command with a multi-axis motion, because the
controller provides a smooth transition profile of the vector velocity. In a single-axis motion, this
ensures a smooth axis velocity, but in a multi-axis motion, an axis velocity can change abruptly if the
terminated and next motions are not tangent in the junction point. To avoid jerk, the terminated and
next motion must be tangent or nearly tangent in the junction point.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
acsc_ Initiates a multi-axis motion to the specified point using the specified
ExtToPointM velocity or end velocity.
4.15.1 acsc_ToPoint
Description
The function initiates a single-axis motion to the specified point.
Syntax
int acsc_ToPoint(HANDLE Handle, int Flags, int Axis, double Point,
ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the function acsc_Go is
executed.
Flags
ACSC_AMF_RELATIVE: the Point value is relative to the end point of the
previous motion. If the flag is not specified, the Point specifies an absolute
coordinate.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a single-axis point-to-point motion.
The motion is executed using the required motion velocity and finishes with zero end velocity. The
required motion velocity is the velocity specified by the previous call of the acsc_SetVelocity function
or the default velocity if the function was not called.
To execute multi-axis point-to-point motion, use acsc_ToPointM. To execute motion with other
motion velocity or non-zero end velocity, use acsc_ToPoint or acsc_ExtToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function does not wait for the motion end. To wait for the motion end, use acsc_
WaitMotionEnd function.
The motion builds the velocity profile using the required values of velocity, acceleration,
deceleration, and jerk of the specified axis.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.15.2 acsc_ToPointM
Description
The function initiates a multi-axis motion to the specified point.
Syntax
int acsc_ToPointM(HANDLE Handle, int Flags, int* Axes, double* Point,
ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the function acsc_GoM
is executed.
ACSC_AMF_RELATIVE: the Point values are relative to the end point of the
Flags previous motion. If the flag is not specified, the Point specifies absolute
coordinates.
ACSC_AMF_MAXIMUM: not to use the motion parameters from the leading axis
but to calculate the maximum allowed motion velocity, acceleration,
deceleration, and jerk of the involved axes.
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions.
Array of the target coordinates. The number and order of values must
Point correspond to the Axes array. The Point must specify a value for each element
of Axes except the last –1 element.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a multi-axis point-to-point motion.
The motion is executed using the required motion velocity and finishes with zero end velocity. The
required motion velocity is the velocity specified by the previous call of the acsc_SetVelocity
function, or the default velocity if the function was not called.
To execute single-axis point-to-point motion, use acsc_ToPoint.To execute motion with other
motion velocity or non-zero end velocity, use acsc_ExtToPoint or acsc_ExtToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function does not wait for the motion end. To wait for the motion end, use acsc_
WaitMotionEnd function.
The motion builds the velocity profile using the required values of velocity, acceleration,
deceleration, and jerk of the leading axis. The leading axis is the first axis in the Axes array.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.15.3 acsc_ExtToPoint
Description
The function initiates a single-axis motion to the specified point using the specified velocity or end
velocity.
Syntax
int acsc_ExtToPoint(HANDLE Handle, int Flags, int Axis, double Point, double Velocity,
double EndVelocity, ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don't start it until the function acsc_
Go is executed.
ACSC_AMF_RELATIVE: the Point value is relative to the end point of the
previous motion. If the flag is not specified, the Point specifies an absolute
Flags
coordinate.
ACSC_AMF_VELOCITY: the motion will use velocity specified by the Velocity
argument instead of the default velocity.
ACSC_AMF_ENDVELOCITY: the motion will come to the end point with the
velocity specified by the EndVelocity argument.
Velocity in the target point. The argument is used only if the ACSC_AMF_
EndVelocity ENDVELOCITY flag is specified. Otherwise, the motion finishes with zero
velocity.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a single-axis point-to-point motion.
If the ACSC_AMF_VELOCITY flag is specified, the motion is executed using the velocity specified by
the Velocity argument. Otherwise, the required motion velocity is used. The required motion velocity
is the velocity specified by the previous call of the acsc_SetVelocity function, or the default velocity if
the function was not called.
If the ACSC_AMF_ENDVELOCITY flag is specified, the motion velocity at the final point is specified by
the EndVelocity argument. Otherwise, the motion velocity at the final point is zero.
To execute a multi-axis point-to-point motion with the specified velocity or end velocity, use acsc_
ExtToPointM. To execute motion with default motion velocity and zero end velocity, use acsc_
ExtToPoint or acsc_ToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function does not wait for the motion end. To wait for the motion end, use acsc_
WaitMotionEnd function.
The motion builds the velocity profile using the required values of acceleration, deceleration and jerk
of the specified axis.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.15.4 acsc_ExtToPointM
Description
The function initiates a multi-axis motion to the specified point using the specified velocity or end
velocity.
Syntax
int acsc_ExtToPointM(HANDLE Handle, int Flags, int* Axes, double* Point,
double Velocity, double EndVelocity, ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don't start it until the function acsc_
Go is executed.
ACSC_AMF_RELATIVE: the Point values are relative to the end of the
previous motion. If the flag is not specified, the Point specifies absolute
coordinates.
Flags ACSC_AMF_VELOCITY: the motion will use velocity specified by the Velocity
argument instead of the default velocity.
ACSC_AMF_ENDVELOCITY: the motion will come to the end with the
velocity specified by the EndVelocity argument.
ACSC_AMF_MAXIMUM: not to use the motion parameters from the leading
axis but to calculate the maximum allowed motion velocity, acceleration,
deceleration and jerk of the involved axes.
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis,
Axes one additional element must be located that contains –1 which marks the
end of the array.
For the axis constants see Axis Definitions.
Array of the target coordinates. The number and order of values must
Point correspond to the Axes array. The Point must specify a value for each
element of Axes except the last –1 element.
Vector velocity in the target point. The argument is used only if the ACSC_
EndVelocity AMF_ENDVELOCITY is specified. Otherwise, the motion finishes with zero
velocity.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a multi-axis point-to-point motion.
If the ACSC_AMF_VELOCITY flag is specified, the motion is executed using the velocity specified by
the Velocity argument. Otherwise, the required motion velocity is used. The required motion velocity
is the velocity specified by the previous call of the acsc_SetVelocity function, or the default velocity if
the function was not called.
If the ACSC_AMF_ENDVELOCITY flag is specified, the motion velocity at the final point is specified by
the EndVelocity argument. Otherwise, the motion velocity at the final point is zero.
To execute a single-axis point-to-point motion with the specified velocity or end velocity, use acsc_
ExtToPoint. To execute a motion with default motion velocity and zero end velocity, use acsc_
ToPoint or acsc_ToPointM.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function does not wait for the motion end. To wait for the motion end, use acsc_
WaitMotionEnd function.
The motion builds the velocity profile using the required values of acceleration, deceleration and jerk
of the leading axis. The leading axis is the first axis in the Axes array.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.15.5 acsc_SmoothTransitionPointToPointMotion
Description
The acsc_SmoothTransitionPointToPointMotion command creates motion to a specified target.
acsc_SmoothTransitionPointToPointMotion commands work in sequence and the next acsc_
SmoothTransitionPointToPointMotion command changes the previous target and provide a
smooth transition from one motion direction to another, based on acceleration, deceleration and
jerk values. The motion profile is optimized to pass on a rounded path near the breaking point,
minimizing changes in speed and direction that would cause unwanted vibrations in the system.
Syntax
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to 0, ACSC_AXIS_1 to 1, etc. After the last axis, one
additional element must be located that contains –1 which marks the
Axes end of the array.
2 or 3 Cartesian axes can participate in the motion.
For the axis constants see Axis Definitions.
Array of the final point coordinates. The number and order of values
Point must correspond to the Axes array. The Point must specify a value for
each element of Axes except the last –1 element.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Supported from V3.12.
Example
if (!acsc_SmoothTransitionPointToPointMotion(Handle, ACSC_AMF_VELOCITY,
Axes, Point, 1000, ACSC_NONE, ACSC_SYNCHRONOUS)) {
printf("transaction error: %d\n", acsc_GetLastError());
}
Function Description
4.16.1 acsc_BoostedPointToPointMotion
Description
This function defines a motion profile using the MotionBoost Feature.
Syntax
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last
Axes axis, one additional element must be located that contains – 1 which
marks the end of the array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Supported from V3.12.
Example
4.16.2 acsc_SmoothPointToPointMotion
Description
The acsc_SmoothPointToPointMotion command defines a multi-axes Point-to-Point motion and
provides the positioning to specific target and looks like the acsc_ToPointM command. Unlike acsc_
ToPointM, acsc_SmoothPointToPointMotion uses a 4th order motion profile.
If the axis is moving when the command is issued, the controller creates the motion and inserts it
into the axis motion queue. The motion waits in the queue until all motions before it finish, and only
then starts.
The acsc_SmoothPointToPointMotion command can be either a single axis or an axis group.
acsc_SmoothPointToPointMotion responds to KILL /HALT commands in the same fashion as do
other motion commands.
Syntax
Arguments
Bit-mapped argument that can include one or more of the following flags:
ACSC_AMF_VELOCITY
The motion will use velocity specified for each segment instead of the default
velocity.
ACSC_AMF_LOCALCS
Interpret entered coordinates according to the Local Coordinate System.
With this switch, use 2 axes motion coordinate only (X,Y). Using 3 or more
coordinates causes a runtime error.
ACSC_AMF_WAIT
Flags plan the motion but do not start it until the function acsc_GoM is executed.
ACSC_AMF_RELATIVE
Relative motion, The value of the point coordinate is relative to the end point
coordinate of the previous motion.
ACSC_AMF_ENVELOPE
Wait for motion termination before executing next command.
ACSC_AMF_DELAY_MOTION
Defines actual motor movement delay in microseconds. The delay resolution
is 50 microseconds.
The switch requires an additional parameter that specifies the motion delay.
Array of the final point coordinates. The number and order of values must
Point correspond to the Axes array. The Point must specify a value for each
element of Axes except the last –1 element.
Wait If Wait is ACSC_IGNORE, the function returns immediately. In this case, the
operation result is ignored by the library and cannot be retrieved to the
calling thread.
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
Function Description
4.17.1 acsc_Track
Description
The function initiates a single-axis track motion.
Syntax
int acsc_Track(HANDLE Handle, int Flags, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a single-axis track motion. After the motion is initialized, ptp motion will be
generated with every change in TPOS value.
The controller response indicates that the command was accepted and the motion was planned
successfully.
Example
4.17.2 acsc_SetTargetPosition
Description
The function assigns a current value of track position.
Syntax
int acsc_SetTargetPosition(HANDLE Handle, int Axis, double TargetPosition,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function assigns a current value to the Track position. If the corresponding axis is initialized with
track motion, the change of TPOS will cause generation of ptp motion to that new value.
For more information see the explanation of the track command in the SPiiPlus ACSPL+
Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.17.3 acsc_GetTargetPosition
Description
The function retrieves the instant value of track position.
Syntax
int acsc_GetTargetPosition(HANDLE Handle, int Axis, double *TargetPosition,
ACSC_WAITBLOCK* Wait)
Arguments
The pointer to variable that receives the instant value of the target
TargetPosition
position.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function reads a current value of the corresponding TPOS variable. If the corresponding axis is
initialized with track motion, TPOS controls the motion of the axis.
For more information see the explanation of the track command in the SPiiPlus ACSPL+
Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
4.18.1 acsc_Jog
Description
The function initiates a single-axis jog motion.
Syntax
int acsc_Jog(HANDLE Handle, int Flags, int Axis, double Velocity,
ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the function acsc_Go
Flags is executed.
ACSC_AMF_VELOCITY: the motion will use the velocity specified by the Velocity
argument instead of the default velocity.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a single-axis jog. To execute multi-axis jog, use acsc_JogM.
The jog motion is a motion with constant velocity and no defined ending point. The jog motion
continues until the next motion is planned, or the motion is killed for any reason.
The motion builds the velocity profile using the default values of acceleration, deceleration and jerk
of the specified axis. If the ACSC_AMF_VELOCITY flag is not specified, the default value of velocity is
used as well. In this case, only the sign of Velocity is used in order to specify the direction of motion.
The positive velocity defines a positive direction, the negative velocity – negative direction.
If the ACSC_AMF_VELOCITY flag is specified, the value of Velocity is used instead of the default
velocity. The sign of Velocity defines the direction of the motion.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully. No waiting for the motion end is provided.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.18.2 acsc_JogM
Description
The function initiates a multi-axis jog motion.
Syntax
int acsc_JogM(HANDLE Handle, int Flags, int* Axes, int* Direction, double Velocity,
ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the function acsc_Go
Flags is executed.
ACSC_AMF_VELOCITY: the motion will use the velocity specified by the
Velocity argument instead of the default velocity.
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis,
Axes one additional element must be located that contains –1 which marks the
end of the array.
For the axis constants see Axis Definitions..
Array of directions. The number and order of values must correspond to the
Axes array. The Direction array must specify direction for each element of
Axes except the last –1 element. The constant ACSC_POSITIVE_DIRECTION in
Direction
the Direction array specifies the correspondent axis to move in positive
direction, the constant ACSC_NEGATIVE_DIRECTION specifies the
correspondent axis to move in the negative direction.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a multi-axis jog motion. To execute single-axis jog motion, useacsc_Jog.
The jog motion is a motion with constant velocity and no defined ending point. The jog motion
continues until the next motion is planned, or the motion is killed for any reason.
The motion builds the vector velocity profile using the default values of velocity, acceleration,
deceleration and jerk of the axis group. If the ACSC_AMF_VELOCITY flag is not specified, the default
value of velocity is used as well. If the ACSC_AMF_VELOCITY flag is specified, the value of Velocity is
used instead of the default velocity.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function cannot wait or validate the end of the motion. To wait for the motion end,
use the acsc_WaitMotionEnd function.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
4.19.1 acsc_SetMaster
Description
The function initiates calculating of master value for an axis.
Syntax
int acsc_SetMaster(HANDLE Handle, int Axis, char* Formula,
ACSC_WAITBLOCK* Wait)
Arguments
Formula ASCII string that specifies a rule for calculating master value.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates calculating of master value for an axis.
The master value for each axis is presented in the controller as one element of the MPOS array.
Once the acsc_SetMaster function is called, the controller is calculates the master value for the
specified axis each controller cycle.
The acsc_SetMaster function can be called again for the same axis at any time. At that moment, the
controller discards the previous formula and accepts the newly specified formula for the master
calculation.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the controller starts
calculating the master value according to the formula.
The Formula string can specify any valid ACSPL+ expression that uses any standard or user global
variables as its operands.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.19.2 acsc_Slave
Description
The function initiates a master-slave motion.
Syntax
int acsc_Slave(HANDLE Handle, int Flags, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the function acsc_Go is
Flags executed.
ACSC_AMF_POSITIONLOCK: the motion will use position lock. If the flag is not
specified, velocity lock is used.
Return Value
If the function succeeds, the return value is non-zero.
Comments
The function initiates a single-axis master-slave motion with an unlimited area of following. If the
area of following must be limited, use acsc_SlaveStalled.
The master-slave motion continues until the motion is killed or the motion fails for any reason.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully.
The master value for the specified axis must be defined before by the call to acsc_SetMaster
function. The acsc_SetMaster function can be called again in order to change the formula of master
calculation. If at this moment the master-slave motion is in progress, the slave can come out from
synchronism. The controller then regains synchronism, probably with a different value of offset
between the master and slave.
If the ACSC_AMF_POSITIONLOCK flag is not specified, the function activates a velocity-lock mode of
slaved motion. When synchronized, the APOS axis reference follows the MPOS with a constant
offset:
APOS = MPOS + C
The value of C is latched at the moment when the motion comes to synchronism, and then remains
unchanged as long as the motion is synchronous. If at the moment of motion start the master
velocity is zero, the motion starts synchronously and C is equal to the difference between initial
values of APOS and MPOS.
If the ACSC_AMF_POSITIONLOCK flag is specified, the function activates a position-lock mode of
slaved motion. When synchronized, the APOS axis reference strictly follows the MPOS:
APOS = MPOS
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.19.3 acsc_SlaveStalled
Description
The function initiates master-slave motion within predefined limits.
Syntax
int acsc_SlaveStalled(HANDLE Handle, int Flags, int Axis, double Left, double Right, ACSC_
WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the acsc_Go function is
Flags executed.
ACSC_AMF_POSITIONLOCK: the motion will use position lock. If the flag is not
specified, velocity lock is used.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates single-axis master-slave motion within predefined limits. Use acsc_Slave to
initiate unlimited motion. For sophisticated forms of master-slave motion, use slaved variants of
segmented and spline motions.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully.
The master-slave motion continues until the kill command is executed, or the motion fails for any
reason.
The master value for the specified axis must be defined before by the call to acsc_SetMaster
function. The acsc_SetMaster function can be called again in order to change the formula of master
calculation. If at this moment the master-slave motion is in progress, the slave can come out from
synchronism. The controller then regains synchronism, probably with a different value of offset
between the master and slave.
If the ACSC_AMF_POSITIONLOCK flag is not specified, the function activates a velocity-lock mode of
slaved motion. When synchronized, the APOS axis reference follows the MPOS with a constant
offset:
APOS = MPOS + C
The value of C is latched at the moment when the motion comes to synchronism, and then remains
unchanged as long as the motion is synchronous. If at the moment of motion start the master
velocity is zero, the motion starts synchronously and C is equal to the difference between initial
values of APOS and MPOS.
If the ACSC_AMF_POSITIONLOCK flag is specified, the function activates a position-lock mode of
slaved motion. When synchronized, the APOS axis reference strictly follows the MPOS:
APOS = MPOS
The Left and Right values define the allowed area of changing the APOS value. The MPOS value is
not limited and can exceed the limits. In this case, the motion comes out from synchronism, and the
APOS value remains (stalls) in one of the limits until the change of MPOS allows following again.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
4.20.1 acsc_MultiPoint
Description
The function initiates a single-axis multi-point motion.
Syntax
int acsc_MultiPoint(HANDLE Handle, int Flags, int Axis, double Dwell,
ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the function acsc_Go is
executed.
ACSC_AMF_RELATIVE: the coordinates of each point are relative. The first point
is relative to the instant position when the motion starts; the second point is
Flags relative to the first, etc. If the flag is not specified, the coordinates of each point
are absolute.
ACSC_AMF_VELOCITY: the motion uses the velocity specified with each point
instead of the default velocity.
ACSC_AMF_CYCLIC: the motion uses the point sequence as a cyclic array. After
positioning to the last point it does positioning to the first point and continues.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a single-axis multi-point motion. To execute multi-axis multi-point motion, use
acsc_MultiPointM.
The motion executes sequential positioning to each of the specified points, optionally with dwell in
each point.
The function itself does not specify any point, so that the created motion starts only after the first
point is specified. The points of motion are specified by using the acsc_AddPoint or acsc_
ExtAddPoint functions that follow this function.
The motion finishes when the acsc_EndSequence function is executed. If the call of acsc_
EndSequence is omitted, the motion will stop at the last point of the sequence and wait for the next
point. No transition to the next motion in the motion queue will occur until the function acsc_
EndSequence executes.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function cannot wait or validate the end of the motion. To wait for the motion end,
use the acsc_WaitMotionEnd function.
During positioning to each point, a velocity profile is built using the default values of acceleration,
deceleration, and jerk of the specified axis. If the ACSC_AMF_VELOCITY flag is not specified, the
default value of velocity is used as well. If the ACSC_AMF_VELOCITY flag is specified, the value of
velocity specified in subsequent acsc_ExtAddPoint functions is used.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.20.2 acsc_MultiPointM
Description
The function initiates a multi-axis multi-point motion.
Syntax
int acsc_MultiPointM(HANDLE Handle, int Flags, int* Axes, double Dwell,
ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the function acsc_
GoMis executed.
ACSC_AMF_RELATIVE: the coordinates of each point are relative. The first point
is relative to the instant position when the motion starts; the second point is
Flags relative to the first, etc. If the flag is not specified, the coordinates of each point
are absolute.
ACSC_AMF_VELOCITY: the motion will use the velocity specified with each point
instead of the default velocity.
ACSC_AMF_CYCLIC: the motion uses the point sequence as a cyclic array: after
positioning to the last point does positioning to the first point and continues.
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions..
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a multi-axis multi-point motion. To execute single-axis multi-point motion, use
acsc_MultiPoint.
The motion executes sequential positioning to each of the specified points, optionally with dwell in
each point.
The function itself does not specify any point, so the created motion starts only after the first point is
specified. The points of motion are specified by using acsc_AddPointM or acsc_ExtAddPointM,
functions that follow this function.
The motion finishes when the acsc_EndSequenceM function is executed. If the call of acsc_
EndSequenceM is omitted, the motion will stop at the last point of the sequence and wait for the
next point. No transition to the next motion in the motion queue will occur until the function acsc_
EndSequenceM executes.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function cannot wait or validate the end of the motion. To wait for the motion end,
use acsc_WaitMotionEnd function.
During positioning to each point, a vector velocity profile is built using the default values of velocity,
acceleration, deceleration, and jerk of the axis group. If the AFM_VELOCITY flag is not specified, the
default value of velocity is used as well. If the AFM_VELOCITY flag is specified, the value of velocity
specified in subsequent acsc_ExtAddPointM functions is used.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
acsc_ Initiates a multi-axis spline motion. The motion follows an arbitrary path
SplineM defined by a set of points.
4.21.1 acsc_Spline
Description
The function initiates a single-axis spline motion. The motion follows an arbitrary path defined by a
set of points.
Syntax
int acsc_Spline(HANDLE Handle, int Flags, int Axis, double Period, ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the acsc_Go function is
executed.
ACSC_AMF_RELATIVE: use the coordinates of each point as relative. The first
point is relative to the instant position when the motion starts; the second
point is relative to the first, etc. If the flag is not specified, the coordinates of
each point are absolute.
ACSC_AMF_VARTIME: the time interval between adjacent points is non-uniform
and is specified along with each added point. If the flag is not specified, the
interval is uniform and is specified in the Period argument.
Flags
ACSC_AMF_CYCLIC: use the point sequence as a cyclic array: after the last point
come to the first point and continue.
ACSC_AMF_CUBIC: use a cubic interpolation between the specified points (third-
order spline).
If the flag is not specified, linear interpolation is used (first-order
spline).
If the flag is specified and the ACSC_AMF_VARTIME is not specified, the
controller builds a PV spline motion.
If the flag is specified and the ACSC_AMF_VARTIME is specified, the
controller builds a PVT spline motion.
Time interval between adjacent points. The parameter is used only if the ACSC_
Period
AMF_VARTIME flag is not specified.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a single-axis spline motion. To execute multi-axis spline motion, use acsc_
SplineM.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function cannot wait or validate the end of the motion. To wait for the motion end,
use the acsc_WaitMotionEnd function.
The motion does not use the default values of velocity, acceleration, deceleration, and jerk. The
points and the time intervals between the points completely define the motion profile.
Points for arbitrary path motion are defined by the consequent calls of acsc_AddPoint or acsc_
ExtAddPoint functions. The acsc_EndSequence function terminates the point sequence. After
execution of the acsc_EndSequence function, no acsc_AddPVPoint or acsc_ExtAddPoint functions
for this motion are allowed.
The trajectory of the motion follows through the defined points. Each point presents the instant
desired position at a specific moment. Time intervals between the points are uniform, or non-
uniform as defined by the ACSC_AMF_VARTIME flag.
This motion does not use a motion profile generation. The time intervals between the points are
typically short, so that the array of the points implicitly specifies the desired velocity in each point.
If the time interval does not coincide with the controller cycle, the controller provides interpolation
of the points according to the ACSC_AMF_CUBIC flag.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example 1
int i;
if (!acsc_Spline(Handle, // communication handle
ACSC_AMF_CUBIC, //PV motion uniform time inteval
ACSC_AXIS_0, // axis 0
10, // uniform interval 10 ms
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
// add some points
for (i = 0; i <100; i++)
acsc_AddPVPoint(Handle,ACSC_AXIS_0,i*100,i*100,NULL);
//position,velocity for each point
// the end of the arbitrary path motion
acsc_EndSequence(Handle, ACSC_AXIS_0, NULL);
Example 2
int i;
if (!acsc_Spline(Handle, // communication handle
ACSC_AMF_CUBIC|ACSC_AMF_VARTIME,//PVT motion
ACSC_AXIS_0, // axis 0
0, // uniform interval is not used
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
// add some points
for (i = 0; i <100; i++)
acsc_AddPVTPoint(Handle,ACSC_AXIS_0,i*100,i*100,100+i,NULL);
//position,velocity and time interval for each point
// the end of the arbitrary path motion
acsc_EndSequence(Handle, ACSC_AXIS_0, NULL);
4.21.2 acsc_SplineM
Description
The function initiates a multi-axis spline motion. The motion follows an arbitrary path defined by a
set of points.
Syntax
int acsc_SplineM(HANDLE Handle, int Flags, int* Axes, double Period, ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but don’t start it until the acsc_GoM function
is executed.
ACSC_AMF_RELATIVE: the coordinates of each point are relative. The first point
is relative to the instant position when the motion starts; the second point is
relative to the first, etc. If the flag is not specified, the coordinates of each point
are absolute.
Flags ACSC_AMF_VARTIME: the time interval between adjacent points is non-uniform
and is specified along with each added point. If the flag is not specified, the
interval is uniform and is specified in the Period argument.
ΑCSC_AMF_CYCLIC: the motion uses the point sequence as a cyclic array: after
the last point the motion comes to the first point and continues.
ACSC_AMF_CUBIC: use a cubic interpolation between the specified points (third-
order spline). If the flag is not specified, linear interpolation is used (first-order
spline).
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions..
Time interval between adjacent points. The parameter is used only if the ACSC_
Period
AMF_VARTIME flag is not specified.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates a multi-axis spline motion. To execute a single-axis spline motion, use acsc_
Spline.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function cannot wait or validate the end of the motion. To wait for the motion end,
use the acsc_WaitMotionEnd function.
The motion does not use the default values of velocity, acceleration, deceleration, and jerk. The
points and the time intervals between the points define the motion profile completely.
Points for arbitrary path motion are defined by the consequent calls of the acsc_AddPVPointM or
acsc_AddPVTPointM functions. The acsc_EndSequenceM function terminates the point sequence.
After execution of the acsc_EndSequenceM function, no acsc_AddPVPointM or acsc_AddPVTPointM
functions for this motion are allowed.
The trajectory of the motion follows through the defined points. Each point presents the instant
desired position at a specific moment. Time intervals between the points are uniform, or non-
uniform as defined by the ACSC_AMF_VARTIME flag.
This motion does not use motion profile generation. Typically, the time intervals between the points
are short, so that the array of the points implicitly specifies the desired velocity in each point.
If the time interval does not coincide with the controller cycle, the controller provides interpolation
of the points according to the ACSC_AMF_CUBIC flag.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example 1
int i;
int Axes[]={ACSC_AXIS_0, ACSC_AXIS_1, ACSC_AXIS_4,-1};
double Point[3];
double Velocity[3];
if (!acsc_SplineM( Handle, // communication handle
ACSC_AMF_CUBIC, // PV motion
Axes, // axis 0
10, // uniform interval 10 ms
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
// add some points
for (i = 0; i <100; i++)
{
Point[0]=i*50; Point[1]=i*100; Point[2]=i*150;
Velocity[0]=i*50; Velocity [1]=i*100; Velocity [2]=i*150;
acsc_AddPVPointM(Handle,Axes,Point,Velocity,NULL);
//position and velocity for each point
}
// the end of the arbitrary path motion
acsc_EndSequenceM(Handle, Axes, NULL);
Example 2
int i;
int Axes[]={ACSC_AXIS_0, ACSC_AXIS_1, ACSC_AXIS_2,-1};
double Point[3];
double Velocity[3];
if (!acsc_SplineM(Handle, // communication handle
ACSC_AMF_CUBIC|ACSC_AMF_VARTIME,//PVT motion
Axes,
0, // uniform interval is not used
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
// add some points
for (i = 0; i <100; i++)
{
Point[0]=i*50; Point[1]=i*100; Point[2]=i*150;
Velocity[0]=i*50; Velocity [1]=i*100; Velocity [2]=i*150;
acsc_AddPVTPointM(Handle,Axes,Point,Velocity,100+i,NULL);
//position,velocity and time interval for each point
}
// the end of the arbitrary path motion
acsc_EndSequence(Handle, Axes, NULL);
The following example illustrates how the PVSPLINE command can be used for adding points on-
the-fly. The example also shows a simple approach to synchronization between the host-based
program that calculates the points and the controller that executes the motion.
The host-based program calculates the desired points and transmits the coordinates via Ethernet
link. The motion involves 6 axes. Therefore, each point specification contains 12 real numbers (6
coordinates and 6 velocities).
Because transmitting each point separately would be a very inefficient use of the Ethernet, the host
calculates the desired points in advance and transmits them in batches of 50 points. The controller
then executes the motion. As soon as the controller is ready to accept the next batch of points and
the host is ready to send that batch, the next transmission occurs, and so on.
The pace of the host and the controller do not have to be identical. However, the host is assumed to
be fast enough to calculate the next 50 points before the controller has moved through the
previous 50 points.
The program running on the host looks like the following pseudo code:
double HPoints(12)(50);
int N, HSync;
HANDLE Com;
open communication, start program in buffer NBuf of the controller;
while (Continue)
calculate N (<= 50) points in array Hpoints;
acsc_WriteReal(Com, NBuf, "Points" , 0, 11, 0, N-1, HPoints, 0) ;
acsc_WriteInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &N, 0);
do
acsc_ReadInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &HSync, 0);
while HSync;
reset Continue to zero if all points have been calculated;
end;
N = -1
acsc_WriteInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &N, 0);
Function Description
4.22.1 acsc_AddPVPoint
Description
The function adds a point to a single-axis PV spline motion and specifies velocity.
Syntax
int acsc_AddPVPoint(HANDLE Handle, int Axis, double Point, double Velocity,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Before this function can be used, PV spline motion must be initiated by calling acsc_Spline with the
appropriate flags.
The function adds a point to a single-axis PV spline motion with a uniform time and specified
velocity at that point
To add a point to a multi-axis PV motion, use acsc_AddPVPointM. To add a point to a PVT motion
with non-uniform time interval, use the acsc_AddPVTPoint and acsc_AddPVTPointM functions. The
function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
function periodically until the function returns non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
int i;
if (!acsc_Spline(Handle, // communication handle
ACSC_AMF_CUBIC, //PV motion uniform time inteval
ACSC_AXIS_0, // axis 0
10, // uniform interval 10 ms
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
// add some points
for (i = 0; i <100; i++)
acsc_AddPVPoint(Handle,ACSC_AXIS_0,i*100,i*100,NULL);
//position,velocity and time interval for each point
// the end of the arbitrary path motion
acsc_EndSequence(Handle, ACSC_AXIS_0, NULL);
4.22.2 acsc_AddPVPointM
Description
The function adds a point to a multiple-axis PV spline motion and specifies velocity.
Syntax
int acsc_AddPVPointM(HANDLE Handle, int *Axis, double *Point, double *Velocity,
ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_
0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions..
Array of the coordinates of added point. The number and order of values must
Point correspond to the Axes array. The Point must specify a value for each element
of Axes except the last –1 element.
Array of the velocities of added point. The number and order of values must
Velocity correspond to the Axes array. The Velocity must specify a value for each
element of Axes except the last –1 element.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Before this function can be used, PVT spline motion must be initiated by calling acsc_SplineM with
the appropriate flags.
The function adds a point to a multiple-axis PV spline motion with a uniform time and specified
velocity at that point.
To add a point to a single-axis PV motion, use acsc_AddPVPoint. To add a point to a PVT motion with
non-uniform time interval, use the acsc_AddPVTPoint andacsc_AddPVTPointM functions.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
function periodically until the function returns non-zero value.
All axes specified in the Axes array must be specified before the call of the acsc_MultiPointM or
acsc_SplineMfunction. The number and order of the axes in the Axes array must correspond exactly
to the number and order of the axes of acsc_MultiPointM or acsc_SplineMfunctions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
int i;
int Axis[]={ACSC_AXIS_0, ACSC_AXIS_1, ACSC_AXIS_4,-1};
double Point[3];
double Velocity[3];
if (!acsc_SplineM( Handle, // communication handle
ACSC_AMF_CUBIC, // PV motion
Axis, // axis 0
10, // uniform interval 10 ms
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
// add some points
for (i = 0; i <100; i++)
{
Point[0]=i*50; Point[1]=i*100; Point[2]=i*150;
Velocity[0]=i*50; Velocity [1]=i*100; Velocity [2]=i*150;
acsc_AddPVPointM(Handle,Axis,Point,Velocity,NULL);
//position,velocity and time interval for each point
}
// the end of the arbitrary path motion
acsc_EndSequence(Handle, ACSC_AXIS_0, NULL);
4.22.3 acsc_AddPVTPoint
Description
The function adds a point to a single-axis PVT spline motion and specifies velocity and motion time.
Syntax
int acsc_AddPVTPoint(HANDLE Handle, int Axis, double Point, double Velocity,
double TimeInterval, ACSC_WAITBLOCK* Wait)
Arguments
If the motion was activated by the acsc_Spline function with the ACSC_
TimeInterval AMF_VARTIME flag, this parameter defines the time interval between the
previous point and the present one.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Before this function can be used, PV spline motion must be initiated by calling acsc_Spline with the
appropriate flags.
The function adds a point to a single-axis PVT spline motion with a non-uniform time and specified
velocity at that point.
To add a point to a multi-axis PVT motion, use acsc_AddPVTPointM. To add a point to a PV motion
with uniform time interval, use the acsc_AddPVPoint and acsc_AddPVPointM functions.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
function periodically until the function returns non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
int i;
if (!acsc_Spline(Handle, // communication handle
ACSC_AMF_CUBIC|ACSC_AMF_VARTIME,//PVT motion
ACSC_AXIS_0, // axis 0
0, // uniform interval is not used
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
// add some points
for (i = 0; i <100; i++)
acsc_AddPVTPoint(Handle,ACSC_AXIS_0,i*100,i*100,100+i,NULL);
//position,velocity and time interval for each point
// the end of the arbitrary path motion
acsc_EndSequence(Handle, ACSC_AXIS_0, NULL);
4.22.4 acsc_AddPVTPointM
Description
The function adds a point to a multiple-axis PVT spline motion and specifies velocity and motion
time.
Syntax
int acsc_AddPVTPointM(HANDLE Handle, int *Axis, double *Point,
double *Velocity,double TimeInterval, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis,
Axes one additional element must be located that contains –1 which marks the
end of the array.
For the axis constants see Axis Definitions..
Array of the coordinates of added point. The number and order of values
Point must correspond to the Axes array. The Point must specify a value for
each element of Axes except the last –1 element.
Array of the velocities of added point. The number and order of values
Velocity must correspond to the Axes array. The Velocity must specify a value for
each element of Axes except the last –1 element.
If the motion was activated by the acsc_SplineM function with the ACSC_
TimeInterval AMF_VARTIME flag, this parameter defines the time interval between the
previous point and the present one.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Before this function can be used, PVT spline motion must be initiated by calling acsc_SplineM with
the appropriate flags.
The function adds a point to a multiple-axis PVT spline motion with a non-uniform time and
specified velocity at that point.
To add a point to a single-axis PVT motion, use acsc_AddPVTPoint. To add a point to a PV motion
with uniform time interval, use the acsc_AddPVPoint and acsc_AddPointM functions.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
function periodically until the function returns non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
int i;
int Axis[]={ACSC_AXIS_0, ACSC_AXIS_1, ACSC_AXIS_2,-1};
double Point[3];
double Velocity[3];
if (!acsc_SplineM(Handle, // communication handle
ACSC_AMF_CUBIC|ACSC_AMF_VARTIME,//PVT motion
Axis, // axis 0
0, // uniform interval is not used
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
// add some points
for (i = 0; i <100; i++)
{
Point[0]=i*50; Point[1]=i*100; Point[2]=i*150;
Velocity[0]=i*50; Velocity [1]=i*100; Velocity [2]=i*150;
acsc_AddPVTPointM(Handle,Axis,Point,Velocity,100+i,NULL);
//position,velocity and time interval for each point
}
// the end of the arbitrary path motion
acsc_EndSequence(Handle, ACSC_AXIS_0, NULL);
Function Description
acsc_
Initiates a multi-axis extended segmented motion.
ExtendedSegmentedMotionV2
4.23.1 acsc_ExtendedSegmentedMotionV2
Description
The function initiates a multi-axis extended segmented motion.
Syntax
int acsc_ExtendedSegmentedMotionExtV2(HANDLE Handle, int Flags, int* Axes, double* Point,
double Velocity, double EndVelocity, double JunctionVelocity, double Angle, double CurveVelocity,
double Deviation, double Radius, double MaxLength, double StarvationMargin, char* Segments, int
ExtLoopType, double MinSegmentLength, double MaxAllowedDeviation, int OutputIndex, int
BitNumber, int Polarity, double MotionDelay, ACSC_WAITBLOCK* Wait);
Arguments
If the Segments parameter is used, then the starvation margin must also be
defined.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
The function itself does not specify any segment, so the created motion starts only after the first
segment is specified.
The segments of motion are specified by using the acsc_SegmentLineV2, acsc_SegmentArc1V2, and
acsc_SegmentArc2V2 functions.
The motion finishes when the acsc_EndSequenceM function is executed. If the call to acsc_
EndSequenceM is omitted, the motion will stop at the last segment of the sequence and wait for the
next segment. No transition to the next motion in the motion queue will occur until the function
acsc_EndSequenceM is executed.
During positioning to each point, a vector velocity profile is built using the default values of velocity,
acceleration, deceleration, and jerk of the axis group. If the ACSC_AFM_VELOCITY flag is not specified,
the default value of velocity is used as well. If the ACSC_AFM_VELOCITY flag is specified, the value of
velocity specified in subsequent acsc_SegmentLineExt, acsc_ExtendedSegmentArc1, or acsc_
ExtendedSegmentArc2 functions is used.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function does not wait and does not validate the end of the motion. To wait for the
motion end, use the acsc_WaitMotionEnd function.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function is made.
Supported from V3.12.
Example
4.23.2 acsc_SegmentLineV2
Description
The function adds a linear segment that starts at the current point and ends at the destination point
of segmented motion.
Syntax
Int acsc_SegmentLineExtV2(HANDLE handle, int Flags, int* Axes, Double* Point, double Velocity,
double EndVelocity, int Time, char* Values, char* Variables, int Index, char* Masks, int ExtLoopType,
double MinSegmentLength, double MaxAllowedDeviation, int LciState, ACSC_WAITBLOCK* Wait);
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function adds a linear segment that starts at the current point and ends at the destination point
to segmented motion.
All axes specified in the Axes array must be specified before the call of the acsc_
ExtendedSegmentedMotionV2 function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the acsc_ExtendedSegmentedMotionV2
function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
ACSC_AMF_VELOCITY and ACSC_AMF_VARTIME are mutually exclusive, meaning they cannot be
used together.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the segment is added to the
motion buffer. The segment can be rejected if the motion buffer is full. In that case, you can call this
function periodically until the function returns a non-zero value
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Supported from V3.12.
Example
4.23.3 acsc_ExtendedSegmentArc1V2
Description
The function defines an arc segment that starts at the current point and ends at the destination
point with the specified center point. The segment is added to the motion path .
Syntax
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
All axes specified in the Axes array must be specified before the call of the acsc_
ExtendedSegmentedMotionV2 function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the acsc_ExtendedSegmentedMotionV2
function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
ACSC_AMF_VELOCITY and ACSC_AMF_VARTIME are mutually exclusive, meaning they cannot be
used together.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the segment is added to the
motion buffer. The segment can be rejected if the motion buffer is full. In that case, call this function
periodically until the function returns a non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the "acsc_WaitForAsyncCall" on page 371 function.
Supported from V3.12.
Example
4.23.4 acsc_SegmentArc2V2
Description
The function adds an arc segment to a segmented motion and specifies the coordinates of the
center point and the rotation angle.
Syntax
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
All axes specified in the Axes array must be specified before calling the function. The number and
order of the axes in the Axes array must correspond exactly to the number and order of the axes of
the acsc_SegmentedMotion or acsc_ExtendedSegmentedMotionV2 function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
ACSC_AMF_VELOCITY and ACSC_AMF_VARTIME are mutually exclusive, meaning they cannot be
used together.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the segment is added to the
motion buffer. The segment can be rejected if the motion buffer is full. In that case, you can call this
function periodically until the function returns a non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the "acsc_WaitForAsyncCall" on page 371 function.
Supported from V3.12.
Example
if (!acsc_SegmentArc2V2(Handle,
ACSC_AMF_VELOCITY | ACSC_AMF_ENDVELOCITY,// Flags
axes,// Axes center,//Center
-3.141529,// Angle FinalPointArc2,// FinalPoints 5000,// Velocity
10000,// EndVelocity ACSC_NONE,// Time NULL,// Values NULL,// Variables
ACSC_NONE,// Index NULL,// Masks
ACSC_NONE, //ExtLoopType
ACSC_NONE, //MinSegemntlegth
ACSC_NONE, // maximum_allowed_deviation
ACSC_NONE, // LciState
NULL))// Wait
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.23.5 acsc_Stopper
Description
The function provides a smooth transition between two segments of segmented motion.
Syntax
int acsc_Stopper(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The controller builds the motion so that the vector velocity follows the smooth velocity diagram. The
segments define the projection of the vector velocity to axis velocities. If all segments are
connected smoothly, axis velocity is also smooth. However, if the user defined a path with an
inflection point, axis velocity has a jump in this point. The jump can cause a motion failure due to the
acceleration limit.
The function is used to avoid velocity jump in the inflection points. If the function is specified
between two segments, the controller provides smooth deceleration to zero in the end of first
segment and smooth acceleration to specified velocity in the beginning of second segment.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.23.6 acsc_Projection
Description
The function sets a projection matrix for segmented motion.
Syntax
int acsc_Projection(HANDLE Handle, int* Axes, char* Matrix,
ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions.
Pointer to the null-terminated string containing the name of the matrix that
Matrix
provides the specified projection.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets a projection matrix for segmented motion.
The projection matrix connects the plane coordinates and the axis values in the axis group. The
projection can provide any transformation as rotation or scaling. The number of the matrix rows
must be equal to the number of the specified axes. The number of the matrix columns must equal
two.
The matrix must be declared before as a global variable by an ACSPL+ program or by the acsc_
DeclareVariable function and must be initialized by an ACSPL+ program or by the acsc_WriteReal
function.
For more information about projection, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
Function Description
4.24.1 acsc_BlendedSegmentMotion
Description
The function initiates a multi-axis blended segmented motion. Extended segmented motion
provides new features:
Syntax
int acsc_BlendedSegmentMotion(HANDLE handle, int Flags, int* Axes, double* Position, double
SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ACSC_WAITBLOCK
*Wait)
Arguments
Return Value
If the function succeeds, a non-zero is returned.
If the function fails, return value is zero.
Comments
Blended segmented motion is a type of segmented motion that doesn’t provide look-ahead
capabilities, unlike Extended segmented motion. Both type of motions are intended for processing a
complex multi-axis trajectory and smoothing corners between segments, but do it in different ways.
The Extended segmented motion (XSEG) allows achieving highest throughput within the defined
axis limitations and the defined accuracy. The Blended segmented motion (BSEG) allows passing
along the trajectory with the defined timing constrains.
The function itself does not specify any movement, so the created motion starts only after the first
segment is specified.
The segments of motion are specified by using acsc_BlendedLine, acsc_BlendedArc1, acsc_
BlendedArc2 functions that follow this function.
The motion finishes when the acsc_EndSequenceM function is executed. If the call of acsc_
EndSequenceM is omitted, the motion will stop at the last segment of the sequence and wait for the
next segment. No transition to the next motion in the motion queue will occur until the function
acsc_EndSequenceM is executed.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the motion was planned
successfully. The function does not wait and does not validate the end of the motion. To wait for the
motion end, use the acsc_WaitMotionEnd function.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.24.2 acsc_BlendedLine
Description
The function adds a linear segment that starts at the current point and ends at the destination point
of segmented motion.
Syntax
Int acsc_BlendedLine (HANDLE handle, int Flags, int* Axes, double* Point, double SegmentTime,
double AccelerationTime, double JerkTime, double DwellTime, ACSC_WAITBLOCK* Wait);
Arguments
Array of the final point coordinates. The number and order of values
Point must correspond to the Axes array. The Point must specify a value
for each element of Axes except the last –1 element.
Return Value
If the function succeeds, a non-zero is returned.
If the function fails, return value is zero.
Comments
The function adds a linear segment that starts at the current point and ends at the destination point
to segmented motion.
All axes specified in the Axes array must be specified in a previous call to the acsc_
BlendedSegmentMotion function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the call to the acsc_
BlendedSegmentMotion function.
The Point argument specifies the coordinates of the final point. The coordinates are absolute in the
plane.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the segment is added to the
motion buffer. The segment can be rejected if the motion buffer is full. In that case, you can call this
function periodically until the function returns a non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete
theWait item until a call to the "acsc_WaitForAsyncCall" on page 371 function.
Example
4.24.3 acsc_BlendedArc1
Description
The function adds to the motion path an arc segment that starts at the current point and ends at the
destination point with the specified center point.
Syntax
Int acsc_BlendedArc1 (HANDLE handle, int Flags, int* Axes, double* Center, double* FinalPoint, int
Rotation, double SegmentTime, double AccelerationTime, double JerkTime, double DwellTime,
ACSC_WAITBLOCK* Wait);
Arguments
Return Value
If the function succeeds, a non-zero is returned.
If the function fails, return value is zero.
Comments
All axes specified in the Axes array must be specified in a previous call to the acsc_
BlendedSegmentMotion function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the call to the acsc_
BlendedSegmentMotion function.
The FinalPoint argument specifies the coordinates of the final point. The coordinates are absolute in
the plane.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the segment is added to the
motion buffer. The segment can be rejected if the motion buffer is full. In that case, you can call this
function periodically until the function returns a non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.24.4 acsc_BlendedArc2
Description
The function adds an arc segment to a segmented motion and specifies the coordinates of the
center point and the rotation angle.
Syntax
Int acsc_BlendedArc2 (HANDLE handle, int Flags, int* Axes, double* Center, double Angle, double
SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ACSC_WAITBLOCK*
Wait);
Arguments
Return Value
If the function succeeds, a non-zero is returned.
If the function fails, return value is zero.
Comments
All axes specified in the Axes array must be specified in a previous call to the acsc_
BlendedSegmentMotion function. The number and order of the axes in the Axes array must
correspond exactly to the number and order of the axes of the call to the acsc_
BlendedSegmentMotion function.
The Center argument specifies the coordinates of the Center point. The coordinates are absolute in
the plane.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the segment is added to the
motion buffer. The segment can be rejected if the motion buffer is full. In that case, you can call this
function periodically until the function returns a non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the "acsc_WaitForAsyncCall" on page 371 function.
Example
acsc_
Adds a new segment to the Smooth Path Motion generator.
SmoothPathSegment
4.25.1 acsc_NurbsMotion
Description
The function creates NURBS motion. NURBS is a motion generator based on the NURBS spline
specification. The algorithm accepts as parameters points, weights, and knots, and generates a
spline trajectory accordingly.
Syntax
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Supported from V3.12.
Example
4.25.2 acsc_NurbsPoint
Description
The function adds a new control point to the NURBS motion generator.
Syntax
Arguments
Bit-mapped argument that may include one or more of the following flags:
ACSC_AMF_VELOCITY
The motion will use velocity specified for each segment instead of the
default velocity.
ACSC_AMF_REQUIRED_VELOCITY
Specify required velocity. The suffix is not compatible with ACSC_AMF_
VELOCITY. The flag requires a non-zero value in the parameter that
specifies required velocity. The value is considered required velocity at the
current point, but does not change required velocity for subsequent points.
ACSC_AMF_CORNER
Mark the current point as a corner.
The control point is processed as a corner. Actually, such point divides the
spline into two independent splines.
ACSC_AMF_DUMMY
Mark the point specification as dummy. Dummy point specifications can
either precede the first control point specification, or follow the last control
point specification. Dummy points specification is required in rare cases
where default calculation of starting/trailing knots is not suitable (see
Dummy point specification)
Flags
ACSC_AMF_WEIGHT
Specify control point weight. The suffix requires additional parameter that
specifies the weight of the control point.
ACSC_AMF_KNOT
Specify knot delta. The suffix requires additional parameter that specifies
knot delta from the previous knot. The new knot is calculated as the
previous knot plus delta.
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis,
Axes one additional element must be included that contains –1, marking the end
of the array.
For the axis constants see Axis Definitions.
Array of the final point coordinates. The number and order of values must
Point correspond to the Axes array. The Point must specify a value for each
element of Axes except the last –1 element.
If ACSC_AMF_ KNOT flag was specified, this argument specifies a knot delta
Knot from the previous knot.
Set this argument to ACSC_NONE if not used.
If ACSC_AMF_ WEIGHT flag has been specified, this argument defines the
Weight weight of the control point.
Set this argument to ACSC_NONE if not used
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Supported from V3.12.
Example
}
acsc_EndSequenceM(controller, Axes, 0);
4.25.3 acsc_SmoothPathMotion
Description
Smooth path is a motion type that accepts line segments and generates a spline motion between
the specified points.
The motion deviates from exact coordinates after interpolation.
To control the deviation, the user can generate more points along the trajectory or use the Corner
specification.
Syntax
Arguments
Array of the final point coordinates. The number and order of values
Point must correspond to the Axes array. The Point must specify a value
for each element of Axes except the last –1 element.
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Supported from V3.12.
Example
4.25.4 acsc_SmoothPathSegment
Description
Smooth path is a motion type that accepts line segments and generates a spline motion between
the specified points.
The motion deviates from exact coordinates after interpolation.
To control the deviation, the user can generate more points along the trajectory or use the Corner
specification.
Syntax
Arguments
Bit-mapped argument that can include one or more of the following flags:
ACSC_AMF_WAIT: plan the motion but do not start it until the function acsc_
GoM is executed.
ACSC_AMF_VELOCITY: the motion will use velocity specified for each
segment instead of the default velocity.
ACSC_AMF_ENDVELOCITY: This flag requires additional parameter that
specifies end velocity.
The controller decelerates to the specified velocity in the end of segment.
The specified value should be less than the required velocity; otherwise the
parameter is ignored.
This flag affects only one segment.
This flag also disables corner detection and processing at the end of
segment.
If this flag is not specified, deceleration is not required. However, in special
cases the deceleration might occur due to corner processing or other
velocity control conditions.
ACSC_AMF_MAXIMUM: use maximum velocity under axis limits. With this
suffix, no required velocity should be specified.
The required velocity is calculated for each segment individually on the
Flags base of segment geometry and axis velocities (VEL values) of the involved
axes.
ACSC_AMF_JUNCTIONVELOCITY: Decelerate to corner.
This flag requires additional parameter that specifies corner velocity. The
controller detects corner on the path and decelerates to the specified
velocity before the corner. The specified value should be less than the
required velocity; otherwise the parameter is ignored.
If ACSC_AMF_JUNCTIONVELOCITY flag is not specified while ACSC_AMF_
ANGLE flag is specified, zero value of corner velocity is assumed.
If neither the ACSC_AMF_JUNCTIONVELOCITY nor the ACSC_ AMF_ANGLE
flags are specified, the controller provides automatic calculation as
described in Automatic corner processing.
ACSC_AMF_ANGLE: Do not treat junction as a corner, if junction angle is less
than or equal to the specified value in radians. This flag requires additional
parameter that specifies a negligible angle in radians.
If ACSC_AMF_ANGLE flag is not specified while ACSC_AMF_
JUNCTIONVELOCITY flag is specified, the controller accepts default value of
0.01 radians, about 0.57 degrees.
If neither the ACSC_AMF_JUNCTIONVELOCITY nor the ACSC_ AMF_ANGLE
flags are specified, the controller provides automatic calculation as
described in Automatic corner processing.
ACSC_AMF_AXISLIMIT
Enable velocity limitations under axis limits.
With this flag set, setting the ACSC_AMF_VELOCITY flag will result in the
requested velocity being restrained by the velocity limits of all involved
axes.
ACSC_AMF_CURVEVELOCITY
Decelerate to curvature discontinuity point.
This flag requires an additional parameter that specifies velocity at
curvature discontinuity points.
Curvature discontinuity occurs in linear-to-arc or arc-to-arc smooth
junctions.
If the flag is not set, the controller does not decelerate to smooth junction
disregarding curvature discontinuity in the junction.
If the flag is set, the controller detects curvature discontinuity points on the
path and provides deceleration to the specified velocity.
The specified value should be less than the required velocity; otherwise the
parameter is ignored.
The flag can be set together with flags ACSC_AMF_ JUNCTIONVELOCITY
and/or ACS_AMF_ANGLE.
If neither of ACSC_AMF_JUNCTIONVELOCITY, ACS_AMF_ ANGLE or ACSC_
AMF_CURVEVELOCITY is set, the controller provides automatic calculation of
the corner processing.
ACSC_AMF_CURVEAUTO
If the Flag is specified the controller provides automatic calculations as
described in Enhanced automatic corner and curvature discontinuity points
processing.
ACSC_AMF_CORNERDEVIATION
Use a corner rounding option with the specified permitted deviation. This
flag requires an additional parameter that specifies maximal allowed
deviation of motion trajectory
Array of axis constants. Each element specifies one involved axis: ACSC_
AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis,
Axes one additional element must be located that contains – 1 which marks the
end of the array.
For the axis constants see Axis Definitions.
Array of the final point coordinates. The number and order of values must
Point correspond to the Axes array. The Point must specify a value for each
element of Axes except the last –1 element.
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
Supported from V3.12.
Example
Function Description
Informs the controller that no more points will be specified for the
acsc_EndSequence
current single-axis motion.
4.26.1 acsc_AddPoint
Description
The function adds a point to a single-axis multi-point or spline motion.
Syntax
int acsc_AddPoint(HANDLE Handle, int Axis, double Point,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function adds a point to a single-axis multi-point or spline motion. To add a point to a multi-axis
motion, use acsc_AddPVPointM. To add a point with a specified non-default velocity or time interval
use acsc_AddPVPoint or acsc_AddPVPointM.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
function periodically until the function returns non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.26.2 acsc_AddPointM
Description
The function adds a point to a multi-axis multi-point or spline motion.
Syntax
int acsc_AddPointM(HANDLE Handle, int* Axes, double* Point,
ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions.
Array of the coordinates of added point. The number and order of values must
Point correspond to the Axes array. The Point must specify a value for each element
of Axes except the last –1 element.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function adds a point to a multi-axis multi-point or spline motion. To add a point to a single-axis
motion, use acsc_AddPoint. To add a point with a specified non-default velocity or time interval use
acsc_ExtAddPoint or acsc_ExtAddPointM.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
function periodically until the function returns non-zero value.
All axes specified in the Axes array must be specified before the call of the acsc_MultiPointM or
acsc_SplineM function. The number and order of the axes in the Axes array must correspond exactly
to the number and order of the axes of acsc_MultiPointM or acsc_SplineM functions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.26.3 acsc_ExtAddPoint
Description
The function adds a point to a single-axis multi-point or spline motion and specifies a specific
velocity or motion time.
Syntax
int acsc_ExtAddPoint(HANDLE Handle, int Axis, double Point, double Rate,
ACSC_WAITBLOCK* Wait)
Arguments
If the motion was activated by the acsc_MultiPoint function with the ACSC_
AMF_VELOCITY flag, this parameter defines the motion velocity.
Rate If the motion was activated by the acsc_Spline function with the ACSC_AMF_
VARTIME flag, this parameter defines the time interval between the previous
point and the present one.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function adds a point to a single-axis multi-point motion with specific velocity or to single-axis
spline motion with a non-uniform time.
To add a point to a multi-axis motion, use acsc_ExtAddPointM. To add a point to a motion with
default velocity or uniform time interval, the acsc_AddPoint and acsc_AddPointM functions are more
convenient.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
function periodically until the function returns a non-zero value.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.26.4 acsc_ExtAddPointM
Description
The function adds a point to a multi-axis multi-point or spline motion and specifies a specific velocity
or motion time.
Syntax
int acsc_ExtAddPointM(HANDLE Handle, int* Axes, double* Point, double Rate,
ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions.
Array of the coordinates of added point. The number and order of values must
Point correspond to the Axes array. The Point must specify a value for each element
of Axes except the last –1 element.
If the motion was activated by the acsc_MultiPoint function with the ACSC_
AMF_VELOCITY flag, this parameter defines as motion velocity.
Rate If the motion was activated by the acsc_Spline function with the ACSC_AMF_
VARTIME flag, this parameter defines as time interval between the previous
point and the present one.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function adds a point to a multi-axis multi-point or spline motion. To add a point to a single-axis
motion, use acsc_ExtAddPoint. To add a point to a motion with a default velocity or a uniform time
interval, the acsc_ExtAddPointM function is more convenient.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
The controller response indicates that the command was accepted and the point is added to the
motion buffer. The point can be rejected if the motion buffer is full. In this case, you can call this
function periodically until the function returns non-zero value.
All axes specified in the Axes array must be specified before the call of the acsc_MultiPointM or
acsc_SplineM function. The number and order of the axes in the Axes array must correspond exactly
to the number and order of the axes of acsc_MultiPointM or acsc_SplineM functions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.26.5 acsc_EndSequence
Description
The function informs the controller, that no more points will be specified for the current single-axis
motion.
Syntax
int acsc_EndSequence(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The motion finishes when the acsc_EndSequence function is executed. If the call of acsc_
EndSequence is omitted, the motion will stop at the last point of the sequence and wait for the next
point. No transition to the next motion in the motion queue will occur until the acsc_EndSequence
function executes.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
This function applies to the single-axis multi-point or spline (arbitrary path) motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.26.6 acsc_EndSequenceM
Description
The function informs the controller, that no more points or segments will be specified for the current
multi-axis motion.
Syntax
int acsc_EndSequence(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The motion finishes when the acsc_EndSequenceM function is executed. If the call of acsc_
EndSequenceM is omitted, the motion will stop at the last point or segment of the sequence and
wait for the next point. No transition to the next motion in the motion queue will occur until the
acsc_EndSequenceM function executes.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
This function applies to the multi-axis multi-point, spline (arbitrary path) and segmented motions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
4.27.1 acsc_DataCollectionExt
Description
The function initiates data collection.
Syntax
int acsc_DataCollectionExt(HANDLE Handle, int Flags, int Axis, char*
Array, int NSample,double Period, char* Vars, ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped parameter that can include one or more of the following flags:
ACSC_DCF_SYNC: Start data collection synchronously to a motion.
ACSC_DCF_WAIT: Create the synchronous data collection, but do not start until
the acsc_Go function is called. This flag can only be used with the ACSC_DCF_
SYNC flag.
Flags
ACSC_DCF_TEMPORAL: Temporal data collection, the sampling period is
calculated automatically according to the collection time.
ACSC_DCF_CYCLIC: Cyclic data collection uses the collection array as a cyclic
buffer and continues indefinitely. When the array is full, each new sample
overwrites the oldest sample in the array.
Axis constant of the axis to which the data collection must be synchronized.
Axis The parameter is required only for axis data collection (ACSC_DCF_SYNC flag).
For the axis constants see Axis Definitions
Pointer to the null-terminated string contained the name of the array that
stores the collected samples.
Array
The array must be declared as a global variable by an ACSPL+ program or by
the acsc_DeclareVariable function.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Data collection started by this function without the ACSC_DCF_SYNC flag is called system data
collection. Data collection started with the ACSC_DCF_SYNC flag is called axis data collection. Data
collection started with the ACSC_DCF_CYCLIC flag is called cyclic data collection. Unlike the standard
data collection that finishes when the collection array is full, cyclic data collection does not self-
terminate. Cyclic data collection uses the collection array as a cyclic buffer and can continue to collect
data indefinitely. When the array is full, each new sample overwrites the oldest sample in the array.
Cyclic data collection can only be terminated by calling acsc_StopCollect function.
The array that stores the samples can be one or two-dimensional. A one-dimensional array is
allowed only if the variable list contains one variable name.
The number of the array rows must be equal to or more than the number of variables in the variable
list. The number of the array columns must be equal to or more than the number of samples
specified by the NSample argument.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.27.2 acsc_StopCollect
Description
The function terminates data collection.
Syntax
int acsc_StopCollect(HANDLE Handle, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The usual system data collection finishes when the required number of samples is collected or the
acsc_StopCollect function is executed. The application can wait for data collection end with the
acsc_WaitCollectEndExt function.
The temporal data collection runs until the acsc_StopCollect function is executed.
The function terminates the data collection prematurely. The application can determine the number
of actually collected samples from the S_DCN variable and the actual sampling period from the S_
DCP variable.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.27.3 acsc_WaitCollectEndExt
Description
The function waits for the end of data collection.
Syntax
Int acsc_WaitCollectEndExt(HANDLE handle, int Timeout, int Axis)
Arguments
Return Value
If the function succeeds, a non-zero value is returned.
If the function fails, the return value is zero.
Comments
If using Axis data collection (data collection is synced to axis) set Axis to be the axis number you are
collecting data from, otherwise set Axis to be ACSC_NONE.
The function does not return while data collection is in progress and the correct parameters have
been passed.
Verifies AST<Axis#>.#DC flag for Synced data collection, otherwise verifies S_ST.#DC system flag.
Using the function with the wrong parameters (i.e. calling the function with an axis number while
performing a system data collection) will result in undefined behavior.
Example
4.27.4 acsc_SPDataCollectionStart
Description
acsc_SPDataCollectionStart(Servo Processor Data Collection) performs fast data collection and
accumulates data about the specified Servo Processor variable with a constant maximum sampling
rate of 20kHz. A typical use for acsc_SPDataCollectionStart is for collecting position error (PE) and
feedback position (FPOS) data at the fast Servo Processor rate.
The Servo Processor value is different from the MPU value. The Servo Processor always uses counts
and not units. The Servo Processor position value is not affected by a SET FPOS command. An offset
is added at the MPU level only. The formula (that you can find in our manuals) is:
FPOS = FP*EFAC + EOFFS
where FPOS is the MPU variable and FP is the Servo Processor calculated value.
SPDataCollection terminates due to:
> a call to acsc_SPDataCollectionStop
> After accumulating the defined number of samples
Syntax
int acsc_SPDataCollectionStart (HANDLE Handle, int Flags, const char *Array, int NSample, double
Period, int SP_Index, int SP_Address1 , int SP_Address2, int SP_Address3, int SP_Address4, ACSC_
WAITBLOCK* Wait)
Arguments
Since memory addresses may vary between SPiiPlus products and revisions, it is
highly recommended to define a variable to represent SP_Address<n> as the
return value of GetSPAddress. SPDataCollection can then use this variable in any
SPiiPlus product or revision .
(Optional)
As an option, you can add another address of
SP_Address2 another Servo
Processor variable in the Servo Processor to sample.
In this case,
the array should be defined as (2)(N)
(Optional)
As an option, you can add another address of
SP_Address3 another Servo
Processor variable in the Servo Processor to sample,
In this case,
the array should be defined as (3)(N).
(Optional)
As an option, you can add another address of
SP_Address4 another Servo
Processor variable in the Servo Processor to sample.
In this case,
the array should be defined as (4)(N)
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError
Comments
Only one SPDC command per Servo Processor can run at a given time.
Example
4.27.5 acsc_SPDataCollectionStop
Description
The acsc_SPDataCollectionStop function Immediately terminates the data collection of acsc_
SPDataCollectionStart(Servo processor data collection) for the specified servo processor.
Syntax
int acsc_SPDataCollectionStop (HANDLE Handle, int SP_Index, ACSC_WAITBLOCK* Wait)
Arguments
Wait If Wait is ACSC_IGNORE, the function returns immediately. In this case, the
operation result is ignored by the library and cannot be retrieved to the calling
thread.
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError
Example
if (!acsc_SPDataCollectionStop(Handle, 0, ACSC_SYNCHRONOUS))
{
printf("acsc_SPDataCollectionStop():Error Occurred -%d\n",
acsc_GetLastError());
return;
}
4.27.6 acsc_GetSPAddress
Description
GetSPAddress reads a value from the specified SP address.
Syntax
int acsc_ GetSPAddress (HANDLE Handle, int Flags, int SP_index, const char* SP_variable,
int* Address)
Arguments
Bit-mapped argument that can include one or more of the following flags:
ACSC_ETHERCAT_NETWORK_0 - first network specifier
ACSC_ETHERCAT_NETWORK_1 - second network specifier
Flags
ACSC_ETHERCAT_NETWORK_0 and ACSC_ETHERCAT_NETWORK_1 flags must
not be specified together
0, //No flags are set ( equivalent to flag ACSC_ETHERCAT_NETWORK_0)
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
4.27.7 acsc_WaitSPDataCollectionEnd
Description
The function waits for the end of Servo Processor data collection.
Syntax
int acsc_WaitSPDataCollectionEnd (HANDLE Handle, int Timeout, int SP_Index)
Arguments
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Comments
The function does not return while data collection is in progress and the correct parameters have
been passed.
Example
Function Description
acsc_GetIndexState Retrieves the current state of the index and mark variables.
4.28.1 acsc_GetMotorState
Description
The function retrieves the current motor state.
Syntax
int acsc_GetMotorState(HANDLE Handle, int Axis, int* State,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current motor state. The parameter can
include one or more of the following flags:
ACSC_MST_ENABLE — a motor is enabled
State
ACSC_MST_INPOS — a motor has reached a target position
ACSC_MST_MOVE — a motor is moving
ACSC_MST_ACC — a motor is accelerating
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current motor state.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
State and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.28.2 acsc_GetAxisState
Description
The function retrieves the current axis state.
Syntax
int acsc_GetAxisState(HANDLE Handle, int Axis, int* State,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current axis state. The parameter can
include one or more of the following flags:
ACSC_AST_LEAD – an axis is leading in a group
ACSC_AST_DC – an axis data collection is in progress
ACSC_AST_PEG – a PEG for the specified axis is in progress
ACSC_AST_MOVE – an axis is moving
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current axis state.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
State and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.28.3 acsc_GetIndexState
Description
The function retrieves the current set of bits that indicate the index and mark state.
Syntax
int acsc_GetIndexState(HANDLE Handle, int Axis, int* State,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current set of bits that indicate the index
and mark state. The parameter can include one or more of the following flags:
ACSC_IST_IND – a primary encoder index of the specified axis is latched
ACSC_IST_IND2 – a secondary encoder index of the specified axis is latched
State
ACSC_IST_MARK – a MARK1 signal has been generated and position of the
specified axis was latched
ACSC_IST_MARK2 – a MARK2 signal has been generated and position of the
specified axis was latched
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current set of bits that indicate the index and mark state.
The controller processes index/mark signals as follows:
When an index/mark signal is encountered for the first time, the controller latches feedback
positions and raises the corresponding bit. As long as a bit is raised, the controller does not latch
feedback position even if the signal occurs again. To resume latching logic, the application must call
the acsc_ResetIndexState function to explicitly reset the corresponding bit.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
State and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.28.4 acsc_ResetIndexState
Description
The function resets the specified bit of the index/mark state.
Syntax
int acsc_ResetIndexState(HANDLE Handle, int Axis, int Mask,
ACSC_WAITBLOCK* Wait)
Arguments
The parameter contains bit to be cleared. Only one of the following flags can be
specified:
Mask
ACSC_IST_IND – a primary encoder index of the specified axis is latched
ACSC_IST_IND2 – a secondary encoder index of the specified axis is latched
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function resets the specified bit of the index/mark state. The parameter Mask contains a bit,
which must be cleared, i.e. the function resets only that bit of the index/mark state, which
corresponds to non-zero bit of the parameter Mask. To get the current index/mark state, use acsc_
GetIndexState function.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.28.5 acsc_GetProgramState
Description
The function retrieves the current state of the program buffer.
Syntax
int acsc_GetProgramState(HANDLE Handle, int Buffer, int* State,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current state of the program buffer. The
parameter can include one or more of the following flags:
ACSC_PST_COMPILED – a program in the specified buffer is compiled
ACSC_PST_RUN – a program in the specified buffer is running
State ACSC_PST_AUTO – an auto routine in the specified buffer is running
ACSC_PST_DEBUG – a program in the specified buffer is executed in debug
mode, i.e. breakpoints are active
ACSC_PST_SUSPEND – a program in the specified buffer is suspended after the
step execution or due to breakpoint in debug mode
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the program buffer.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
State and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
acsc_GetInputPort Retrieves the current state of the specified digital input port.
acsc_GetInputPort Retrieves the current state of the specified digital input port.
acsc_GetOutputPort Retrieves the current state of the specified digital output port.
acsc_SetOutputPort Sets the specified digital output port to the specified value.
acsc_GetExtInputPort Retrieves the current state of the specified extended input port.
acsc_GetExtOutputPort Retrieves the current state of the specified extended output port.
acsc_SetExtOutputPort Sets the specified extended output port to the specified value.
4.29.1 acsc_GetInput
Description
The function retrieves the current state of the specified digital input.
Syntax
int acsc_GetInput(HANDLE Handle, int Port, int Bit, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current state of the specific input. The
Value
value will be populated by 0 or 1.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified digital input. To get values of all inputs of the
specific port, use the acsc_GetInputPort function.
Digital inputs are represented in the controller variable IN. For more information about digital inputs,
see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.29.2 acsc_GetInputPort
Description
The function retrieves the current state of the specified digital input port.
Syntax
int acsc_GetInputPort(HANDLE Handle, int Port, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Value Pointer to a variable that receives the current state of the specific input port.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified digital input port. To get the value of the
specific input of the specific port, use the acsc_GetInput function.
Digital inputs are represented in the controller variable IN. For more information about digital inputs,
see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.3 acsc_GetOutput
Description
The function retrieves the current state of the specified digital output.
Syntax
int acsc_GetOutput(HANDLE Handle, int Port, int Bit, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current state of the specific output. The
Value
value will be populated by 0 or 1.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified digital output. To get values of all outputs of
the specific port, use the acsc_GetOutputPort function.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.4 acsc_GetOutputPort
Description
The function retrieves the current state of the specified digital output port.
Syntax
int acsc_GetOutputPort(HANDLE Handle, int Port, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current state of the specific output. The
Value
value will be populated by 0 or 1.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified digital output port. To get the value of the
specific output of the specific port, use the acsc_GetOutput function.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.5 acsc_SetOutput
Description
The function sets the specified digital output to the specified value.
Syntax
int acsc_SetOutput(HANDLE Handle, int Port, int Bit, int Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets the specified digital output to the specified value. To set values of all outputs of a
specific port, use the acsc_SetExtOutputPort function.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
0, // bit 0
1, // value to be set
NULL // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.29.6 acsc_SetOutputPort
Description
The function sets the specified digital output port to the specified value.
Syntax
int acsc_SetOutputPort(HANDLE Handle, int Port, int Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets the specified digital output port to the specified value. To set the value of the
specific output of the specific port, use the acsc_SetOutput function.
Digital outputs are represented in the controller variable OUT. For more information about digital
outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.29.7 acsc_GetAnalogInputNT
Description
The function retrieves the current value of the specified analog input signal from an external source
such as a sensor or a potentiometer.
Syntax
int _ACSCLIB_ WINAPI acsc_GetAnalogInputNT(HANDLE Handle, int Port, double* Value, ACSC_
WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives current value of the specified analog input as
Value
a percentage (range is -100% to 100%) of the maximum level.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current value of the specified analog input signal from an external source
such as a sensor or a potentiometer.
Analog inputs are represented in the controller variable AIN. For more information about analog
inputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.8 acsc_GetAnalogOutputNT
Description
The function retrieves the current value of the specified analog output signal that is sent to an
external device such as a sensor or a potentiometer.
Syntax
int _ACSCLIB_ WINAPI acsc_GetAnalogOutputNT(HANDLE Handle, int Port, double* Value, ACSC_
WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives current value of the specified analog output
Value
as a percentage (range is -100% to 100%) of the maximum level.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current value of the specified analog output signal that is sent to an
external device such as a sensor or a potentiometer. To write a value to the specific analog output,
use the acsc_SetAnalogOutputNT function.
Analog outputs are represented in the controller variable AOUT. For more information about analog
outputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.9 acsc_SetAnalogOutputNT
Description
The function writes the specified value to the specified analog output signal that is sent to an
external device such as a sensor or a potentiometer.
Syntax
int _ACSCLIB_ WINAPI acsc_SetAnalogOutputNT(HANDLE Handle, int Port, double Value, ACSC_
WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function writes the specified value to the specified analog output signal that is sent to an
external device such as a sensor or a potentiometer. To get a value of the specific analog output,
use the acsc_GetAnalogOutputNT function.
Analog outputs are represented in the controller variable AOUT. For more information about analog
outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.10 acsc_GetExtInput
Description
The function retrieves the current state of the specified extended input.
Syntax
int acsc_GetExtInput(HANDLE Handle, int Port, int Bit, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current state of the specific input. The
Value
value will be populated by 0 or 1.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified extended input. To get values of all inputs of
the specific extended port, use the acsc_GetExtInputPort function.
Extended inputs are represented in the controller variable EXTIN. For more information about
extended inputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.11 acsc_GetExtInputPort
Description
The function retrieves the current state of the specified extended input port.
Syntax
int acsc_GetExtInputPort(HANDLE Handle, int Port, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Value Pointer to a variable that receives the current state of the specific input port.
Return Value
If the function succeeds, the return value is non-zero. If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified extended input port. To get the value of the
specific input of the specific extended port, use the acsc_GetExtInput function.
Extended inputs are represented in the controller variable EXTIN. For more information about
extended inputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.12 acsc_GetExtOutput
Description
The function retrieves the current state of the specified extended output.
Syntax
int acsc_GetExtOutput(HANDLE Handle, int Port, int Bit, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current state of the specific output. The
Value
value will be populated by 0 or 1.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified extended output. To get values of all
outputs of the specific extended port, use the acsc_GetExtOutputPort function.
Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.29.13 acsc_GetExtOutputPort
Description
The function retrieves the current state of the specified extended output port.
Syntax
int acsc_GetExtOutputPort(HANDLE Handle, int Port, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current state of the specific output. The
Value
value will be populated by 0 or 1.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified extended output port. To get the value of
the specific output of the specific extended port, use the acsc_GetExtOutputPort function.
Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.29.14 acsc_SetExtOutput
Description
The function sets the specified extended output to the specified value.
Syntax
int acsc_SetExtOutput(HANDLE Handle, int Port, int Bit, int Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets the specified extended output to the specified value. To set values of all outputs of
the specific extended port, use the acsc_SetExtOutputPort function.
Extended outputs are represented in the controller EXTOUT variable. For more information about
extended outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.29.15 acsc_SetExtOutputPort
Description
The function sets the specified extended output port to the specified value.
Syntax
int acsc_SetExtOutputPort(HANDLE Handle, int Port, int Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets the specified extended output port to the specified value. To set the value of the
specific output of the specific extended port, use the acsc_SetExtOutput function.
Extended outputs are represented in the controller variable EXTOUT. For more information about
extended outputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
Sets the mask that defines for which motor or system faults the
acsc_SetResponseMask
controller provides default response.
Function Description
acsc_GetSafetyInputPort Retrieves the current state of the specified safety input port.
acsc_ Retrieves the set of bits that define inversion for the specified
GetSafetyInputPortInv safety input port.
acsc_ Sets the set of bits that define inversion for the specified safety
SetSafetyInputPortInv input port.
4.30.1 acsc_GetFault
Description
The function retrieves the set of bits that indicate the motor or system faults.
Syntax
int acsc_GetFault(HANDLE Handle, int Axis, int* Fault, ACSC_WAITBLOCK* Wait)
Arguments
Fault Pointer to the variable that receives the current set of fault bits.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the set of bits that indicate motor or system faults.
Motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, or Driver Alarm.
System faults are not related to any specific motor. For example: Emergency Stop or Memory Fault.
The parameter Fault receives the set of bits that indicates the controller faults. To recognize the
specific fault, constants ACSC_SAFETY_*** can be used. See Safety Control Masks for a detailed
description of these constants.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Fault and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.30.2 acsc_SetFaultMask
Description
The function sets the mask that enables or disables the examination and processing of controller
faults.
Syntax
int acsc_SetFaultMask(HANDLE Handle, int Axis, int Mask,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets the mask that enables/disables the examination and processing of the controller
faults. The two types of controller faults are motor faults and system faults.
The motor faults are related to a specific motor, the power amplifier or the Servo processor. For
example: Position Error, Encoder Error or Driver Alarm.
The system faults are not related to any specific motor. For example: Emergency Stop or Memory
Fault.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.30.3 acsc_GetFaultMask
Description
The function retrieves the mask that defines which controller faults are examined and processed.
Syntax
int acsc_GetFaultMask(HANDLE Handle, int Axis, int* Mask,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the mask, defining which controller faults are examined and processed. If a bit
of the parameter Mask is zero, the corresponding fault is disabled.
The controller faults are of two types: motor faults and system faults.
The motor faults are related to a specific motor, the power amplifier or the Servo processor. For
example: Position Error, Encoder Error or Driver Alarm.
The system faults are not related to any specific motor, for example: Emergency Stop or Memory
Fault.
For more information about the controller faults, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Mask and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.30.4 acsc_EnableFault
Description
The function enables the specified motor or system fault.
Syntax
int acsc_EnableFault(HANDLE Handle, int Axis, int Fault,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function enables the examination and processing of the specified motor or system fault by
setting the specified bit of the fault mask to one.
The motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, and Driver Alarm.
The system faults are not related to any specific motor. For example: Emergency Stop, Memory
Fault.
For more information about the controller faults, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.30.5 acsc_DisableFault
Description
The function disables the specified motor or system fault.
Syntax
int acsc_DisableFault(HANDLE Handle, int Axis, int Fault,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function disables the examination and processing of the specified motor or system fault by
setting the specified bit of the fault mask to zero.
The motor faults are related to a specific motor, the power amplifier, and the Servo processor. For
example: Position Error, Encoder Error, and Driver Alarm.
The system faults are not related to any specific motor, for example: Emergency Stop, Memory Fault.
For more information about the controller faults, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.30.6 acsc_SetResponseMask
Description
The function retrieves the mask that defines the motor or the system faults for which the controller
provides the default response.
Syntax
int acsc_SetResponseMask(HANDLE Handle, int Axis, int Mask,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the mask that defines the motor or the system faults for which the controller
provides the default response.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see the SPiiPlus ACSPL+
Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.30.7 acsc_GetResponseMask
Description
The function retrieves the mask that defines the motor or the system faults for which the controller
provides the default response.
Syntax
int acsc_GetResponseMask(HANDLE Handle, int Axis, int* Mask,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the mask that defines the motor or the system faults for which the controller
provides the default response. If a bit of the parameter Mask is zero, the controller does not provide
a default response to the corresponding fault.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default, responses see the SPiiPlus ACSPL+
Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Mask and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.30.8 acsc_EnableResponse
Description
The function enables the response to the specified motor or system fault.
Syntax
int acsc_EnableResponse(HANDLE Handle, int Axis, int Response,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function enables the default response to the specified motor or system fault by setting the
specified bit of the response mask to one.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see SPiiPlus ACSPL+ Programmer’s
Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.30.9 acsc_DisableResponse
Description
The function disables the default response to the specified motor or system fault.
Syntax
int acsc_DisableResponse(HANDLE Handle, int Axis, int Response,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function disables the default response to the specified motor or system fault by setting the
specified bit of the response mask to zero.
The default response is a controller-predefined action for the corresponding fault. For more
information about the controller faults and default responses, see SPiiPlus ACSPL+ Programmer’s
Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.30.10 acsc_GetSafetyInput
Description
The function retrieves the current state of the specified safety input.
Syntax
int acsc_GetSafetyInput(HANDLE Handle, int Axis, int Input, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Input ACSC_SAFETY_RL2
ACSC_SAFETY_LL2
ACSC_SAFETY_HOT
ACSC_SAFETY_DRIVE
ACSC_SAFETY_ES
See Safety Control Masks for a detailed description of these constants.
Pointer to a variable that receives the current state of the specified inputs. The
Value value will be populated by 0 or 1. The value will receive 1 if any of the specified
safety inputs in the Input field is on. Otherwise, it receives 0.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified safety input. To get values of all safety
inputs of the specific axis, use the acsc_GetSafetyInput function.
Safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more information
about safety inputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Some safety inputs can be unavailable in a specific controller model. For example,
SPiiPlus SA controller does not provide Motor Overheat, Preliminary Left Limit, and
Preliminary Right Limit safety inputs.
See specific model documentation for details.
Example
4.30.11 acsc_GetSafetyInputPort
Description
The function retrieves the current state of the specified safety input port.
Syntax
int acsc_GetSafetyInputPort(HANDLE Handle, int Axis, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the current state of the specific safety input
port.
To recognize a specific motor safety input, only one of the following constants
can be used:
ΑCSC_SAFETY_RL
ACSC_SAFETY_LL
Value ACSC_SAFETY_RL2
ACSC_SAFETY_LL2
ACSC_SAFETY_HOT
ACSC_SAFETY_DRIVE
To recognize a specific system safety input, only ACSC_SAFETY_ES constant can
be used.
See Safety Control Masks for a detailed description of these constants.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the current state of the specified safety input port. To get the state of the
specific safety input of a specific axis, use the acsc_GetSafetyInput function.
Safety inputs are represented in the controller variables SAFIN and S_SAFIN. For more information
about safety inputs, see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Some safety inputs can be unavailable in a specific controller model. For example,
SPiiPlus SA controller does not provide Motor Overheat, Preliminary Left Limit, and
Preliminary Right Limit safety inputs.
See specific model documentation for details.
Example
4.30.12 acsc_GetSafetyInputPortInv
Description
The function retrieves the set of bits that define inversion for the specified safety input port.
Syntax
int acsc_GetSafetyInputPortInv(HANDLE Handle, int Axis, int* Value,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the set of bits that define inversion for the
specific safety input port.
To recognize a specific bit, use the following constants:
ACSC_SAFETY_RL
ACSC_SAFETY_LL
ACSC_SAFETY_RL2
Value
ACSC_SAFETY_LL2
ACSC_SAFETY_HOT
ACSC_SAFETY_DRIVE
Use the ACSC_SAFETY_ES constant to recognize an inversion for the specific
system safety input port,.
See Safety Control Masks for a detailed description of these constants.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the set of bits that define inversion for the specified safety input port. To set
the specific inversion for the specific safety input port, use the acsc_GetSafetyInputPortInv function.
If a bit of the retrieved set is zero, the corresponding signal is not inverted and therefore high
voltage is considered an active state. If a bit is raised, the signal is inverted and low voltage is
considered an active state.
The inversions of safety inputs are represented in the controller variables SAFINI and S_SAFINI. For
more information about safety inputs, see the SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Value and Wait items until a call to the acsc_WaitForAsyncCall function.
Some safety inputs can be unavailable in a specific controller model. For example,
SPiiPlus SA controller does not provide Motor Overheat, Preliminary Left Limit, and
Preliminary Right Limit safety inputs.
See specific model documentation for details.
Example
4.30.13 acsc_SetSafetyInputPortInv
Description
The function sets the set of bits that define inversion for the specified safety input port.
Syntax
int acsc_SetSafetyInputPortInv(HANDLE Handle, int Axis, int Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets the bits that define inversion for the specified safety input port. To retrieve an
inversion for the specific safety input port, use the acsc_GetSafetyInputPortInv function.
If a bit of the set is zero, the corresponding signal will not be inverted and therefore high voltage is
considered an active state. If a bit is raised, the signal will be inverted and low voltage is considered
an active state.
The inversions of safety inputs are represented in the controller variables SAFINI and S_SAFINI. For
more information about safety, inputs see SPiiPlus ACSPL+ Programmer’s Guide.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Some safety inputs can be unavailable in a specific controller model. For example,
SPiiPlus SA controller does not provide Motor Overheat, Preliminary Left Limit, and
Preliminary Right Limit safety inputs.
See specific model documentation for details.
Example
4.30.14 acsc_FaultClear
Description
The function clears the current faults and the result of the previous fault stored in the
MERR variable.
Syntax
int acsc_FaultClear(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function clears the current faults of the specified axis and the result of the previous fault stored
in the MERR variable.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.30.15 acsc_FaultClearM
Description
The function clears the current faults and results of previous faults stored in the MERR variable for
multiple axes.
Syntax
int acsc_FaultClearM(HANDLE Handle, int *Axes, ACSC_WAITBLOCK* Wait)
Arguments
Array of axis constants. Each element specifies one involved axis: ACSC_AXIS_0
corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. After the last axis, one
Axes additional element must be located that contains –1 which marks the end of
the array.
For the axis constants see Axis Definitions.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
If the reason for the fault is still active, the controller will set the fault immediately after this
command is performed. If cleared fault is Encoder Error, the feedback position is reset to zero.
Example
Function Description
Function Description
acsc_WaitInput Waits for the specified state of the specified digital input.
4.31.1 acsc_WaitMotionEnd
Description
The function waits for the end of a motion.
Syntax
int acsc_WaitMotionEnd (HANDLE Handle, int Axis, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function does not return while the specified axis is involved in a motion, the motor has not
settled in the final position and the specified time-out interval has not elapsed.
The function differs from the acsc_WaitLogicalMotionEnd function. Examining the same motion, the
acsc_WaitMotionEnd function will return latter. The acsc_WaitLogicalMotionEnd function returns
when the generation of the motion finishes. On the other hand, the acsc_WaitMotionEnd function
returns when the generation of the motion finishes and the motor has settled in the final position.
Example
4.31.2 acsc_WaitLogicalMotionEnd
Description
The function waits for the logical end of a motion.
Syntax
int acsc_WaitLogicalMotionEnd (HANDLE Handle, int Axis, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function does not return while the specified axis is involved in a motion and the specified time-
out interval has not elapsed.
The function differs from the acsc_WaitMotionEnd function. Examining the same motion, the acsc_
WaitMotionEnd function will return later. The acsc_WaitLogicalMotionEnd function returns when
the generation of the motion finishes. On the other hand, the acsc_WaitMotionEnd function returns
when the generation of the motion finishes and the motor has settled in the final position.
Example
4.31.3 acsc_WaitForAsyncCall
Description
The function waits for completion of asynchronous call and retrieves a data.
Syntax
int acsc_WaitForAsyncCall(HANDLE Handle, void* Buf, int* Received,
ACSC_WAITBLOCK* Wait, int Timeout)
Arguments
Pointer to the buffer that receives controller response. This parameter must
be the same pointer that was specified for asynchronous call of SPiiPlus C
Buf
function. If the SPiiPlus C function does not accept a buffer as a parameter,
Buf has to be NULL pointer.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. The Ret field of Wait contains the error code that the
non-waiting call caused. If Wait.Ret is zero, the call succeeded: no errors occurred.
Comments
The function waits for completion of asynchronous call, corresponds to the Wait parameter, and
retrieves controller response to the buffer pointed by Buf. The Wait and Buf must be the same
pointers passed to SPiiPlus C function when asynchronous call was initiated.
If the call of SPiiPlus C function was successful, the function retrieves controller response to the
buffer Buf. The Received parameter will contain the number of actually received characters.
If the call of SPiiPlus C function does not return a response (for example: acsc_Enable, acsc_Jog, etc.)
Buf has to be NULL.
If the call of SPiiPlus C function returned the error, the function retrieves this error code in the Ret
member of the Wait parameter.
If the SPiiPlus C function has not been completed in Timeout milliseconds, the function aborts
specified asynchronous call and returns ACSC_TIMEOUT error.
If the call of SPiiPlus C function has been aborted by the acsc_CancelOperationfunction, the function
returns ACSC_OPERATIONABORTED error.
Example
4.31.4 acsc_WaitProgramEnd
Description
The function waits for the program termination in the specified buffer.
Syntax
int acsc_WaitProgramEnd (HANDLE Handle, int Buffer, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function does not return while the ACSPL+ program in the specified buffer is in progress and the
specified time-out interval has not elapsed.
Example
4.31.5 acsc_WaitMotorEnabled
Description
The function waits for the specified state of the specified motor.
Syntax
int acsc_WaitMotorEnabled (HANDLE Handle, int Axis, int State, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function does not return while the specified motor is not in the desired state and the specified
time-out interval has not elapsed. The function examines the MST.#ENABLED motor flag.
Example
4.31.6 acsc_WaitInput
Description
The function waits for the specified state of digital input.
Syntax
int acsc_WaitInput (HANDLE Handle, int Port, int Bit, int State, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The basic configuration of the SPiiPlus PCI model provides only 16 inputs. Therefore, the Port must be
0, and the Bit can be specified from 0 to 15.
Example
4.31.7 acsc_WaitUserCondition
Description
The function waits for the user-defined condition.
Syntax
int acsc_WaitUserCondition(HANDLE Handle,
ACSC_USER_CONDITION_FUNC UserCondition, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero. If the function fails, the return value is zero.
Comments
The function calls the UserCondition function in order to determine the termination moment.
While the UserCondition function returns zero and the specified time-out interval has not elapsed,
the acsc_WaitUserCondition function calls UserCondition periodically. Once the UserCondition
function returns non-zero results, the acsc_WaitUserCondition function also returns.
The UserCondition function accepts as argument the Handle parameter, passed to the function
acsc_WaitUserCondition.
If the condition is satisfied, the UserCondition function returns 1, if it is not satisfied – 0. In case of an
error the UserCondition function returns –1.
Example
4.31.8 acsc_WaitMotorCommutated
Description
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function does not return while the specified motor is not in the desired state and the specified
time-out interval has not elapsed. The function examines the MFLAGS.#BRUSHOK flag.
Example
Function Description
acsc_
Sets the mask for the specified interrupt, extended to 128 axes.
SetCallbackMaskExt
4.32.1 acsc_InstallCallback
Description
The function installs a user-defined callback function for the specified interrupt condition with user-
defined parameter.
Syntax
int acsc_InstallCallback(HANDLE Handle,
ACSC_USER_CALLBACK_FUNCTION Callback, void* UserParameter,
int Interrupt)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function installs a user-defined callback function Callback for the specified interrupts condition
Interrupt.
The library calls the Callback function when the specified interrupt occurs. The bit-mapped
parameter Param of the function Callback identifies for which axis/buffer/input the interrupt was
generated. See Callback Interrupt Masks for a detailed description of the parameter Param for each
interrupt.
One callback can be installed for each interrupt, for same communication channel. The library creates
a separate thread for each interrupt. Therefore, each callback function is called in a separate thread
so that the callbacks do not delay one another.
User on Callback registration defines the parameter UserParameter. It is especially useful when
several SPiiPlus cards are used. That allows setting the same function as a Callback on certain
interrupt, for all the cards. Inside that function user can see by the UserParameter, which card
caused the interrupt.
To uninstall a specific callback, call the function acsc_InstallCallback with the parameter Callback
equals to NULL and the parameter Interrupt equals the specified interrupt type. This action will
uninstall the callback for specified communication channel.
Example
4.32.2 acsc_InstallCallbackExt
Description
The function installs a user-defined callback function for the specified interrupt condition with user-
defined parameter, with extension to 128 axes.
Syntax
int acsc_InstallCallBackExt (HANDLE Handle, ACSC_USER_CALLBACK_FUNCTION_EXT Callback, void*
UserParameter, int Interrupt)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
This function extends the functionality of acsc_InstallCallback work with up to 128 axes.
Extended error information can be obtained by calling acsc_GetLastError.
Example
if (Param.AXMASK64 & 1)
printf("Callback_MotionStart128(): Callback
recieved. Axis Index = %d\n",i);
}
for (i = 0; Param.AXMASK128; i++, Param.AXMASK128 >>= 1)
{
if (Param.AXMASK128 & 1)
printf("Callback_MotionStart128(): Callback recieved. Axis Index
%d\n", i+64);
}
return 0;
}
4.32.3 acsc_SetCallbackMask
Description
The function sets the mask for specified callback.
Syntax
int acsc_SetCallbackMask(HANDLE Handle, int Interrupt, unsigned __int64 Mask)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function sets the bit mask for specified interrupt. To get current mask for specified interrupt, call
acsc_GetCallbackMask.
Using a mask, you can reduce the number of calls of your callback function. The callback will be
called only if the interrupt is caused by an axis/buffer/input that corresponds to non-zero bit in the
related mask.
Example
// the example shows how to configure the interrupt mask to monitor only
// specific axis
if (!acsc_SetCallbackMask(Handle, // communication handle
ACSC_INTR_PHYSICAL_MOTION_END, // specified
interrupt
ACSC_MASK_AXIS_0 // enable interrupt only for
the axis 0 ))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.32.4 acsc_SetCallbackMaskExt
Description
The function sets the mask for the specified callback, up to 128 axes.
Syntax
int acsc_SetCallbackMaskExt (HANDLE Handle, int interrupt, AXMASK_EXT Mask)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Extended error information can be obtained by calling acsc_GetLastError
The function sets the bit mask for specified interrupt. To get current mask for specified interrupt, call
acsc_GetCallbackMaskExt.
Example
//the example below shows how to configure the interrupt mask for monitor
axes 64..127
AXMASK_EXT Mask;
Mask.AXMASK64 = 0;
Mask.AXMASK128 = ACSC_NONE; //axes 64..127
4.32.5 acsc_GetCallbackMask
Description
The function retrieves the mask for specified interrupt.
Syntax
int acsc_GetCallbackMask(HANDLE Handle, int Interrupt, unsigned __int64 *Mask)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the bit mask for specified interrupt. To set the mask for specified interrupt,
use acsc_SetCallbackMask.
Example
// the example shows how to get the mask for specific interrupt
unsigned __int64 Mask;
if (!acsc_GetCallbackMask( Handle, // communication handle
ACSC_INTR_PHYSICAL_MOTION_END, // specified interrupt
&Mask // received value
))
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.32.6 acsc_GetCallbackMaskExt
Description
The function retrieves the mask for specified interrupt, up to 128 axes.
Syntax
int acsc_GetCallbackMaskExt (HANDLE Handle, int interrupt, AXMASK_EXT* Mask)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the bit mask for specified interrupt. To set current mask for specified interrupt,
call acsc_SetCallbackMaskExt.
Extended error information can be obtained by calling acsc_GetLastError
Example
//the example below shows how to get the mask for specific interrupt
AXMASK_EXT Mask;
Mask.AXMASK64 = 0;
Mask.AXMASK128 = 0;
if(!acsc_GetCallbackMaskExt(Handle, //communication handle
ACSC_INTR_MOTION_START, //specified interrupt
&Mask, //received value for
))
{
printf(“transaction error: %d\n”, acsc_GetLastError());
}
4.32.7 acsc_SetCallbackPriority
Description
The function sets the priority for all callback threads.
Syntax
int acsc_SetCallbackPriority(HANDLE Handle, int Priority)
Arguments
Specifies the priority value for the callback thread. This parameter can be one of
the operating system defined priority levels.
For example the Win32 API defines the following priorities:
THREAD_PRIORITY_ABOVE_NORMAL
THREAD_PRIORITY_BELOW_NORMAL
Priority THREAD_PRIORITY_HIGHEST
THREAD_PRIORITY_IDLE
THREAD_PRIORITY_LOWEST
THREAD_PRIORITY_NORMAL
THREAD_PRIORITY_TIME_CRITICAL
As default, all callback threads have a normal priority.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The operating system uses the priority level of all executable threads to determine which thread
gets the next slice of CPU time. Basically, threads are scheduled in a round-robin fashion at each
priority level, and only when there are no executable threads at a higher level does scheduling of
threads at a lower level take place.
When manipulating priorities, be very careful to ensure that a high-priority thread does not
consume all of the available CPU time. See the relevant operating system guides for details.
Example
Function Description
4.33.1 acsc_DeclareVariable
Description
The function creates the persistent global variable.
Syntax
int acsc_DeclareVariable (HANDLE Handle, int Type, char* Name,
ACSC_WAITBLOCK* Wait)
Arguments
Name Pointer to the null-terminated ASCII string contained name of the variable.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function creates the persistent global variable specified by the parameter Name of type
specified by the parameter Type. The variable can be used as any other standard or global variable.
If it is necessary to declare one or two-dimensional array, the parameter Name should also contains
the dimensional size in brackets.
The lifetime of a persistent global variable is not connected with any program buffer. The persistent
variable survives any change in the program buffers and can be erased only by the acsc_
ClearVariables function.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
4.33.2 acsc_ClearVariables
Description
The function deletes all persistent global variables.
Syntax
int acsc_ClearVariables (HANDLE Handle, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function deletes all persistent global variables created by the acsc_DeclareVariable function.
The function can wait for the controller response or can return immediately as specified by the Wait
argument.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Example
Function Description
acsc_
Retrieves the firmware version of the controller.
GetFirmwareVersion
acsc_GetAxesCount The function returns the number of axes defined in the system.
4.34.1 acsc_GetFirmwareVersion
Description
The function retrieves the firmware version of the controller.
Syntax
int acsc_GetFirmwareVersion(HANDLE Handle, char* Version, int Count,
int* Received, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the character string that contains the firmware version of the controller. The
function will not copy more than Count characters to the Version buffer. If the buffer is too small, the
firmware version can be truncated.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Version, Received, and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.34.2 acsc_GetSerialNumber
Description
The function retrieves the controller serial number.
Syntax
int acsc_GetSerialNumber(HANDLE Handle, char* SerialNumber, int Count,
int* Received, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the character string that contains the controller serial number. The function
will not copy more than Count characters to the SerialNumber buffer. If the buffer is too small, the
serial number can be truncated.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
SerialNumber, Received and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.34.3 acsc_GetBuffersCount
Description
The function returns the number of available ACSPL+ programming buffers.
Syntax
int acsc_GetBuffersCount(HANDLE Handle, double *Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
double Value = 0;
if (!acsc_GetBuffersCount(Handle, &Value, NULL))
{
4.34.4 acsc_GetAxesCount
Description
The function returns the number of available axes.
Syntax
int acsc_GetAxesCount(HANDLE Handle, double *Value, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
double Value = 0;
if (!acsc_GetAxesCount(Handle, &Value, NULL))
{
printf("acsc_GetAxesCount(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.34.5 acsc_GetDBufferIndex
Description
The function returns the index of the D-Buffer.
Syntax
int acsc_GetDBufferIndex(HANDLE Handle, double *Value,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
double Value = 0;
if (!acsc_GetDBufferIndex(Handle, &Value, NULL))
{
printf("acsc_GetDBufferIndex(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.34.6 acsc_GetUMDVersion
Description
The function retrieves the SPiiPlus User Mode Driver version number.
Syntax
unsigned int acsc_GetUMDVersion()
Arguments
This function has no arguments.
Return Value
The return value is the 32-bit unsigned integer value, which specifies the binary version number.
Comments
The SPiiPlus User Mode Driver version consists of four (or fewer) numbers separated by points:
#.#.#.#. The binary version number is represented by 32-bit unsigned integer value. Each byte of this
value specifies one number in the following order: high byte of high word – first number, low byte of
high word – second number, high byte of low word – third number and low byte of low word – forth
number. For example version “2.10” has the following binary representation (hexadecimal format):
0x020A0000.
First two numbers in the string form are obligatory. Any release version of the library consists of two
numbers. The third and fourth numbers specify an alpha or beta version, special or private build, or
other version.
Example
Function Description
acsc_ Retrieves the error code of the last program error encountered in the
GetProgramError specified buffer.
acsc_
Used to retrieve the last EtherCAT error.
GetEtherCATError
4.35.1 acsc_GetMotorError
Description
The function retrieves the reason for motor disabling.
Syntax
int acsc_GetMotorError(HANDLE Handle, int Axis, int* Error,
ACSC_WAITBLOCK* Wait)
Arguments
Error Pointer to a variable that receives the reason why the motor was disabled.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the reason for motor disabling.
If the motor is enabled the parameter, Error is zero. If the motor was disabled, the parameter Error
contains the reason for motor disabling.
See SPiiPlus ACSPL+ Programmer’s Guide for all available motor error code descriptions.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Error and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
4.35.2 acsc_GetProgramError
Description
The function retrieves the error code of the last program error encountered in the specified buffer.
Syntax
int acsc_GetProgramError(HANDLE Handle, int Buffer, int* Error,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function retrieves the error code of the last program error encountered in the specified buffer.
If the program is running, the parameter Error is zero. If the program terminates for any reason, the
parameter Error contains the termination code.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Error and Wait items until a call to the acsc_WaitForAsyncCall function.
Example
{
if (Error > 0)
{
if (acsc_GetErrorString( Handle, Error, ErrorStr, 255,
&Received))
{
ErrorStr[Received] = '\0';
printf("Program error: %d (%s)\n", Error, ErrorStr);
}
}
}
else
{
printf("transaction error: %d\n", acsc_GetLastError());
}
4.35.3 acsc_GetEtherCATError
Description
The function is used to retrieve the last EtherCAT error.
Syntax
int acsc_GetEtherCATError(HANDLE Handle, int* Error,
ACSC_WAITBLOCK* Wait)
Arguments
Pointer to a variable that receives the last EtherCAT error that has occurred (see
Error
Comments).
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Any EtherCAT error sets ECST.#OP to false and the error code is latched in the ECERR variable.The
EtherCAT errors are given in Table 5-33.
Table 5-33. EtherCAT Errors
Error
Error Message Remarks
Code
EtherCAT cable
6001 Check that the EtherCAT connections are firmly seated.
not connected
EtherCAT master On start up all slaves did not succeed to initialize to full OP
6002 is in incorrect state. Can be caused by wrong configuration or a problem
state in a Slave
Not all EtherCAT The Master has detected that at least one frame that was
6003 frames can be sent has not returned. This implies a hardware problem in
processed the cables or Slaves.
EtherCAT
The EtherCAT-related hardware in the Master could not
6005 initialization
be initialized. Check the EtherCAT hardware.
failure
EtherCAT cannot
The bus scan could not be completed. This implies
6006 complete the
hardware level problems in the EtherCAT network.
operation
The Master has detected that the Slave does not behave
EtherCAT as expected for too long, and reports timeout. Implies a
6009
protocol timeout Slave hardware problem. Try power down, and system
restart.
Error
Error Message Remarks
Code
Bus configuration
6011 The bus topology differs from that in configuration file.
mismatch
EtherCAT Slave
Hardware fault, for example DHD with broken (logic)
6013 won't enter INIT
supply.
state
Example
int Value = 0;
if (!acsc_GetEtherCATError(Handle, &Value, NULL))
{
printf("acsc_GetEtherCATError(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
Function Description
4.36.1 acsc_ReadDPRAMInteger
Description
The function reads 32-bit integer from the DPRAM.
Syntax
acsc_ReadDPRAMInteger(HANDLE Handle, int address,int *Value)
Arguments
Address Address has to be even number from 128 to 1020 (DRAM size is 1024)
Return Value
The function returns non-zero on success.
If the value cannot be read, the return value is zero.
Comments
Address has to be even number in the range of 128 to 508, because we use 16-bit alignment when
working with DPRAM. Addresses less than 128 are used for internal purposes.
Example
4.36.2 acsc_WriteDPRAMInteger
Description
The function writes 32-bit integer to the DPRAM.
Syntax
acsc_WriteDPRAMInteger(HANDLE Handle, int address,int Value)
Arguments
Address Address has to be even number from 128 to 1020 (DRAM size is 1024)
Return Value
The function returns non-zero on success.
If the value cannot be written, the return value is zero.
Comments
Address has to be even number in the range of 128 to 508, because we use 16-bit alignment when
working with DPRAM. Addresses less than 128 are used for internal purposes.
Example
4.36.3 acsc_ReadDPRAMReal
Description
The function reads 64-bit Real from the DPRAM.
Syntax
acsc_ReadDPRAMReal(HANDLE Handle, int address, double *Value)
Arguments
Address Address has to be even number from 128 to 1020 (DRAM size is 1024)
Return Value
The function returns non-zero on success.
If the value cannot be read, the return value is zero.
Comments
Address has to be even number in the range of 128 to 504, because we use 16-bit alignment when
working with DPRAM. Addresses less than 128 are used for internal purposes.
Example
4.36.4 acsc_WriteDPRAMReal
Description
The function writes 64-bit Real to the DPRAM.
Syntax
acsc_WriteDPRAMReal(HANDLE Handle, int address, double Value)
Arguments
Address Address has to be even number from 128 to 1020 (DRAM size is 1024)
Return Value
The function returns non-zero on success.
If the value cannot be written, the return value is zero.
Comments
Address has to be even number in the range of 128 to 504, because we use 16-bit alignment when
working with DPRAM. Addresses less than 128 are used for internal purposes.
Example
The Shared Memory functions have been added in support of SPiiPlus SC to enable
accessing memory addresses. They cannot be used with any other SPiiPlus family
product.
Function Description
4.37.1 acsc_GetSharedMemoryAddress
Description
The function reads the address of shared memory variable.
Syntax
int acsc_GetSharedMemoryAddress(HANDLE Handle, int NBuf, char* Var,
unsigned int* Address, ACSC_WAITBLOCK* Wait)
Arguments
Number of program buffer for local variable or ACSC_NONE for global and
NBuf
standard variable.
Address Pointer to the variable that receives the address of specified variable.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
4.37.2 acsc_ReadSharedMemoryInteger
Description
The function reads value(s) from an integer shared memory variable.
Syntax
int acsc_ReadSharedMemoryInteger(HANDLE Handle, unsigned int Address,
int From1, int To1, int From2, int To2, int* Values)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
4.37.3 acsc_WriteSharedMemoryInteger
Description
The function writes value(s) to the integer shared memory variable.
Syntax
int acsc_WriteSharedMemoryInteger(HANDLE Handle, unsigned int Address,
int From1, int To1, int From2, int To2, int* Values)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
4.37.4 acsc_ReadSharedMemoryReal
Description
The function reads value(s) from a real shared memory variable.
Syntax
int acsc_ReadSharedMemoryReal(HANDLE Handle, unsigned int Address, int From1,
int To1, int From2, int To2, double* Values)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
4.37.5 acsc_WriteSharedMemoryReal
Description
The function writes value(s) to the real shared memory variable.
Syntax
int acsc_WriteSharedMemoryReal(HANDLE Handle, unsigned int Address, int From1,
int To1, int From2, int To2, double* Values)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
The D-Buffer should contain the definition of the relevant shared memory variable:
global real shm HELLO_VAR(2)(2)
The EtherCAT functions can be used only with the SPiiPlus family of products
Function Description
Function Description
acsc_
Used for obtaining the Vendor ID of an EtherCAT slave.
GetEtherCATSlaveVendorIDV2
acsc_
Used for obtaining the Product ID of an EtherCAT slave.
GetEtherCATSlaveProductIDV2
4.38.1 acsc_GetEtherCATState
Description
The function is used to retrieve the EtherCAT state.
Syntax
int acsc_GetEtherCATState(HANDLE Handle, int* State, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The EtherCAT state is contained in the ACSPL+ ECST variable. The EtherCAT state is reflected in the
first six bits as given in Table 5-37.
Table 5-37. ECST Bits
All bus devices are successfully set to INIT state. The Master
2 #INITOK
started all devices to the initial state.
All bits (except #INSYNC in some cases) should be true for proper bus functioning, for
monitoring the bus state, checking bit #OP is enough. Any bus error will reset the #OP
bit.
Example
int Value = 0;
if (!acsc_GetEtherCATState(Handle, &Value, NULL))
{
printf("acsc_GetEtherCATState(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.38.2 acsc_MapEtherCATInput
Description
The function is used for raw mapping of network input variables of any size. Once the function is
called successfully, the firmware copies the value of the network input variable at the corresponding
EtherCAT offset into the ACSPL+ variable, every controller cycle.
The function call is legal only when the EtherCAT state is operable (that is, ECST.OP=1).
Syntax
int acsc_MapEtherCATInput(HANDLE Handle, int Flags, int Offset,
char* VariableName, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
4.38.3 acsc_MapEtherCATOutput
Description
The function is used for raw mapping of network output variables of any size. Once the function is
called successfully, the firmware copies the value of specified ACSPL+ variable into the network
output variable at the corresponding EtherCAT offset, every controller cycle.
The function call is legal only when the EtherCAT state is operable (that is, ECST.OP=1).
Syntax
int acsc_MapEtherCATOutput(HANDLE Handle, int Flags, int Offset,
char* VariableName, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
4.38.4 acsc_UnmapEtherCATInputsOutputs
Description
The function resets all previous mapping defined by acsc_MapEtherCATInput and acsc_
MapEtherCATOutput functions.
The function call is legal only when the EtherCAT state is operable (that is, ECST.OP=1).
Syntax
int acsc_UnmapEtherCATInputsOutputs(HANDLE Handle,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
if (!acsc_UnmapEtherCATInputsOutputs(Handle, NULL))
{
printf("acsc_UnmapEtherCATInputsOutputs(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.38.5 acsc_GetEtherCATSlaveIndex
Description
The function returns the index of EtherCAT slave according to the parameters that are specified.
Syntax
int acsc_GetEtherCATSlaveIndex(HANDLE Handle, int VendorID, int ProductID,
int Count, int* SlaveIndex, ACSC_WAITBLOCK* Wait)
Arguments
Internal count of the device within those devices having the same Product
Count
and Vendor IDs.
SlaveIndex Pointer to a variable that receives the index of the EtherCAT slave.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
double SlaveIndex = 0;
if (!acsc_GetEtherCATSlaveIndex(Handle, 0x00000540, 0x02040000, 1,
&SlaveIndex, NULL))
{
printf("acsc_GetEtherCATSlaveIndex(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.38.6 acsc_GetEtherCATSlaveOffsetV2
Description
The function returns offset of a network variable of the specified EtherCAT slave in specific ECAT
network.
Syntax
Arguments
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
double Value = 0;
if (!acsc_GetEtherCATSlaveOffsetV2(Handle, ACSC_ETHERCAT_NETWORK_0,
"DIGITAL_INPUTS", (int)SlaveIndex, &Value, NULL))
{
printf("acsc_GetEtherCATSlaveOffsetV2(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.38.7 acsc_GetEtherCATSlaveVendorIDV2
Description
The function returns the Vendor ID of the specified EtherCAT slave in the specific ECAT network.
Syntax
int acsc_GetEtherCATSlaveVendorIDV2(HANDLE Handle, int Flags, int SlaveIndex, double* VendorID,
ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped argument that can include one or more of the following flags:
ACSC_ETHERCAT_NETWORK_0 - first network specifier
ACSC_ETHERCAT_NETWORK_1 - second network specifier
Flags
ACSC_ETHERCAT_NETWORK_0 and ACSC_ETHERCAT_NETWORK_1 flags
must not be specified together
0, //No flags are set ( equivalent to flag ACSC_ETHERCAT_NETWORK_0)
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
double VendorID = 0;
if (!acsc_GetEtherCATSlaveVendorIDV2(Handle, ACSC_ETHERCAT_NETWORK_0,
(int)SlaveIndex, &VendorID, NULL))
{
printf("acsc_GetEtherCATSlaveVendorIDV2():Error Occurred -%d\n",
acsc_GetLastError());
return;
}
4.38.8 acsc_GetEtherCATSlaveProductIDV2
Description
The function returns the Product ID of the specified EtherCAT slave in the specific EtherCAT network.
Syntax
Syntax
int acsc_GetEtherCATSlaveProductIDV2(HANDLE Handle, int Flags, int SlaveIndex, double* ProductID,
ACSC_WAITBLOCK* Wait)
Arguments
Bit-mapped argument that can include one or more of the following flags:
ACSC_ETHERCAT_NETWORK_0 - first network specifier
ACSC_ETHERCAT_NETWORK_1 - second network specifier
Flags
ACSC_ETHERCAT_NETWORK_0 and ACSC_ETHERCAT_NETWORK_1 flags
must not be specified together
0, //No flags are set ( equivalent to flag ACSC_ETHERCAT_NETWORK_0)
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
double ProductID = 0;
if (!acsc_GetEtherCATSlaveProductIDV2(Handle, ACSC_ETHERCAT_NETWORK_0 ,
(int)SlaveIndex, &ProductID, NULL))
{
printf("acsc_GetEtherCATSlaveProductIDV2(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.38.9 acsc_GetEtherCATSlaveRevisionV2
Description
The function returns the revision of the specified EtherCAT slave in the specific EtherCAT network.
Syntax
Arguments
Bit-mapped argument that can include one or more of the following flags:
ACSC_ETHERCAT_NETWORK_0 - first network specifier
ACSC_ETHERCAT_NETWORK_1 - second network specifier
Flags
ACSC_ETHERCAT_NETWORK_0 and ACSC_ETHERCAT_NETWORK_1 flags
must not be specified together
0, //No flags are set ( equivalent to flag ACSC_ETHERCAT_NETWORK_0)
Return Value
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
double Revision = 0;
if (!acsc_GetEtherCATSlaveRevisionV2(Handle, ACSC_ETHERCAT_NETWORK_0 ,
(int)SlaveIndex, &Revision,NULL))
{
printf("acsc_GetEtherCATSlaveRevisionV2(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.38.10 acsc_GetEtherCATSlaveType
Description
The function returns the type of the specified EtherCAT slave.
Syntax
int acsc_GetEtherCATSlaveType(HANDLE Handle, int VendorID, int ProductID,
double* SlaveType, ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
double Value = 0;
if (!acsc_GetEtherCATSlaveType(Handle, (int)VendorID, (int)ProductID,
&Value, NULL))
{
printf("acsc_GetEtherCATSlaveType(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.38.11 acsc_GetEtherCATSlaveRegister
Description
The function returns value of the ESC Error Counters Registers of specified EtherCAT slave in specific
EtherCAT network.
Syntax
Arguments
Handle
Communication handle.
Bit-mapped argument that can include one or more of the following flags:
ACSC_ETHERCAT_NETWORK_0 - first network specifier
ACSC_ETHERCAT_NETWORK_1 - second network specifier
ACSC_ETHERCAT_NETWORK_0 and ACSC_ETHERCAT_NETWORK_1 flags
Flags must not be specified together
0, //No flags are set ( equivalent to flag ACSC_ETHERCAT_NETWORK_0)
Comments
The following table lists supported error counter registers.
Table 5-38. EtherCAT Error Counter Registers
Forwarded RX Error
0x309
Counter
Forwarded RX Error
0x30A
Counter (CRC C/D)
Forwarded RX Error
0x30B
Counter
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError
Example
4.38.12 acsc_GetEtherCATSlaveStateV2
Description
The function returns machine state of the specified EtherCAT slave in specific EtherCAT network.
Syntax
Arguments
Bit-mapped argument that can include one or more of the following flags:
ACSC_ETHERCAT_NETWORK_0 - first network specifier
ACSC_ETHERCAT_NETWORK_1 - second network specifier
Flags
ACSC_ETHERCAT_NETWORK_0 and ACSC_ETHERCAT_NETWORK_1 flags
must not be specified together
0, //No flags are set ( equivalent to flag ACSC_ETHERCAT_NETWORK_0)
SlaveState 2 - PREOP
4 - SAFEOP
8 - OP
If specified slave does not exist or is not accessible, -1 is returned.
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
double Value = 0;
if (!acsc_GetEtherCATSlaveStateV2(Handle, ACSC_ETHERCAT_NETWORK_0,
(int)SlaveIndex, &Value, NULL))
{
4.38.13 acsc_GetEtherCATSlavesCount
Description
The function is used to retrieve the number of slaves in the specified EtherCAT network.
Syntax
Arguments
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
double Value = 0;
if (!acsc_GetEtherCATSlavesCount(Handle, ACSC_ETHERCAT_NETWORK_0, &Value,
NULL))
{
printf("acsc_GetEtherCATSlavesCount(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
Function Description
Sets the parameters for the Random PEG mode - for SPiiPlusNT
acsc_PegRandomNTV2
and SPiiPlusSC controllers only.
Waits for the all values to be loaded and the PEG engine to be
acsc_WaitPegReady ready to respond to movement on the specified axis - for
SPiiPlusNT and SPiiPlusSC controllers only.
4.39.1 acsc_AssignPegNTV2
This function can be used only with the SPiiPlus family of controllers.
Description
This function is used for engine-to-encoder assignment as well as for the additional digital outputs
assignment for use as PEG state and PEG pulse outputs. As of V3.12, a new flag is available calling for
fast loading of Random PEG arrays
Syntax
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
int Axis = 0;
int EngToEncBitCode = 5;
int GpOutsBitCode = 0;
if (!acsc_AssignPegNTV2(Handle, ACSC_AMF_FASTLOADINGPEG, Axis,
EngToEncBitCode, GpOutsBitCode,
NULL))
{
printf("acsc_AssignPegNTV2(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.39.2 acsc_AssignPegOutputsNT
This function can be used only with the SPiiPlus family of controllers.
Description
The function is used for setting output pins assignment and mapping between FGP_OUT signals to
the bits of the ACSPL+ OUT(x) variable, where x is the index that has been assigned to the controller
in the network during System Configuration.
OUT is an integer array that can be used for reading or writing the current state of the General
Purpose outputs - see the SPiiPlus Command & Variable Reference Guide.
Syntax
int acsc_AssignPegOutputsNT(HANDLE Handle, int Axis, int OutputIndex, int BitCode,
ACSC_WAITBLOCK* Wait)
Arguments
Bit code for engine outputs to physical outputs mapping according to the
BitCode
ASSIGNPEG chapter in the PEG and MARK Operations Application Notes.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
int Axis = 0;
int OutputIndex = 2;
int OutputBitCode = 1;
if (!acsc_AssignPegOutputsNT(Handle, Axis, OutputIndex, OutputBitCode,
NULL))
{
printf("acsc_AssignPegOutputsNT(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.39.3 acsc_AssignFastInputsNT
This function can be used only with the SPiiPlus family of controllers.
Description
The function is used to switch MARK_1 physical inputs to ACSPL+ variables as fast general purpose
inputs.
The function is not related to PEG activity. It is included for the sake of completeness,
since many times fast inputs are used in applications that use PEG functionality
The function is used for setting input pins assignment and mapping between FGP_IN signals to the
bits of the ACSPL+ IN(x) variable, where x is the index that has been assigned to the controller in the
network during System Configuration.
IN is an integer array that can be used for reading the current state of the General Purpose inputs -
see the SPiiPlus Command & Variable Reference Guide.
Syntax
int acsc_AssignFastInputsNT(HANDLE Handle, int Axis, int InputIndex, int BitCode,
ACSC_WAITBLOCK* Wait)
Arguments
Bit code for mapping engines inputs to physical inputs the ASSIGNPEG and
BitCode
ASSIGNPOUTS chapters in the PEG and MARK Operations Application Notes.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
int Axis = 0;
int InputIndex = 1;
int InputBitCode = 7;
if (!acsc_AssignFastInputsNT(Handle, Axis, InputIndex, InputBitCode,
NULL))
{
printf("acsc_AssignFastInputsNT(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.39.4 acsc_PegIncNTV2
This function can be used only with the SPiiPlus family of controllers.
Description
The function is used for setting the parameters for the Incremental PEG mode. The Incremental PEG
function is defined by first point, last point and the interval.
Syntax
Arguments
ACSC_AMF_MAXIMUM_ARR_SIZE
This flag supports 1D/2D dynamic error compensation for Incremental
PEG. The ErrMapMaxSize parameter must have a relevant value
with this flag is set.
ACSC_AMF_MIN_AXIS_DIRECTION
This flag signals that the MinDirDistance parameter indicates a
value defining actual motion as opposed to jitter. If motion along the
axis when error compensation is in force is greater than this value,
that motion is used to determine the direction of motion.
The index of the first static axis when error mapping is used with PEG.
Use with the ACSC_AMF_DYNAMIC_ERROR_COMPENSATION2D flag
ErrMapAxis1
alone or in combination with ACSC_AMF_DYNAMIC_ERROR_
COMPENSATION3D .
The predefined location value of the first static axis when error map
correction compensation is used with PEG. Use with the ACSC_AMF_
AxisCoord1
DYNAMIC_ERROR_COMPENSATION2D flag alone or in combination
with ACSC_AMF_DYNAMIC_ERROR_COMPENSATION3D .
The index of the second static axis when error mapping is used with
ErrMapAxis2 PEG. Use with the ACSC_AMF_DYNAMIC_ERROR_COMPENSATION2D
and ACSC_AMF_DYNAMIC_ERROR_COMPENSATION3D flags.
The predefined location value of the second static axis when error
map correction compensation is used with PEG. Use with the ACSC_
AxisCoord2
AMF_DYNAMIC_ERROR_COMPENSATION2D and ACSC_AMF_
DYNAMIC_ERROR_COMPENSATION3D flags.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Version Support
This function is supported from V3.12 and later.
Example
int Flags = 0;
double Width = 0.5;
double FirstPoint = 0;
double LastPoint = 10000;
double Interval = 1000;
if (!acsc_PegIncNT(Handle, Flags, Axis, Width, FirstPoint, Interval,
LastPoint, ACSC_NONE,
ACSC_NONE, NULL))
{
printf("acsc_PegIncNT(): Error Occurred - %d\n", acsc_GetLastError());
return;
}
int Timeout = 5000;
if (!acsc_WaitPegReadyNT(Handle, Axis, Timeout))
{
printf("acsc_WaitPegReadyNT(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
if (!acsc_PegIncNTV2(Handle, ACSC_AMF_DYNAMIC_ERROR_COMPENSATION2D |
ACSC_AMF_DYNAMIC_ERROR_COMPENSATION3D, 0, Width, FirstPoint, Interval,
LastPoint, 1, 100, 2, 200,2, ACSC_NONE, ACSC_NONE, ACSC_NONE, ACSC_NONE,
ACSC_SYNCHRONOUS))
{
printf("acsc_PegIncNTV2(): Error Occurred - %d\n", acsc_GetLastError());
return;
}
int Timeout = 5000;
if (!acsc_WaitPegReadyNT(Handle, Axis, Timeout))
{
printf("acsc_WaitPegReadyNT(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.39.5 acsc_PegRandomNTV2
The new function includes new parameters supporting error mapping. See Dynamic Error
Compensation functions for information on dynamic error mapping.
Description
The function sets the parameters for the Random PEG mode. The Random PEG function specifies an
array of points where position-based events are to be generated, and includes parameters for error
mapping support.
Syntax
Arguments
The index of the first static axis when error mapping is used with PEG.
Use with the ACSC_AMF_DYNAMIC_ERROR_COMPENSATION2D flag
ErrMapAxis1
alone or in combination with ACSC_AMF_DYNAMIC_ERROR_
COMPENSATION3D .
The predefined location value of the first static axis when error map
correction compensation is used with PEG. Use with the ACSC_AMF_
AxisCoord1
DYNAMIC_ERROR_COMPENSATION2D flag alone or in combination
with ACSC_AMF_DYNAMIC_ERROR_COMPENSATION3D .
The index of the second static axis when error mapping is used with
ErrMapAxis2 PEG. Use with the ACSC_AMF_DYNAMIC_ERROR_COMPENSATION2D
and ACSC_AMF_DYNAMIC_ERROR_COMPENSATION3D flags.
The predefined location value of the second static axis when error
map correction compensation is used with PEG. Use with the ACSC_
AxisCoord2
AMF_DYNAMIC_ERROR_COMPENSATION2D and ACSC_AMF_DYNAMIC_
ERROR_COMPENSATION3D flags.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The function initiates random PEG generation (see SPiiPlus ACSPL+ Programmer’s Guide).
StateArray should be NULL if output state won’t change because of PEG.
The time-based pulse generation is optional, if it is not used, TbPeriod and TbNumber should be
ACSC_NONE.
If Wait points to a valid ACSC_WAITBLOCK structure, the calling thread must not use or delete the
Wait item until a call to the acsc_WaitForAsyncCall function.
Supported from V3.12.
Example
int Mode = 0;
int FirstIndex = 0;
int LastIndex = 10;
if (!acsc_PegRandomNT(Handle, Flags, Axis, Width, Mode, FirstIndex,
LastIndex, "ARR", "STAT",
ACSC_NONE, ACSC_NONE, NULL))
{
printf("acsc_PegRandomNT(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
int Timeout = 5000;
if (!acsc_WaitPegReadyNT(Handle, Axis, Timeout))
{
printf("acsc_WaitPegReadyNT(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
int Mode = 0;
int FirstIndex = 0;
int LastIndex = 10;
if (!acsc_PegRandomNTV2(Handle, ACSC_AMF_DYNAMIC_ERROR_COMPENSATION2D |
ACSC_AMF_DYNAMIC_ERROR_COMPENSATION3D, Axis, Width, Mode, FirstIndex,
LastIndex, "ARR", "STAT", 1, 100, 2, 200, ACSC_NONE, ACSC_NONE, ACSC_
NONE, NULL))
{
printf("acsc_PegRandomNTV2(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
int Timeout = 5000;
if (!acsc_WaitPegReadyNT(Handle, Axis, Timeout))
{
printf("acsc_WaitPegReadyNT(): Error Occurred - %d\n",
acsc_GetLastError());
return;
}
4.39.6 acsc_WaitPegReady
This function can be used only with the SPiiPlus family of controllers.
Description
The function waits for the all values to be loaded and the PEG engine to be ready to respond to
movement on the specified axis.
The function can be used in both the Incremental and Random PEG modes.
Syntax
int acsc_WaitPegReadyNT(HANDLE Handle, int Axis, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
4.39.7 acsc_StartPegNT
This function can be used only with the SPiiPlus family of controllers.
Description
The function is used to initiate the PEG process.
Syntax
int acsc_StartPegNT(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
PEG axis: ACSC_AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. For the
Axis
axis constants see Axis Definitions..
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
4.39.8 acsc_StopPegNT
This function can be used only with the SPiiPlus family of controllers.
Description
The function is used to terminate the PEG process immediately on the specified axis. The function
can be used in both the Incremental and Random PEG modes.
Syntax
int acsc_StopPegNT(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait)
Arguments
PEG axis: ACSC_AXIS_0 corresponds to axis 0, ACSC_AXIS_1 to axis 1, etc. For the
Axis
axis constants see Axis Definitions..
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
Arguments
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number of
Zone zones (up to 10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError
Example
return;
}
4.40.2 acsc_DynamicErrorCompensationOff
Description
acsc_DynamicErrorCompensationOff function receives axis index and zone index parameters . The
function deactivates error mapping correction for the mechanical error compensation for the
specified zone.
Syntax
Arguments
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number of
Zone
zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be affected.
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError
Example
return;
}
4.40.3 acsc_DynamicErrorCompensation1D
Description
The acsc_DynamicErrorCompensation1D function configures and activates 1D error correction for the
mechanical error compensation for the specified zone, so that the compensated reference position
will be calculated by subtracting the linearly (by default) interpolated error from the desired position
so that the actual value will be closer to the desired value. The calculation assumes fixed intervals
between points inside the zone.
Syntax
Arguments
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
A real number representing the fixed interval distance between the two
Step0
adjacent axis commands.
referenced_
The index of the axis, or the index of the analog input that the
axis_or_analog_
mechanical error compensation will be calculated based on its feedback.
input
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError
Example
4.40.4 acsc_DynamicErrorCompensationN1D
Description
The acsc_DynamicErrorCompensationN1D function configures and activates 1D error correction for
the mechanical error compensation for the specified zone, so that the compensated reference
position will be calculated by subtracting the linearly (by default) interpolated error from the desired
position so that the actual value will be closer to the desired value. The calculation is based on an
arbitrary network of points inside the zone.
Syntax
Arguments
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
referenced_
[Optional] The index of the axis, or the index of the analog input that the
axis_or_analog_
mechanical error compensation will be calculated based on its feedback.
input
Return Value
If the function succeeds, the return value is non-zero
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
4.40.5 acsc_DynamicErrorCompensationA1D
Description
The acsc_DynamicErrorCompensationA1D function configures and activates 1D error correction for
the mechanical error compensation for the specified zone, so that the compensated reference
position will be calculated by multiplying the scaling factor by the desired position so that the actual
value will be closer to the desired value.
Syntax
Arguments
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number of
Zone zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
scaling_ The scaling factor for the linear alignment that will be used for mechanical
factor error compensation. The allowed range for the scaling factor is 0>2.
The offset for the linear alignment that will be used for mechanical error
offset compensation. The offset is actually the mechanical error compensation for
the 0-point location.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
if (!acsc_DynamicErrorCompensationA1D(hComm,NULL,ACSC_AXIS_0, 0,
1.2, ACSC_NONE, ACSC_SYNCHRONOUS)){
printf("acsc_DynamicErrorCompensationA1D():Error Occurred -%d\n",
acsc_GetLastError());
return;
}
4.40.6 acsc_DynamicErrorCompensation2D
Description
The acsc_DynamicErrorCompensation2D function configures and activates 2D error correction for
the mechanical error compensation of the ‘axis0’ command for the specified zone, so that the
compensated reference position will be calculated by subtracting the linearly (by default)
interpolated error from the desired position so that the actual value will be closer to the desired
value.
Syntax
Arguments
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
A real number representing the fixed interval distance between the two
Step0
adjacent ‘axis0’ commands.
A real number representing the fixed interval distance between the two
Step1
adjacent ‘axis1’ commands.
referenced_
The index of the first axis, or the index of the first analog input whose
axis_or_analog_
feedback will be used to calculate the mechanical error compensation.
input0
referenced_ The index of the second axis, or the index of the second analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input1 compensation.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
4.40.7 acsc_DynamicErrorCompensationN2D
Description
The acsc_DynamicErrorCompensationN2D function configures and activates 2D error correction for
the mechanical error compensation of the ‘axis0’ parameter for the specified zone, so that the
compensated reference position will be calculated by subtracting the linearly (by default)
interpolated error from the desired position so that the actual value will be closer to the desired
value. The calculation is based on an arbitrary network of points inside the zone.
Syntax
Arguments
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
referenced_ The index of the first axis, or the index of the first analog input whose
axis_or_analog_ feedback will be used to calculate the mechanical error compensation.
input0
The index of the second axis, or the index of the second analog input
referenced_ whose feedback will be used to calculate the mechanical error
axis_or_analog_ compensation.
input1
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
acsc_GetLastError());
return;
}
4.40.8 acsc_DynamicErrorCompensationA2D
Description
The acsc_DynamicErrorCompensationA2D function configures and activates 2D error correction for
the mechanical error compensation of the specified axis for the specified zone, so that the
compensated reference position will be calculated by taking into account the angle for the
orthogonality correction so that the actual value will be closer to the desired value.
Syntax
Arguments
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the system
minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number of
Zone
zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be affected.
The angle for the orthogonality correction that will be used for mechanical
Angle
error compensation. The allowed range for the angle is [-45°, 45°].
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
if (!acsc_DynamicErrorCompensationA2D(hComm,NULL,ACSC_AXIS_0, ACSC_AXIS_
1, 0, 30, ACSC_SYNCHRONOUS)){
printf("acsc_DynamicErrorCompensationA2D():Error Occurred -%d\n",
acsc_GetLastError());
return;
}
4.40.9 acsc_DynamicErrorCompensation3D2
Description
The acsc_DynamicErrorCompensation3D2 function configures and activates 3D error correction for
the mechanical error compensation of the ‘axis0’, ‘axis1’, and 'axis2' parameters for the specified
zone, so that the compensated reference position will be calculated by adding the linearly (by
default) interpolated error from the desired position so that the actual value will be closer to the
desired value.
Syntax
Arguments
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
A real number representing the fixed interval distance between the two
Step0
adjacent ‘axis0’ commands.
A real number representing the fixed interval distance between the two
Step1
adjacent ‘axis1’ commands.
A real number representing the fixed interval distance between the two
Step2
adjacent ‘axis2’ commands.
referenced_ The index of the first axis, or the index of the first analog input whose
axis_or_analog_ feedback will be used to calculate the mechanical error compensation.
input0
The index of the second axis, or the index of the second analog input
referenced_ whose feedback will be used to calculate the mechanical error
axis_or_analog_ compensation.
input1
referenced_
The index of the third axis, or the index of the third analog input whose
axis_or_analog_
feedback will be used to calculate the mechanical error compensation.
input2
Return Value
If the function succeeds, the return value is non-zero.
4.40.10 acsc_DynamicErrorCompensation3D3
Description
The acsc_DynamicErrorCompensation3D3 function configures and activates 3D error correction for
the mechanical error compensation of the ‘axis0’, ‘axis1’, and 'axis2' parameters for the specified
zone, so that the compensated reference position will be calculated by adding the linearly (by
default) interpolated error from the desired position so that the actual value will be closer to the
desired value.
Syntax
Arguments
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
A real number representing the fixed interval distance between the two
Step0
adjacent ‘axis0’ commands.
A real number representing the fixed interval distance between the two
Step1
adjacent ‘axis1’ commands.
A real number representing the fixed interval distance between the two
Step2
adjacent ‘axis2’ commands.
referenced_ The index of the first axis, or the index of the first analog input whose
axis_or_analog_ feedback will be used to calculate the mechanical error compensation.
input0
The index of the second axis, or the index of the second analog input
referenced_ whose feedback will be used to calculate the mechanical error
axis_or_analog_ compensation.
input1
referenced_ The index of the second axis, or the index of the third analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input2 compensation.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
4.40.11 acsc_DynamicErrorCompensation3D5
Description
The acsc_DynamicErrorCompensation3D5 function configures and activates 3D error correction for
the mechanical error compensation of the ‘axis0’, ‘axis1’, and 'axis2' parameters for the specified
zone, so that the compensated reference position will be calculated by adding the linearly (by
default) interpolated error from the desired position so that the actual value will be closer to the
desired value.
Syntax
Arguments
Handle
Communication handle.
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
A real number representing the fixed interval distance between the two
Step0
adjacent ‘axis0’ commands.
A real number representing the fixed interval distance between the two
Step1
adjacent ‘axis1’ commands.
A real number representing the fixed interval distance between the two
Step2
adjacent ‘axis2’ commands.
referenced_ The index of the first axis, or the index of the first analog input whose
axis_or_analog_ feedback will be used to calculate the mechanical error compensation.
input0
The index of the second axis, or the index of the second analog input
referenced_ whose feedback will be used to calculate the mechanical error
axis_or_analog_ compensation.
input1
referenced_ The index of the second axis, or the index of the third analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input2 compensation.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
4.40.12 acsc_DynamicErrorCompensation3DA
Description
The acsc_DynamicErrorCompensation3DA function configures and activates 3D error correction for
the mechanical error compensation of the ‘axis0’, ‘axis1’, and 'axis2' parameters for the specified
zone, so that the compensated reference position will be calculated by adding the linearly (by
default) interpolated error from the desired position so that the actual value will be closer to the
desired value.
Syntax
Arguments
Handle
Communication handle.
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
A real number representing the fixed interval distance between the two
Step0
adjacent ‘axis0’ commands.
A real number representing the fixed interval distance between the two
Step1
adjacent ‘axis1’ commands.
A real number representing the fixed interval distance between the two
Step2
adjacent ‘axis2’ commands.
referenced_ The index of the first axis, or the index of the first analog input whose
axis_or_analog_ feedback will be used to calculate the mechanical error compensation.
input0
The index of the second axis, or the index of the second analog input
referenced_ whose feedback will be used to calculate the mechanical error
axis_or_analog_ compensation.
input1
referenced_ The index of the second axis, or the index of the third analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input2 compensation.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
if (!acsc_DynamicErrorCompensation3DA(hComm,
0, // flags
ACSC_AXIS_0, //axis0
ACSC_AXIS_1, // axis1
ACSC_AXIS_2, // axis2
0, //Zone
0, //Base0
10, //Step0
5,//Base1
15,//Step1
10,// Base2
20, //Step2
Correction0, //Correction map 0
Correction1, //Correction map 1
Correction2, //Correction map 2
Correction3, //Correction map 3
Correction4, //Correction map 4
Correction5, //Correction map 5
Correction6, //Correction map 6
Correction7, //Correction map 7
Correction8, //Correction map 8
Correction9, //Correction map 9
ACSC_NONE, // referenced_axis_or_analog_input0
ACSC_NONE, // referenced_axis_or_analog_input1
ACSC_NONE, // referenced_axis_or_analog_input2
ACSC_SYNCHRONOUS))
{
printf("acsc_DynamicErrorCompensation3DA():Error Occurred -%d\n",acsc_
GetLastError());
return;
}
4.40.13 acsc_DynamicErrorCompensationN3D2
Description
The acsc_DynamicErrorCompensationN3D2 function configures and activates 3D error correction for
the mechanical error compensation of the ‘axis0’, ‘axis1’, and 'axis2' parameters for the specified
zone, so that the compensated reference position will be calculated by adding the linearly (by
default) interpolated error from the desired position so that the actual value will be closer to the
desired value.
Syntax
Arguments
Handle
Communication handle.
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
referenced_
The index of the first axis, or the index of the first analog input whose
axis_or_analog_
feedback will be used to calculate the mechanical error compensation.
input0
referenced_ The index of the second axis, or the index of the second analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input1 compensation.
referenced_ The index of the second axis, or the index of the third analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input2 compensation.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
4.40.14 acsc_DynamicErrorCompensationN3D3
Description
The acsc_DynamicErrorCompensationN3D3 function configures and activates 3D error correction for
the mechanical error compensation of the ‘axis0’, ‘axis1’, and 'axis2' parameters for the specified
zone, so that the compensated reference position will be calculated by adding the linearly (by
default) interpolated error from the desired position so that the actual value will be closer to the
desired value.
Syntax
Arguments
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
referenced_ The index of the first axis, or the index of the first analog input whose
axis_or_analog_ feedback will be used to calculate the mechanical error compensation.
input0
The index of the second axis, or the index of the second analog input
referenced_ whose feedback will be used to calculate the mechanical error
axis_or_analog_ compensation.
input1
referenced_ The index of the second axis, or the index of the third analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input2 compensation.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
4.40.15 acsc_DynamicErrorCompensationN3D5
Description
The acsc_DynamicErrorCompensationN3D5 function configures and activates 3D error correction for
the mechanical error compensation of the ‘axis0’, ‘axis1’, and 'axis2' parameters for the specified
zone, so that the compensated reference position will be calculated by adding the linearly (by
default) interpolated error from the desired position so that the actual value will be closer to the
desired value.
Syntax
Arguments
Handle
Communication handle.
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
referenced_ The index of the first axis, or the index of the first analog input whose
axis_or_analog_ feedback will be used to calculate the mechanical error compensation.
input0
The index of the second axis, or the index of the second analog input
referenced_ whose feedback will be used to calculate the mechanical error
axis_or_analog_ compensation.
input1
referenced_ The index of the second axis, or the index of the third analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input2 compensation.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
4.40.16 acsc_DynamicErrorCompensationN3DA
Description
The acsc_DynamicErrorCompensationN3DA function configures and activates 3D error correction for
the mechanical error compensation of the ‘axis0’ , ‘axis1’ , and 'axis2' parameters for the specified
zone, so that the compensated reference position will be calculated by adding the linearly (by
default) interpolated error from the desired position so that the actual value will be closer to the
desired value.
Syntax
Arguments
The index of the first axis that the mechanical error compensation will be
Axis0 applied to. Valid numbers are: 0, 1, 2, ... up to the number of axes in the
system minus 1.
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number
Zone of zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be
affected.
referenced_ The index of the first axis, or the index of the first analog input whose
axis_or_analog_ feedback will be used to calculate the mechanical error compensation.
input0
The index of the second axis, or the index of the second analog input
referenced_ whose feedback will be used to calculate the mechanical error
axis_or_analog_ compensation.
input1
referenced_ The index of the second axis, or the index of the third analog input
axis_or_analog_ whose feedback will be used to calculate the mechanical error
input2 compensation.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
specifies ‘axis0’
Axis1Coordinates, // The name of a real one-dimensional array that
specifies ‘axis1’
Axis2Coordinates,// The name of a real one-dimensional array that
specifies ‘axis0’
Correction0, //Correction map 0
Correction1, //Correction map 1
Correction2, //Correction map 2
Correction3, //Correction map 3
Correction4, //Correction map 4
Correction5, //Correction map 5
Correction6, //Correction map 6
Correction7, //Correction map 7
Correction8, //Correction map 8
Correction9, //Correction map 9
ACSC_NONE, // referenced_axis_or_analog_input0
ACSC_NONE, // referenced_axis_or_analog_input1
ACSC_NONE, // referenced_axis_or_analog_input2
ACSC_SYNCHRONOUS))
{
printf("acsc_DynamicErrorCompensationN3DA():Error Occurred -%d\n",acsc_
GetLastError());
return;
}
4.40.17 acsc_DynamicErrorCompensationRemove
Description
The acsc_DynamicErrorCompensationRemove function receives axis index and zone index
parameters. The function deactivates error correction for the mechanical error compensation for the
specified zone.
Syntax
Arguments
The zone index, valid numbers are: 0, 1, 2, ... up to the maximum number of
Zone
zones (10) minus 1. If ‘-1’ is specified, all zones of specified axis will be affected.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Extended error information can be obtained by calling acsc_GetLastError.
Example
Function Description
4.41.1 acsc_RegisterEmergencyStop
Description
The function initiates the Emergency Stop functionality for calling application.
Syntax
int acsc_RegisterEmergencyStop();
Arguments
None
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
SPiiPlus UMD (User Mode Driver) and the C Library provide the user application with the ability to
open/close the Emergency Stop button. Clicking the Emergency Stop button sends a stop command
to all motions and motors to all channels, thereby stopping all motions and disabling all motors.
In the SPiiPlus UMD, when it has been selected, the Emergency Stop button stops all motions and
disables all motors. Previously only SPiiPlus MMI provided such functionality. Now such functionality
is also available for user applications.
Calling acsc_RegisterEmergencyStop will cause an Emergency Stop button to appear in the right
bottom corner of the computer screen. If this button is already displayed, that is, activated by
another application, a new button does not appear, but all functionality is available for the new
application. Clicking the Emergency Stop button causes the stopping of all motions and motors
command to all channels that are used in the calling application.
Calling acsc_RegisterEmergencyStop requires having the local host SPiiPlus UMD running, even if it
is used through a remote connection, because the Emergency Stop button is part of the local
SPiiPlus UMD. If the local SPiiPlus UMD is not running, the function fails.
Only a single call is required per application. It can be placed anywhere in code, even before the
opening of communication with controllers.
An application can remove the Emergency Stop button by calling acsc_UnregisterEmergencyStop.
The Emergency Stop button disappears if there are no additional registered applications using it.
Termination of SPiiPlus UMD also removes the Emergency Stop button, so restarting the SPiiPlus
UMD requires calling acsc_RegisterEmergencyStop() again.
Registering the Emergency Stop button more than once per application is meaningless, but the
function succeeds anyway. In order to ensure that the Emergency Stop button is active, it is
recommended to place a call to acsc_RegisterEmergencyStop after each call to any of
OpenComm***() functions.
Example
int OpenCommunication()
{
HANDLE Handle = OpenCommEthernet( // It can be any kind of OpenComm***
"10.0.0.100", // TCP-IP address of the controller
ACSC_SOCKET_DGRAM_PORT// point-to-point communication
);
if (Handle == ACSC_INVALID)
{
printf("error opening communication: %d\n",
acsc_GetLastError());
return 0;
}
if (!acsc_RegisterEmergencyStop())
{
printf("Registration of EStop is failed. Error is: %d\n",
acsc_GetLastError());
return 0;
}
return 1;
}
4.41.2 acsc_UnregisterEmergencyStop
Description
The function terminates the Emergency Stop functionality for the calling application.
Syntax
int acsc_UnregisterEmergencyStop();
Arguments
None
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The SPiiPlus User Mode Driver (UMD) and C Library provide user applications with the ability to
activate or deactivate the Emergency Stop button displayed in the UMD.
Calling acsc_UnregisterEmergencyStop will cause application not to respond to the user clicking the
Emergency Stop button displayed on the screen. If there are no other applications that have
registered the Emergency Stop functionality (through the acsc_RegisterEmergencyStopfunction),
the button will disappear.
Unregistering Emergency Stop more than once per application is meaningless, but the function will
succeed anyway.
Example
int CloseCommunication()
{
if (!acsc_UnregisterEmergencyStop())
{
printf("Unregistration of EStop is failed. Error is: %d\n",
acsc_GetLastError());
return 0;
}
if (!acsc_CloseComm(Handle))
{
printf("Error closing communication: %d\n", acsc_GetLastError());
}
return 1;
}
Function Description
acsc_ Analyzes application file and returns information about the file
AnalyzeApplication components.
4.42.1 acsc_AnalyzeApplication
Description
The function analyzes an application file and returns information about the file’s components, such
as, saved ACSPL+ programs, configuration parameters, user files, etc.
Syntax
int acsc_AnalyzeApplication(HANDLE Handle, char* fileName,
ACSC_APPSL_INFO** info (, ACSC_WAITBLOCK* Wait))
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
If fileName is NULL, the current Controller Application will be analyzed; otherwise, the file specified
by fileName, from the local hard disk, will be analyzed.
Example
4.42.2 acsc_LoadApplication
Description
The function loads a section of data from the host PC disk and saves it in the controller’s files.
Syntax
int acsc_LoadApplication(HANDLE Handle const char * fileName,
ACSC_APPLSL_INFO* info (, ACSC_WAITBLOCK* Wait))
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
The user should reboot the controller after the function operation to update the controller
configuration.
To reboot the controller the user can use acsc_ControllerReboot function.
Example
4.42.3 acsc_SaveApplication
Description
The function saves a user application from the controller to a file on the host PC.
Syntax
int acsc_SaveApplication(HANDLE Handle, const char * fileName,
ACSC_APPLSL_INFO* info (, ACSC_WAITBLOCK* Wait))
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
None.
Example
4.42.4 acsc_FreeApplication
Description
The function frees memory previously allocated by the acsc_AnalyzeApplication function.
Syntax
int acsc_FreeApplication(ACSC_APPLSL_INFO* Info)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
Function Description
4.43.1 acsc_ControllerReboot
Description
The function reboots controller and waits for process completion.
Syntax
int acsc_ControllerReboot(HANDLE Handle, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Example
hComm = acsc_OpenComm… ;
if (hComm == ACSC_INVALID)
{
printf("Error while opening communication: %d\n", acsc_GetLastError());
return -1;
}
printf ("Communication with the controller was established
successfully!\n");
if (!acsc_ControllerReboot(hComm,30000)){
printf("ControllerReboot error: %d\n", acsc_GetLastError());
return -1;
}
printf ("Controller rebooted successfully, closing communication\n");
acsc_CloseComm(hComm);
hComm = acsc_OpenComm… ; //reopen communication
if (hComm == ACSC_INVALID)
{
printf("Error while reopening communication after reboot: %d\n", acsc_
GetLastError());
return -1;
}
printf ("Communication with the controller after reboot, was established
successfully!\n");
4.43.2 acsc_ControllerFactoryDefault
Description
The function reboots controller, restores factory default settings and waits for process completion.
Syntax
int acsc_ControllerFactoryDefault(HANDLE Handle, int Timeout)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Example
hComm = acsc_OpenComm… ;
if (hComm == ACSC_INVALID)
{
printf("Error while opening communication: %d\n", acsc_GetLastError());
return -1;
}
printf ("Communication with the controller was established
successfully \n");
if (!acsc_ControllerFactoryDefault(hComm,30000)){
printf("ControllerFactoryDefault error: %d\n",
acsc_GetLastError ());
return -1;
}
printf ("Controller restarted successfully, closing communication\n");
acsc_CloseComm(hComm);
hComm = acsc_OpenComm… ; //reopen communication
if (hComm == ACSC_INVALID)
{
printf("Error while reopening communication after restart: %d\n",
acsc_GetLastError());
return -1;
}
printf ("Communication with the controller after reboot, was
established successfully!\n");
Function Description
acsc_ The function deletes user files from the controller's non-
DeleteFileFromController volatile memory.
4.44.1 acsc_CopyFileToController
Description
The function copies file from host PC to controller’s non-volatile memory.
Syntax
int _ACSCLIB_ WINAPI acsc_CopyFileToController(HANDLE Handle,
char* SourceFileName, char* DestinationFileName,
ACSC_WAITBLOCK* Wait)
Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Example
4.44.2 acsc_DeleteFileFromController
Description
The function deletes user files from controller's non-volatile memory.
Syntax
int _ACSCLIB_ WINAPI acsc_DeleteFileFromController(HANDLE Handle, char* FileName, ACSC_
WAITBLOCK* Wait)Arguments
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
Function Description
4.45.1 acsc_ControllerSaveToFlash
Description
The function saves user application to the controller's non-volatile memory.
Syntax
int _ACSCLIB_ WINAPI acsc_ControllerSaveToFlash(HANDLE Handle, int* Parameters, int* Buffers, int*
SPPrograms, char* UserArrays)
Arguments
User Arrays list - Pointer to the null-terminated string. The string contains
chained names of user arrays, separated by '\r'(13) character.
UserArrays
If there is no need to save user arrays to controller's non-volatile memory,
this parameter should be NULL.
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Comments
Example
Function Description
4.46.1 acsc_StartSPiiPlusSC
Description
The function starts the SPiiPlusSC controller.
Syntax
int _ACSCLIB_ WINAPI acsc_StartSPiiPlusSC()
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
4.46.2 acsc_StopSPiiPlusSC
Description
The function stops the SPiiPlusSC controller.
Syntax
int _ACSCLIB_ WINAPI acsc_StopSPiiPlusSC()
Return Value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero.
Example
The C language FRF library is separate from the ACS C language library, and is available
for an additional licensing fee.
4.47.1 acsc_FRF_Measure
Description
This function initializes FRF measurement.
Syntax
int acsc_FRF_Measure(HANDLE Handle, FRF_INPUT* inputParams, FRF_OUTPUT **outputParams, int
*errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
HANDLE ch;
char* ip;
ip = (char*)"10.0.0.100";
ch = acsc_OpenCommEthernet(ip, 701);
FRF_INPUT* input = new FRF_INPUT();
FRF_OUTPUT* output;
int errorCode = 0;
acsc_FRF_InitInput(input, &errorCode);
input->axis = 0;
input->loopType = FRF_LOOP_TYPE::PositionVelocity;
input->excitationType = FRF_EXCITATION_TYPE::WhiteNoise;
// Chirp type – Irrelevant for WhiteNoise excitation signal
input->chirpType = FRF_CHIRP_TYPE::LinearChirp;
input->filterType = FRF_WINDOW_TYPE::Hamming; // Basic choice for
WhiteNoise excitation signal
input->overlap = FRF_OVERLAP::HalfSignal; // Basic choice for WhiteNoise
excitation signal
input->frequencyDistributionType = FRF_FREQUENCY_DISTRIBUTION_
TYPE::Logarithmic;
// Frequency range parameters
input->startFreqHz = 30;
input->endFreqHz = 3000;
input->freqPerDec = 50;
input->highResolutionStart = 500;
input->highResolutionFreqPerDec = 500;
// Excitation amplitude
input->excitationAmplitudePercentIp = 1;
input->durationSec = 1;
input->numberOfRepetitions = 5;
// User defined signal definition
input->userDefinedExcitationSignal = nullptr;
// Recalculate parameters
input->inRaw = nullptr;
input->outRaw = nullptr;
input->lengthRaw = -1;
input->recalculate = true;
input->recalculate = false;
acsc_FRF_Measure(ch, input, &output, &errorCode);
4.47.2 acsc_FRF_Stop
Description
Function aborts FRF measurement. If FRF was aborted “outputParams” will not contain valid data
(all pointers will be set to nullptr) and errorCode will reflect that FRF was aborted by the user.
Syntax
int acsc_FRF_Stop(HANDLE Handle, int Axis, int* errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
int errorCode = 0;
acsc_FRF_Stop(ch, 0, &errorCode);
4.47.3 acsc_FRF_CalculateMeasurementDuration
Description
This function calculates the required duration of measurement (DurationSec parameter of FRFInput
class) in order to satisfy the specified frequency resolution.
Syntax
int acacsc_FRF_CalculateMeasurementDuration(FRF_DURATION_CALCULATION_PARAMETERS
*params, double *duration, int *errorCode);
Arguments
Pointer to input
parameters for
FRF_DURATION_CALCULATION_PARAMETERS *
duration
calculation
Address at
which to write
double *duration
calculated
duration
Pointer to error
int*
code
Return Value
Returns int indicating function success or failure.
Example
int errorCode = 0;
double duration = 0;
FRF_DURATION_CALCULATION_PARAMETERS* input = new FRF_DURATION_
CALCULATION_PARAMETERS();
input->startFreqHz = 10;
input->endFreqHz = 1000;
input->freqPerDec = 100;
input->highResolutionStart = 500;
input->highResolutionFreqPerDec = 500;
input->frequencyDistributionType = FRF_FREQUENCY_DISTRIBUTION_TYPE::
Logarithmic;
input->frequencyHzResolutionForLinear = 0.1; // irrelevant if linear
frequency distribution selected
4.47.4 acsc_FRF_InitInput
Description
Initializes the inputParams structure of the “acsc_FRF_Measure” function to valid initial values.
Syntax
int acsc_FRF_InitInput(FRF_INPUT* inputParams, int* errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
FRF_INPUT inputParams;
acsc_FRF_InitInput(FRF_INPUT* inputParams, int* errorCode);
4.47.5 acsc_FRF_FreeOutput
Description
Releases memory allocated for “outputParams” during calling to “acsc_FRF_
CalculateMeasurementDuration”
Syntax
int acsc_FRF_FreeOutput(FRF_OUTPUT* inputParams, int* errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
4.47.6 acsc_FRF_ReadServoParameters
Description
The function reads all required servo parameters for calculation of Controller, OpenLoop, ClosedLoop
etc.
Syntax
int acsc_FRF_ReadServoParameters(HANDLE Handle, int axis, SERVO_PARAMETERS*
servoParameters, int* errorCode);
Arguments
Communications
Handle
Handle
Pointer to structure
SERVO_
to be filled with servo
PARAMETERS*
parameters
Return Value
Returns int indicating function success or failure.
Example
4.47.7 acsc_FRF_CalculateControllerFRD
Description
The function calculates controller FRD (Frequency Response Data) based on servo parameters,
servo loop and frequency vector.
Syntax
int acsc_FRF_CalculateControllerFRD(SERVO_PARAMETERS* servoParameters, FRF_LOOP_TYPE
loopType, double* frequencyHz, int frequencyLength, FRD **controllerFRD, int *errorCode);
Arguments
Return Value
FRD structure with calculation results
Example
HANDLE ch;
char* ip;
ip = (char*)"10.0.0.100";
ch = acsc_OpenCommEthernet(ip, 701);
SERVO_PARAMETERS* servoParameters = new SERVO_PARAMETERS();
int errorCode = 0, axis = 0;
acsc_FRF_ReadServoParameters(ch, axis, servoParameters, &errorCode);
int frequenciesLength = 3;
double* frequencies = new double[frequenciesLength] {100, 200, 300};
4.47.8 acsc_FRF_CalculateOpenLoopFRD
Description
This function calculates open loop FRD based on servo parameters, servo loop and frequency
vector.
Syntax
int acsc_FRF_CalculateOpenLoopFRD(SERVO_PARAMETERS* servoParameters, FRD* plant, FRF_
LOOP_TYPE loopType, FRD** openLoop, int* errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
Example:
// Example shows how open loop may be calculated based on measured plant
and controller with
// adjusted parameters
HANDLE ch;
char* ip;
ip = (char*)"10.0.0.100";
ch = acsc_OpenCommEthernet(ip, 701);
FRF_INPUT* input = new FRF_INPUT();
FRF_OUTPUT* output;
int errorCode = 0;
acsc_FRF_InitInput(input, &errorCode);
//Assign proper values for “input”
acsc_FRF_Measure(ch, input, &output, &errorCode);
ServoParameters servoParameters = Ch.FRFReadServoParameters((Axis)0);
double origSLVKP = servoParameters->SLVKP;
servoParameters->SLVKP = origSLVKP*1.1;
FRD* openLoop;
4.47.9 acsc_FRF_CalculateClosedLoopFRD
Description
This function calculates closed loop FRD based on servo parameters, servo loop and frequency
vector.
Syntax
int acsc_FRF_CalculateClosedLoopFRD(SERVO_PARAMETERS* servoParameters, FRD* plant, FRF_
LOOP_TYPE loopType, FRD** closedLoop, int* errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
HANDLE ch;
char* ip;
ip = (char*)"10.0.0.100";
ch = acsc_OpenCommEthernet(ip, 701);
FRF_INPUT* input = new FRF_INPUT();
FRF_OUTPUT* output;
int errorCode = 0;
acsc_FRF_InitInput(input, &errorCode);
//Assign proper values for “input”
acsc_FRF_Measure(ch, input, &output, &errorCode);
ServoParameters servoParameters = Ch.FRFReadServoParameters((Axis)0);
double origSLVKP = servoParameters->SLVKP;
servoParameters->SLVKP = origSLVKP*1.1;
FRD* closedLoop;
4.47.10 acsc_FRF_CalculateStabilityMargins
Description
The function calculates required stability margins based on the frequency response data of the open
loop.
Syntax
int acsc_FRF_CalculateStabilityMargins(FRD* openLoop, FRF_STABILITY_MARGINS** stabilityMargins,
int *errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
FRF_OUTPUT* output;
acsc_FRF_Measure(ch, input, &output, &errorCode);
SERVO_PARAMETERS* servoParameters;
int axis = 0;
acsc_FRF_ReadServoParameters(ch, axis, servoParameters, &errorCode);
double origSLVKP = servoParameters->SLVKP;
servoParameters->SLVKP = origSLVKP * 1.1;
FRD* openLoop;
acsc_FRF_CalculateOpenLoopFRD(servoParameters, output->plant, input-
>loopType, &openLoop, &errorCode);
FRF_STABILITY_MARGINS* stabilityMargins;
acsc_FRF_CalculateStabilityMargins(output->plant, &stabilityMargins,
&errorCode);
4.47.11 acsc_FRF_FreeFRD
Description
Frees memory allocated for FRD
Syntax
int acsc_FRF_FreeFRD(FRD* inputParams, int* errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
acsc_FRF_FreeOutput(output, &errorCode);
4.47.12 acsc_FRF_FreeStabilityMargins
Description
Function frees memory allocated for stability margins.
Syntax
int acsc_FRF_Stop(HANDLE Handle, int Axis, int* errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
acsc_FRF_FreeStabilityMargins(stabilityMargins, &errorCode);
4.47.13 acsc_FFT
Description
Function calculates fast Fourier transform.
Syntax
int acsc_FFT(double* in, double* outReal, double* outImag, int length, int* errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
4.47.14 acsc_JitterAnalysis
Description
Function executes jitter analysis.
Syntax
int _ACSCLIB_ WINAPI acsc_JitterAnalysis(JITTER_ANALYSIS_INPUT *in, JITTER_ANALYSIS_OUTPUT
**out, int *errorCode);
Arguments
Return Value
Returns int indicating function success or failure.
Example
jitterInput->desiredFrequencyResolutionHz = 1;
jitterInput->frequencyBandsHz = new double[6] {0, 100, 150, 300, 500,
1000};
jitterInput->frequencyBandsHzLength = 6;
jitterInput->jitter = new double[nmumberOfSamples];
for (int k = 0; k < nmumberOfSamples; k++)
jitterInput->jitter[k] = jitter[k] * EFAC;
jitterInput->jitterLength = nmumberOfSamples;
jitterInput->jitterFrequencyBandsCumulativeAmplitudeRMSthreshold = new
double[5] {1e-6, 2e-6, 1e-6, 2e-6, 1e-6};
jitterInput->samplingFrequencyHz = 20000;
jitterInput->windowType = FRF_WINDOW_TYPE::Hanning;
int errorCode = 0;
acsc_JitterAnalysis(jitterInput, &jitterOutput, &errorCode);
4.47.15 acsc_FRF_CrossCouplingMeasure
Description
This function executes cross-coupling effects measurement.
Syntax
Example
int axes[] = { 0, 1 };
input->axes = axes;
input->axesLength = 2;
input->startFreqHz = 10;
input->endFreqHz = 1000;
input->freqPerDec = 30;
input->frequencyDistributionType = FRF_FREQUENCY_DISTRIBUTION_
TYPE::Linear;
input->excitationAmplitudePercentIp = new double[2];
input->excitationAmplitudePercentIp[0] = 1;
input->excitationAmplitudePercentIp[1] = 1;
input->numberOfRepetitions = 3;
input->durationSec = 0.02;
input->highResolutionStart = 10000;
input->highResolutionFreqPerDec = 500;
input->crossCouplingType = FRF_CROSS_COUPLING_TYPE::CompleteOpen;
acsc_FRF_CrossCouplingMeasure(ch, inputCC, &output, &errorCode);
5. Error Codes
Any error code greater than 1000 is a controller error defined in the SPiiPlus Command &
Variable Reference Guide.
ACSC_
145 Function is not supported in current version.
FUNCTIONNOTSUPPORTED
ACSC_APPLICATION_NOT_
166 There is no Application with such Handle.
FOUND
ACSC_FRF_INPUT_START_
200 FRF - start frequency is out of range
FREQUENCY_OUT_OF_RANGE
ACSC_FRF_INPUT_END_
201 FRF - end frequency is out of range
FREQUENCY_OUT_OF_RANGE
ACSC_FRF_INPUT_START_
FRF - start frequency is above or equal to the
FREQUENCY_IS_HIGHER_ 202
end frequency
THAN_END_FREQUENCY
ACSC_FRF_INPUT_
FRF - linear frequency resolution is out of
FREQUENCY_RESOLUTION_ 205
range
LINEAR_OUT_OF_RANGE
ACSC_FRF_INPUT_
206 FRF - amplitude out of range
AMPLITUDE_OUT_OF_RANGE
ACSC_FRF_INPUT_AXIS_OUT_
207 FRF - axis is out of range
OF_RANGE
ACSC_FRF_INPUT_NUMBER_
OF_REPETITIONS_OUT_OF_ 208 FRF - number of repetitions is out of range
RANGE
ACSC_FRF_INPUT_DURATION_
209 FRF - duration is out of range
OUT_OF_RANGE
ACSC_FRF_INPUT_ENUM_OUT_
210 FRF - ENUM is out of range
OF_RANGE
ACSC_FRF_DATA_READ_
FROM_CONTROLLER_ 212 FRF - internal error. Data inconsistent
INCONSISTENT
ACSC_FRF_DSP_DOESNT_
HAVE_REQUIRED_ 213 FRF - dsp doesn't support frf measurement
PARAMETERS
ACSC_FRF_FAILED_TO_
COMMUNICATE_WITH_ 214 FRF - failed to communicate with controller
CONTROLLER
ACSC_FRF_DUMMY_AXIS_
216 FRF - dummy axis is not supported
NOT_SUPPORTED
ACSC_FRF_MOTOR_SHOULD_
217 FRF - motor should be set to closed loop
BE_SET_TO_CLOSED_LOOP
ACSC_FRF_MOTOR_SHOULD_
218 FRF - motor should be enabled
BE_ENABLED
ACSC_FRF_MOTOR_SHOULD_
219 FRF - motor should be commutated",
COMMUTATED
ACSC_FRF_DISABLE_OR_
FRF - disable or fault occured during
FAULT_OCCURED_DURING_ 223
measurement
MEASUREMENT
ACSC_FRF_FAULT_OCCURED_
224 FRF - fault occured during measurement
DURING_MEASUREMENT
ACSC_FRF_ARRAY_SIZES_
225 FRF - internal error, array size is incompatible
INCOMATIBLE
ACSC_FRF_MEMORY_
ALLOCATION_FAILED_AT_ 227 FRF - memory allocation failed at controller
CONTROLLER
ACSC_FRF_EXCITATION_
228 FRF - excitation duration is too long
DURATION_IS_TOO_LONG
ACSC_FRF_USER_DEFINED_
FRF - user defined excitation type required
EXCITATION_SIGNAL_ 229
but excitation signal was not available
REQUIRED_BUT_NOT_DEFINED
ACSC_FRF_USER_DEFINED_
FRF - user defined signal excitation values
EXCITATION_SIGNAL_OUT_OF_ 230
are out of range
BOUNDARIES
ACSC_FRF_FRD_LENGTH_TOO_
231 FRF - FRD length is too short
SHORT
ACSC_FRF_FRD_
FRF - FRD Frequencies should be
FREQUENCIES_SHOULD_BE_ 232
continuously increasing
CONTINUOUSLY_INCREASING
ACSC_JITTER_ANALYSIS_
233 Jitter array is too short
JITTER_ARRAY_TOO_SHORT
ACSC_JITTER_ANALYSIS_
SAMPLING_FREQUENCY_NOT_ 234 Jitter sampling freqeuncy is too low
VALID
ACSC_JITTER_ANALYSIS_
FWINDOW_TYPE_NOT_ 235 Jitter analysis window type is not supported
SUPPORTED
ACSC_JITTER_ANALYSIS_
FREQUENCY_RANGE_NOT_ 236 Jitter analysis frequency range is not valid
VALID
ACSC_JITTER_ANALYSIS_
Jitter analysis frequency resolution is not
FREQUENCY_RESOLUTION_ 237
valid
NOT_VALID
ACSC_LICENSE_COMMON_
238 Common license problem
PROBLEM
ACSC_LICENSE_DONGLE_NOT_
239 License dongle not found
FOUND
ACSC_LICENSE_ENTRY_NOT_
240 License entry not found
FOUND
ACSC_LICENSE_INVALID_
241 Invalid license handle
HANDLE
ACSC_LICENSE_NO_DATA_
242 No license data available
AVAILABLE
ACSC_SC_INCORRECT_
246 SPiiPlusSC - incorrect Memory Reservations
MEMORY1
6. Constants
This chapter presents the constants that are incorporated in the SPiiPlus C Library.
6.1 General
6.1.1 ACSC_SYNCHRONOUS
Description
Indicates a synchronous call.
Value
0
6.1.2 ACSC_INVALID
Description
Invalid communication handle.
Value
-1
6.1.3 ACSC_NONE
Description
Placeholder for redundant values, like the second index in a one-dimensional array.
Value
-1
6.1.4 ACSC_IGNORE
Description
Used for non-waiting calls with neglect of operation results.
Value
0xFFFFFFFF
6.1.5 ACSC_INT_TYPE
Description
Integer type of the variable.
Value
1
6.1.6 ACSC_STATIC_INT_TYPE
Description
Integer type of a static variable.
Value
3
6.1.7 ACSC_REAL_TYPE
Description
Real type of the variable.
Value
2
6.1.8 ACSC_STATIC_REAL_TYPE
Description
Real type of a static variable.
Value
4
6.1.9 ACSC_COUNTERCLOCKWISE
Description
Counterclockwise rotation.
Value
1
6.1.10 ACSC_CLOCKWISE
Description
Clockwise rotation.
Value
-1
6.1.11 ACSC_POSITIVE_DIRECTION
Description
A move in positive direction.
Value
1
6.1.12 ACSC_NEGATIVE_DIRECTION
Description
A move in negative direction.
Value
-1
6.2.2 ACSC_COMM_AUTORECOVER_HW_ERROR
Description
When a hardware error is detected in the communication channel and this bit is set, the library
automatically repeats the transaction without counting iterations. By default, this flag is not set.
Value
0x000000002
6.3.2 ACSC_SOCKET_STREAM_PORT
Description
The library opens Ethernet communication using the connection-oriented socket and TCP
communication protocol.
Value
701
ACSC_BUFFER_index
Where index is a number that ranges between 0 and 64, such as ACSC_BUFFER_0, ACSC_BUFFER_1,
ACSC_BUFFER_64, etc. The axis constant contains the value associated with the index, that is, ACSC_
BUFFER_0 has a value of 0, ACSC_BUFFER_1 has a value of 1, and so forth. ACSC_BUFFER_ALL stands
for all buffers.
6.7.2 ACSC_AMF_RELATIVE
Description
The value of the point coordinate is relative to the end point coordinate of the previous motion.
Value
0x00000002
6.7.3 ACSC_AMF_VELOCITY
Description
The motion uses the specified velocity instead of the default velocity.
Value
0x00000004
6.7.4 ACSC_AMF_ENDVELOCITY
Description
The motion comes to the end point with the specified velocity
Value
0x00000008
6.7.5 ACSC_AMF_POSITIONLOCK
Description
The slaved motion uses position lock. If the flag is not specified, velocity lock is used.
Value
0x00000010
6.7.6 ACSC_AMF_VELOCITYLOCK
Description
The slaved motion uses velocity lock.
Value
0x00000020
6.7.7 ACSC_AMF_CYCLIC
Description
The motion uses the point sequence as a cyclic array: after positioning to the last point it does
positioning to the first point and continues.
Value
0x00000100
6.7.8 ACSC_AMF_VARTIME
Description
The time interval between adjacent points of the spline (arbitrary path) motion is non-uniform and is
specified along with an each added point. If the flag is not specified, the interval is uniform.
Value
0x00000200
6.7.9 ACSC_AMF_CUBIC
Description
Use a cubic interpolation between the specified points (third-order spline) for the spline (arbitrary
path) motion. If the flag is not specified, linear interpolation is used (first-order spline).
Value
0x00000400
6.7.10 ACSC_AMF_EXTRAPOLATED
Description
Segmented slaved motion: if a master value travels beyond the specified path, the last or the first
segment is extrapolated.
Value
0x00001000
6.7.11 ACSC_AMF_STALLED
Description
Segmented slaved motion: if a master value travels beyond the specified path, the motion stalls at
the last or first point.
Value
0x00002000
6.7.12 ACSC_AMF_SYNCHRONOUS
Description
Position Event Generation (PEG): Start PEG synchronously with the motion sequence.
Value
0x00008000
6.7.13 ACSC_AMF_MAXIMUM
Description
Multi-axis motion does not use the motion parameters from the leading axis but calculates the
maximum allowed motion velocity, acceleration, deceleration and jerk of the involved axes.
Value
0x00004000
6.7.14 ACSC_AMF_JUNCTIONVELOCITY
Description
Decelerate to corner.
Value
0x00010000
6.7.15 ACSC_AMF_ANGLE
Description
Do not treat junction as a corner, if junction angle is less than or equal to the specified value in
radians.
Value
0x00020000
6.7.16 ACSC_AMF_USERVARIABLES
Description
Synchronize user variables with segment execution.
Value
0x00040000
6.7.17 ACSC_AMF_INVERT_OUTPUT
Description
Position Event Generation (PEG): The PEG pulse output is inverted.
Value
0x00080000
6.7.18 ACSC_AMF_CURVEVELOCITY
Description
Decelerate to curvature discontinuity point.
Value
0x00100000
6.7.19 ACSC_AMF_CORNERDEVIATION
Description
Use a corner rounding option with the specified permitted deviation.
Value
0x00200000
6.7.20 ACSC_AMF_CORNERRADIUS
Description
Use a corner rounding option with the specified permitted curvature.
Value
0x00400000
6.7.21 ACSC_AMF_CORNERLENGTH
Description
Use automatic corner rounding option.
Value
0x00800000
6.7.22 ACSC_AMF_DWELLTIME
Description
Dwell time between segments.
Value
0x00100000
6.7.23 ACSC_AMF_BSEGTIME
Description
Segment time.
Value
0x00004000
6.7.24 ACSC_AMF_BSEGACC
Description
Segment acceleration time.
Value
0x00020000
6.7.25 ACSC_AMF_BSEGJERK
Description
Segment jerk time.
Value
0x00008000
6.7.26 ACSC_AMF_CURVEAUTO
Description
Automatic curve calculations
Value
0x01000000
6.7.27 ACSC_AMF_AXISLIMIT
Description
Axis velocity limitation enforcement
Value
0x00002000
6.8.2 ACSC_DCF_CYCLIC
Description
Cyclic data collection uses the collection array as a cyclic buffer and continues infinitely. When the
array is full, each new sample overwrites the oldest sample in the array.
Value
0x00000002
6.8.3 ACSC_DCF_SYNC
Description
Starts data collection synchronously to a motion. Data collection started with the ACSC_DCF_SYNC
flag is called axis data collection.
Value
0x00000004
6.8.4 ACSC_DCF_WAIT
Description
Creates synchronous data collection, but does not start until the acsc_Go function is called. This flag
can only be used with the ACSC_DCF_SYNC flag.
Value
0x00000008
6.9.2 ACSC_MST_INPOS
Description
Motor has reached a target position.
Value
0x00000010
6.9.3 ACSC_MST_MOVE
Description
Motor is moving.
Value
0x00000020
6.9.4 ACSC_MST_ACC
Description
Motor is accelerating.
Value
0x00000040
6.10.2 ACSC_AST_DC
Description
Axis data collection is in progress.
Value
0x00000002
6.10.3 ACSC_AST_PEG
Description
PEG for the specified axis is in progress.
Value
0x00000004
6.10.4 ACSC_AST_MOVE
Description
Axis is moving.
Value
0x00000020
6.10.5 ACSC_AST_ACC
Description
Axis is accelerating.
Value
0x00000040
6.10.6 ACSC_AST_DECOMPON
Description
Dynamic error compensation is active
Value
0x04000000
6.10.7 ACSC_AST_SEGMENT
Description
Construction of segmented motion for the specified axis is in progress.
Value
0x00000080
6.10.8 ACSC_AST_VELLOCK
Description
Slave motion for the specified axis is synchronized to master in velocity lock mode.
Value
0x00000100
6.10.9 ACSC_AST_POSLOCK
Description
Slave motion for the specified axis is synchronized to master in position lock mode.
Value
0x00000200
6.11.2 ACSC_IST_IND2
Description
Secondary encoder index of the specified axis is latched.
Value
0x00000002
6.11.3 ACSC_IST_MARK
Description
MARK1 signal has been generated and position of the specified axis was latched.
Value
0x00000004
6.11.4 ACSC_IST_MARK2
Description
MARK2 signal has been generated and position of the specified axis was latched.
Value
0x00000008
6.12.2 ACSC_PST_RUN
Description
Program in the specified buffer is running.
Value
0x00000002
6.12.3 ACSC_PST_SUSPEND
Description
Program in the specified buffer is suspended after the step execution or due to breakpoint in debug
mode.
Value
0x00000004
6.12.4 ACSC_PST_DEBUG
Description
Program in the specified buffer is executed in debug mode, i.e. breakpoints are active.
Value
0x00000020
6.12.5 ACSC_PST_AUTO
Description
Auto routine in the specified buffer is running.
Value
0x00000080
6.13.2 ACSC_SAFETY_LL
Description
Motor fault - Hardware Left Limit
Value
0x00000002
6.13.3 ACSC_SAFETY_NETWORK
Description
Network error.
Value
4
6.13.4 ACSC_SAFETY_HOT
Description
Motor fault - Motor Overheat
Value
0x00000010
6.13.5 ACSC_SAFETY_SRL
Description
Motor fault - Software Right Limit
Value
0x00000020
6.13.6 ACSC_SAFETY_SLL
Description
Motor fault - Software Left Limit
Value
0x00000040
6.13.7 ACSC_SAFETY_ENCNC
Description
Motor fault - Primary Encoder Not Connected
Value
0x00000080
6.13.8 ACSC_SAFETY_ENC2NC
Description
Motor fault - Secondary Encoder Not Connected
Value
0x00000100
6.13.9 ACSC_SAFETY_DRIVE
Description
Motor fault - Driver Alarm
Value
0x00000200
6.13.10 ACSC_SAFETY_ENC
Description
Motor fault - Primary Encoder Error
Value
0x00000400
6.13.11 ACSC_SAFETY_ENC2
Description
Motor fault - Secondary Encoder Error
Value
0x00000800
6.13.12 ACSC_SAFETY_PE
Description
Motor fault - Position Error
Value
0x00001000
6.13.13 ACSC_SAFETY_CPE
Description
Motor fault - Critical Position Error
Value
0x00002000
6.13.14 ACSC_SAFETY_VL
Description
Motor fault - Velocity Limit
Value
0x00004000
6.13.15 ACSC_SAFETY_AL
Description
Motor fault - Acceleration Limit
Value
0x00008000
6.13.16 ACSC_SAFETY_CL
Description
Motor fault - Current Limit
Value
0x00010000
6.13.17 ACSC_SAFETY_SP
Description
Motor fault - Servo Processor Alarm
Value
0x00020000
6.13.18 ACSC_SAFETY_PROG
Description
System fault - Program Error
Value
0x02000000
6.13.19 ACSC_SAFETY_MEM
Description
System fault - Memory Overflow
Value
0x04000000
6.13.20 ACSC_SAFETY_TIME
Description
System fault - MPU Overuse
Value
0x08000000
6.13.21 ACSC_SAFETY_ES
Description
System fault - Hardware Emergency Stop
Value
0x10000000
6.13.22 ACSC_SAFETY_INT
Description
System fault - Servo Interrupt
Value
0x20000000
6.13.23 ACSC_SAFETY_INTGR
Description
System fault - File Integrity
Value
0x40000000
See the SPiiPlus ACSPL+ Command & Variable Reference Guide for detailed explanations
of faults
6.14.2.2 ACSC_INTR_LOGICAL_MOTION_END
Description
Logical motion has finished.
Value
17
6.14.2.3 ACSC_INTR_MOTION_FAILURE
Description
Motion has been interrupted due to a fault.
Value
18
6.14.2.4 ACSC_INTR_MOTOR_FAILURE
Description
Motor has been disabled due to a fault.
Value
19
6.14.2.5 ACSC_INTR_PROGRAM_END
Description
ACSPL+ program has finished.
Value
20
6.14.2.6 ACSC_INTR_ACSPL_PROGRAM_EX
Description
ACSPL+ program has generated the interrupt by INTERRUPTEX command.
Value
21
6.14.2.7 ACSC_INTR_ACSPL_PROGRAM
Description
ACSPL+ program has generated the interrupt by INTERRUPT command.
Value
22
6.14.2.8 ACSC_INTR_MOTION_START
Description
Motion Starts
Value
24
6.14.2.9 ACSC_INTR_MOTION_PHASE_CHANGE
Description
Motion Profile Phase changes
Value
25
6.14.2.10 ACSC_INTR_TRIGGER
Description
AST.#TRIGGER bit goes high
Value
26
6.14.2.11 ACSC_INTR_NEWSEGM
Description
AST.#NEWSEGM bit goes high.
Value
27
6.14.2.12 ACSC_INTR_SYSTEM_ERROR
Description
System error has occurred.
Value
28
6.14.2.13 ACSC_INTR_ETHERCAT_ERROR
Description
EtherCAT error has occurred
Value
29
6.14.3.2 ACSC_INTR_SOFTWARE_ESTOP
Description
ACS EStop button was clicked.
Value
33
ACSC_INTR_PHYSICAL_MOTION_END,
ACSC_MASK_AXIS_
0 ACSC_INTR_LOGICAL_MOTION_END,
0 Axis 0
ACSC_INTR_MOTION_FAILURE,
... ... ...
ACSC_INTR_MOTION_START,
ACSC_MASK_AXIS_ Axis 63
63 ACSC_INTR_MOTION_PHASE_CHANGE,
63
ACSC_INTR_TRIGGER
ACSC_INTR_PHYSICAL_MOTION_END,
ACSC_MASK_AXIS_ 0 ACSC_INTR_LOGICAL_MOTION_END,
Axis 64
64 ACSC_INTR_MOTION_FAILURE,
... ...
ACSK_MASK_AXIS_ ACSC_INTR_MOTION_START,
63 Axis 127
127 ACSC_INTR_MOTION_PHASE_CHANGE,
ACSC_INTR_TRIGGER
ACSC_MASK_
BUFFER_0 0 ACSC_INTR_PROGRAM_END,
Buffer 0
... ... ... ACSC_INTR_COMMAND,
Buffer 63
ACSC_MASK_ 63 ACSC_INTR_ACSPL_PROGRAM
BUFFER_63
ACSC_CONF _INT_EDGE_
3 Sets the interrupt edge to be positive or negative.
KEY
ACSC_CONF _ENCODER_
4 Sets encoder type: A&B or analog.
KEY
ACSC_CONF_OUT_KEY 29 OUT0
PEG
Brake
ACSC_CONF _MFLAGS9_
204 Controls value of MFLAGS.9
KEY
ACSC_CONF_SP_OUT_
206 Reads SP output pins.
PINS_KEY
ACSC_CONF_BRAKE_OUT_
229 Controls brake function.
KEY
ACSC_SYS_NBUFFERS_
10 Number of regular ACSPL+ program buffers.
KEY
ACSC_SYS_DBUF_INDEX_
11 D-buffer index.
KEY
EtherCAT support:
ACSC_SYS_ECAT_KEY 16 1 - Yes
0 - No
6.17.2 ACSC_PFLAGS_NOEDIT
Description
Protect from Editing
Value
0x00000002
6.17.3 ACSC_PFLAGS_NOEDIT2
Description
Protect from Editing, secondary level
Value
0x00000080
6.17.4 ACSC_PFLAGS_JIT
Description
JIT Buffer
Value
0x00000008
6.17.5 ACSC_PFLAGS_PRIVLG
Description
Privileged Buffer
Value
0x00000010
6.17.6 ACSC_PFLAGS_DEBUG
Description
Debug Mode (Enable Breakpoints)
Value
0x00000020
6.17.7 ACSC_PFLAGS_NOVIEW2
Description
Protect from Viewing, secondary level
Value
0x00000100
6.17.8 ACSC_PFLAGS_PRIVLG2
Description
Privileged Buffer, secondary level
Value
0x00000200
6.18.1 ACSC_S_SETUP_ENHPROT
Description
Allow Enhanced Application Protection
Value
0x00000010
6.18.2 ACSC_S_SETUP_CONFPROT
Description
Allow System Reconfiguration In Protected Mode
Value
0x00000020
6.18.3 ACSC_S_SETUP_BUFPROT
Description
Allow Only Buffer Protection
Value
0x00020000
6.18.4 ACSC_S_SETUP_VARPROT
Description
Allow Only Variable Protection
Value
0x00040000
6.18.5 ACSC_S_SETUP_BUFPROT2
Description
Secondary Buffer Protection Activation
Value
0x01000000
7. Structures
This chapter details the structures that are available for SPiiPlus C programming.
7.1 ACSC_WAITBLOCK
Description
The structure is used for non-waiting calls of the SPiiPlus C functions.
Syntax
struct
{
HANDLE Event;
int Ret;
} ACSC_WAITBLOCK;
Arguments
Comments
To initiate a non-waiting call the user thread declares the ACSC_WAITBLOCK structure and passes the
pointer to this structure to SPiiPlus C function as parameter. 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 buffer. The calling thread can retrieve the
response with help of the acsc_WaitForAsyncCall function and validate the Ret.
The error codes stored in Ret are the same that the acsc_GetLastError function returns.
7.2 ACSC_PCI_SLOT
Description
The structure defines a physical location of PCI card. This structure is used in the acsc_GetPCICards
function and contains the information about detected PCI card.
Syntax
struct
{
unsigned int BusNumber;
unsigned int SlotNumber;
unsigned int Function;
} ACSC_PCI_SLOT;
Arguments
Comments
The SlotNumber can be used in the acsc_OpenCommPCI call in order to open communication with a
specific card. Other members have no use in SPiiPlus C Library.
7.3 ACSC_HISTORYBUFFER
Description
The structure defines a state of the history and message buffers. This structure is used by the acsc_
OpenHistoryBuffer and acsc_OpenMessageBuffer functions.
Syntax
struct
{
int Max;
int Cur;
int Ring;
char* Buf
} ACSC_HISTORYBUFFER;
Arguments
Comments
Max is equal to the requested Size and never changes its value.
Cur is a number of bytes currently stored in the buffer. From the beginning, Cur is zero, then grows
up to Max, and then remains unchanged.
Ring is a circular index in the buffer: if the buffer is full, the most recent byte is stored in position
Ring-1, the earliest byte is stored in position Ring.
The user program must never change the members in the structure or write to the history buffer.
However, the user program can read the structure and the buffer directly. If doing so, the user
should be aware that the library includes a separate thread that watches the replies from the
controller. For this reason the contents of the buffer and structure members can change
asynchronously to the user thread.
7.4 ACSC_CONNECTION_DESC
Description
The structure defines controller connection for an application. Used in the acsc_GetConnectionsList
and acsc_TerminateConnection functions.
Syntax
struct
{
char Application[100];
HANDLE Handle;
DWORD ProcessId
} ACSC_CONNECTION_DESC;
Arguments
7.5 ACSC_CONNECTION_INFO
Description
The structure provides information about specified controller connection for an application. Used in
the acsc_GetConnectionInfo function.
Syntax
struct
{
ACSC_CONNECTION_TYPE Type;
int SerialPort;
int SerialBaudRate;
int PCISlot;
int EthernetProtocol;
char EthernetIP[100];
int EthernetPort;
} ACSC_CONNECTION_INFO;
Arguments
7.6 AXMASK_EXT
Description
The structure is used in functions supporting 128 axes.
Syntax
Related Functions
acsc_InstallCallbackExt, acsc_SetCallbackMaskExt,
7.7.1 ACSC_APPSL_STRING
Description
The structure defines a string in the application file.
Syntax
struct
{
int length;
char *string
} ACSC_APPSL_STRING;
Arguments
7.7.2 ACSC_APPSL_SECTION
Description
The structure defines the application section to be loaded or saved.
Syntax
struct
{
ACSC_APPSL_FILETYPE type;
ACSC_APPSL_STRING filename;
ACSC_APPSL_STRING description;
int size;
int offset;
int CRC;
int inuse;
int error;
char *data
} ACSC_APPSL_SECTION;
Arguments
0 - Not in use.
inuse
1 - In use.
7.7.3 ACSC_APPSL_ATTRIBUTE
Description
The structure defines an attribute key-value pair.
Syntax
struct
{
ACSC_APPSL_STRING key;
ACSC_APPSL_STRING value
} ACSC_APPSL_ATTRIBUTE;
Arguments
7.7.4 ACSC_APPSL_INFO
Description
The structure defines an application file structure, including the header, attributes and file sections.
Syntax
struct
{
ACSC_APPSL_STRING filename;
ACSC_APPSL_STRING description;
int isNewFile;
int ErrCode;
int attributes_num;
ACSC_APPSL_ATTRIBUTE *attributes;
int sections_num;
ACSC_APPSL_SECTION *sections;
} ACSC_APPSL_INFO;
Arguments
1 - File is new.
isNewFile
0 - File exists and has been modified.
Syntax
struct
{
int axis;
loopType FRF_LOOP_TYPE ;
excitationType FRF_EXCITATION_TYPE;
FRF_CHIRP_TYPE chirpType;
windowType FRF_WINDOW_TYPE;
overlap FRF_OVERLAP;
FrequencyDistributionType FRF_FREQUENCY_DISTRIBUTION_TYPE;
double startFreqHz;
double endFreqHz;
int freqPerDec;
double highResolutionStart;
int highResolutionFreqPerDec;
double excitationAmplitudePercentIp;
double durationSec;
int numberOfRepetitions;
double *userDefinedExcitationSignal
int userDefinedExcitationSignalLength;
double *inRaw;
double *outRaw;
int lengthRaw;
bool recalculate;
} FRF_INPUT;
Arguments
7.8.2 FRF_OUTPUT
Description
The structure holds data returned by the FRF.
Syntax
struct
{
FRD* plant;
FRD* controller;
FRD* openLoop;
FRD* closedLoop;
FRD* sensitivity;
FRD* coherence;
FRF_LOOP_TYPE loopType;
FRF_STABILITY_MARGINS* stabilityMargins;
double excitationAmplitude;
double* inRaw;
double* outRaw;
int lengthRaw;
} FRF_OUTPUT;
Arguments
7.8.3 FRF_DURATION_CALCULATION_PARAMETERS
Description
The structure contains the results of the duration calculation.
Syntax
struct
{
double startFreqHz;
double endFreqHz;
int freqPerDec;
double highResolutionStart;
int highResolutionFreqPerDec;
FRF_FREQUENCY_DISTRIBUTION_TYPE FrequencyDistributionType;
int frequencyHzResolutionForLinear;
} FRF_DURATION_CALCULATION_PARAMETERS;
Arguments
Defines number of
frequencies per decade for
high resolution range. High
resolution feature is active
only if highResolutionStart
int highResolutionFreqPerDec is within (startFreqHz-
endFreqHz) range
*Ignored if frequency
distribution type is set to
Linear
Describes distribution of
FRF_FREQUENCY_ points of the resulted Plant.
DISTRIBUTION_ FrequencyDistributionType *Ignored if frequency
TYPE distribution type is set to
Linear
7.8.4 FRD
Description
The structure holds FRD data.
Syntax
struct
{
double* real;
double* imag;
double* frequencyHz;
size_t length;
} FRD;
Arguments
7.8.5 FRF_STABILITY_MARGINS
Description
The structure .
Syntax
struct
{
double* gainMarginArray;
double* gainMarginArrayFrequencyHz;
size_t gainMarginArrayLength;
double gainMarginWorst;
double gainMarginWorstFrequencyHz;
double* phaseMarginArray;
double* phaseMarginArrayFrequencyHz;
size_t phaseMarginArrayLength;
double phaseMarginWorst;
double phaseMarginWorstFrequencyHz;
double modulusMargin;
double modulusMarginFrequencyHz;
double bandwidth;
} FRF_STABILITY_MARGINS;
Arguments
7.8.6 JITTER_ANALYSIS_INPUT
Description
The structure holds input values for jitter analysis.
Syntax
struct
{
double* jitter;
size_t jitterLength;
size_t samplingFrequencyHz;
double desiredFrequencyResolutionHz;
double* frequencyBandsHz;
size_t frequencyBandsHzLength;
double jitterFrequencyBandsCumulativeAmplitudeRMSthreshold;
FRF_WINDOW_TYPE windowType;
} JITTER_ANALYSIS_INPUT;
Arguments
Sampling frequency of
size_t samplingFrequencyHz
jitter signal
Desired frequency
resolution of the jitter
double desiredFrequencyResolutionHz
analysis result in
frequency domain
Length of the
size_t frequencyBandsHzLength frequencyBandsHz
array
7.8.7 JITTER_ANALYSIS_OUTPUT
Description
The structure holds the results of the jitter analysis.
Syntax
struct
{
double* jitterAmplitudeRMS;
double* jitterCumulativeAmplitudeRMS;
double* frequencyHz;
size_t frequencyLength;
double* jitterFrequencyBandsCumulativeAmplitudeRMS;
double* frequencyBandsHz;
size_t frequencyBandsHzLength;
int jitterFrequencyBandsResultBool;
double jitterRMS;
double jitterAmplitudePeak2Peak;
} JITTER_ANALYSIS_OUTPUT;
Arguments
doubl jitterAmplitudeRMS
frequencyHz
e* and
jitterCumulativeAmplitudeRMS
Length of frequencyHz,
size_t frequencyLength jitterAmplitudeRMS and
jitterCumulativeAmplitudeRMS
7.8.8 SERVO_PARAMETERS
Description
The structure holds the axis servo parameters read from the controller.
Syntax
struct
{
double SLIKP;
double SLIKP;
double SLILI;
double SLPKP;
double SLPKI;
double SLPLI;
double SLVKP;
double SLVKI;
double SLVLI;
double SLVSOF;
double SLVSOFD;
double SLVNFRQ;
double SLVNWID;
double SLVNATT;
double SLVB0NF;
double SLVB0DF;
double SLVB0ND;
double SLVB0DD;
double SLVB1NF;
double SLVB1DF;
double SLVB1ND;
double SLVB1DD;
double XVEL;
double EFAC;
double SLVRAT;
double SLAFF;
INT32 MFLAGS;
INT32 MFLAGSX;
} SERVO_PARAMETERS;
Arguments
7.8.9 FRF_CROSS_COUPLING_INPUT
Description
Sets the input parameters for measurement of cross-coupling effects.
axes Int * Not defined Axes involved in the cross coupling measurement.
Hanning
FRF_WINDOW_ Defines the window type for filtering the signals before
windowType Hamming
TYPE computing the FFT
Rectangular
startFreqHz double 30, 1-5000 Defines start frequency of the resulting plant in Hz
endFreqHz double 3000, 1-5000 Defines end frequency of the resulting plant in Hz
7.8.10 FRF_CROSS_COUPLING_OUTPUT
Description
Reads the results of measurement of cross-coupling effects for use in FRF calculations.
FRD*
plant Measured frequency response data (FRD) of the Plant matrix
FRD* Calculated FRD of the controller matrix. Calculation is based on standard servo parameters
controller available in SERVO_PARAMETERS structure. Only the main diagonal has valid controller
frequency response. Rest is euther zero or NULL.
characteristicPolynomial FRD Calculated FRD of the characteristic polynomial based on plant and controller FRD’s
closedLoop FRD* Calculated FRD of the ClosedLoop matrix based on plant and controller FRD’s.
Measured FRD of the coherence amplitude of the precess sensitivity matrix. Imaginary part of
coherencePS FRD*
the coherence amplitude is 0
Measured FRD of the coherence amplitude of the sensitivity matrix. Imaginary part of the
coherencePS FRD*
coherence amplitude is 0
FRF_LOOP_
crossCouplingType Determines the cross coupling measurement type
TYPE
FRF_
stabilityMargins STABILITY_ Stability margins calculated based on characteristic polynomial frequency respose
MARGINS*
8. Enums
This chapter details the enums that are available for SPiiPlus C programming.
8.1 ACSC_LOG_DETALIZATION_LEVEL
Description
This enum is used for setting log file parameters in the acsc_SetLogFileOptions function.
Syntax
typedef enum
{
Minimum,
Medium,
Maximum,
} ACSC_LOG_DETALIZATION_LEVEL;
Arguments
8.2 ACSC_LOG_DATA_PRESENTATION
Description
This enum is used for setting log file parameters in the acsc_SetLogFileOptions function.
Syntax
typedef enum
{
Compact,
Formatted,
Full
} ACSC_LOG_DATA_PRESENTATION;
Arguments
Value 0: No more than the first ten bytes of the data strings will be logged.
Compact
Non-printing characters will be represented in Hex ASCII code.
Value 1: All the binary data will be logged. Non-printing characters will be
Formatted
represented in Hex ASCII code.
8.3 ACSC_APPSL_FILETYPE
Description
This enum is used by Application Load/Save functions for defining the application file type.
Syntax
typedef enum
{
ACSC_ADJ,
ACSC_SP,
ACSC_ACSPL,
ACSC_PAR,
ACSC_USER
} ACSC_APPSL_FILETYPE;
Arguments
8.4 ACSC_CONNECTION_TYPE
Description
This enum is used for setting communication type. Used in the acsc_GetConnectionInfo function
Syntax
typedef enum
{
ACSC_NOT_CONNECTED = 0,
ACSC_SERIAL = 1,
ACSC_PCI = 2,
ACSC_ETHERNET = 3,
ACSC_DIRECT = 4
} ACSC_CONNECTION_TYPE;
Arguments
8.5 FRF_LOOP_TYPE
Description
Enumerates supported FRF loop types.
Syntax
typedef enum {
PositionVelocity,
Position,
Velocity,
Current,
Open
} FRF_LOOP_TYPE;
Arguments
8.6 FRF_EXCITATION_TYPE
Description
Enumerates supported methods for distributing frequency points.
Syntax
typedef enum
{
Linear,
Logarithmic
} FRF_EXCITATION_TYPE;
Arguments
8.7 FRF_CHIRP_TYPE
Description
Enumerates types of chirp input supported.
Syntax
typedef enum
{
LogarithmicChirp,
LinearChirp
} FRF_CHIRP_TYPE;
Arguments
8.8 FRF_OVERLAP
Description
Enumerates the options for signal overlapping.
Syntax
typedef enum
{
NoOverlap,
HalfSignal,
}FRF_OVERLAP;
Arguments
8.9 FRF_CROSS_COUPLING_TYPE
Description
Determines whether measurement of cross coupling is in closed or open loop configuration.
Syntax
typedef enum
{
Complete,
CompleteOpen
} FRF_CROSS_COUPLING_TYPE;
Arguments
9. Sample Programs
The following samples demonstrate the usage of the SPiiPlus C Library functions. The examples
show how to write the C/C++ applications that can communicate with the SPiiPlus controller.
The samples open the communication with the controller or the simulator and perform some simple
tasks, like starting of a point-to-point motion, reading a motor feedback position, downloading an
ACSPL+ program to the controller program buffer, etc.
After installation of the package in the SPiiPlus C Library directory, the full source code of these
samples with the projects for Visual C++ 6 and Visual Studio 2005 can be found.
9.1.1 ACSPL+
The sample shows how to open communication with the simulator or with the controller (via serial,
ethernet or PCI Bus), how to download the ACSPL+ program to controller's buffer, and how to
execute it. The ACSPL+ program executes a reciprocated point-to-point motion.
File ACSPL.CPP:
#include <conio.h>
#include <stdio.h>
#include "windows.h"
#include "C:\Program Files\ACS Motion Control\SPiiPlus 6.70\ACSC\C_
CPP\acsc.h"
HANDLE hComm;// communication handle
void ErrorsHandler(const char* ErrorMessage, BOOL fCloseComm)
{
printf (ErrorMessage);
printf ("press any key to exit.\n");
if (fCloseComm) acsc_CloseComm(hComm);
{
_getch();
};
int main(int argc, char *argv[])
{
double FPOS;
// ACSPL+ program which we download to controller's buffer
// The program performs a reciprocated motion from position 0 to 4000
// and then back
char* prog = " enable X \r\n\
St: \r\n\
ptp 0, 4000 \r\n\
ptp 0, 0 \r\n\
goto St \r\n\
stop \r\n";
printf ("ACS Motion Control Copyright (C) 2011. All Rights \
Reserved.\n");
printf ("Application executes reciprocated point-to-point motion\n");
/*****************************************************************/
// Open communication with simulator
printf ("Application opens communication with the simulator, \
downloads\n");
printf ("program to controller's and executes it using SPiiPlus C Library
\
functions\n\n");
printf ("Wait for opening of communication with the simulator...\n");
hComm = acsc_OpenCommSimulator();
if (hComm == ACSC_INVALID)
{
ErrorsHandler("error while opening communication.\n", FALSE);
return -1;
}
printf ("Communication with the simulator was established \
successfully!\n");
/*****************************************************************/
/********************************************************************
// Example of opening communication with the controller via COM1
printf ("Application opens communication with the controller via \
COM1, downloads\n");
printf ("program to the controller and executes it using SPiiPlus C \
Library functions\n\n");
printf ("Wait for opening of communication with the \
controller...\n");
hComm = acsc_OpenCommSerial(1, 115200);
if (hComm == ACSC_INVALID)
{
ErrorsHandler("error while opening communication.\n", FALSE);
return -1;
}
printf ("Communication with the controller was established \
successfully!\n");
/*****************************************************************/
/********************************************************************
// Example of opening communication with the controller via COM1
printf ("Application opens communication with the controller via \
COM1, downloads\n");
printf ("program to the controller and executes it using SPiiPlus C \
Library functions\n\n");
printf ("Wait for opening of communication with the \
controller...\n");
hComm = acsc_OpenCommSerial(1, 115200);
if (hComm == ACSC_INVALID)
{
{
ErrorsHandler("stop program error.\n", TRUE);
return -1;
}
// Download the new program to the controller's buffer
if (!acsc_LoadBuffer(hComm, 0, prog, strlen(prog), NULL))
{
ErrorsHandler("downloading program error.\n", TRUE);
return -1;
}
printf ("Program downloaded\n");
// Execute the program in the buffer 0
if (!acsc_RunBuffer(hComm, 0, NULL, NULL))
{
ErrorsHandler("run program error.\n", TRUE);
return -1;
}
printf ("Motion is in progress...\n");
printf ("Feedback position:\n");
while (!_kbhit())
{
// read the feedback position of axis 0
if (acsc_GetFPosition(hComm, ACSC_AXIS_0, &FPOS, NULL))
{
printf ("%f\r", FPOS);
}
Sleep(500);
}
// Stop the program in the buffer 0
if (!acsc_StopBuffer(hComm, 0, NULL))
{
ErrorsHandler("stop program error.\n", TRUE);
return -1;
}
// Close the communication
acsc_CloseComm(hComm);
return 0;
}
9.1.2 Immediate
The sample shows how to open communication with the Simulator or with the controller (via serial,
ethernet or PCI Bus) and how to execute a reciprocated point-to-point motion only by calling
appropriate SPiiPlus C functions without any ACSPL+ program.
File IMMEDIATE.CPP:
#include <conio.h>
#include <stdio.h>
#include "windows.h"
#include "C:\Program Files\ACS Motion Control\SPiiPlus 6.70\ACSC\C_
CPP\acsc.h"
HANDLE hComm; // communication handle
void ErrorsHandler(const char* ErrorMessage, BOOL fCloseComm)
{
printf (ErrorMessage);
printf ("press any key to exit.\n");
if (fCloseComm) acsc_CloseComm(hComm);
_getch();
};
int main(int argc, char *argv[])
{
double FPOS;
int State;
printf ("ACS Motion Control. Copyright (C) 2011. All Rights \
Reserved.\n");
printf ("Application executes reciprocated point-to-point
motion\n");
/*****************************************************************/
// Open communication with the simulator
printf ("Application opens communication with the simulator and\n");
printf ("sends some commands to the simulator using SPiiPlus C Library \
functions\n\n");
printf ("Wait for opening of communication with the simulator...\n");
hComm = acsc_OpenCommSimulator();
if (hComm == ACSC_INVALID)
{
ErrorsHandler("error while opening communication.\n", FALSE);
return -1;
}
printf ("Communication with the simulator was established \
successfully!\n");
/*****************************************************************/
/******************************************************************
// Example of opening communication with the controller via COM1
printf ("Application opens communication with the controller via \
serial link and\n");
printf ("sends some commands to the controller using SPiiPlus C Library
\functions\n\n");
printf ("Wait for opening of communication with the \
controller...\n");
hComm = acsc_OpenCommSerial(1, 115200);
if (hComm == ACSC_INVALID)
{
ErrorsHandler("error while opening communication.\n", FALSE);
return -1;
}
printf ("Communication with the controller was established \
successfully!\n");
/*****************************************************************/
/******************************************************************