110 likes | 527 Views
SPiiPlus Training Class. Host Programming. Host Programming Overview. ACS provides a C library and COM library for programming host applications in Windows C Library: Can be used with C / C++ programs (unmanaged)
E N D
SPiiPlus Training Class Host Programming
Host Programming Overview • ACS provides a C library and COM library for programming host applications in Windows • C Library: • Can be used with C / C++ programs (unmanaged) • Uses remote procedure calls to the user-mode driver to communicate with the controller • COM Library: • Can be used with any .NET language and LabView • Wrapper of the C library
Host Programming Overview PC COM Application COM Library C / C++ Application C Library User Mode Driver Controller
Host Programming Features • Most Windows version support • C & COM library support same functions/methods • Supports multiple threads • Unified support for all communication channels (Serial, Ethernet) • A rich set of C/COM library functions/methods that are also supported by SPiiPlus Controller Simulator • Concurrent support for up to 10 communication channels in one application • Acknowledgement for each command sent to the controller • Communication history/log • Separate processing of unsolicited messages
Host Programming Features • SPiiPlus C Library Features: • Waiting (synchronous) or Non-waiting (asynchronous) calls • Callback functions for predefined controller events • SPiiPlus COM Library Features: • Generates COM events for predefined controller events • Supports a COM error object to provide rich error information • Automation support for VBScript, Internet Explorer, Excel, Word and other environments
Host Library Features • Communication & Communication Services • ACSPL+ Program Management • Read & Write Variables / Variable Management • Multiple Thread Synchronization • History & Unsolicited Messages Buffer Management • System Configuration • Setting & Reading Motion Parameters • Axis/Motor Management & Status • Motion Management • Multiple Motion Types • Data Collection • Input/Output Status • Safety Control • Wait-for-Condition • Callback & Event Handling • Error Diagnosis
SPiiPlus C/COM Library Examples • Examples included with SPiiPlus NT Suite v2.10: • SPiiPlus C Library Examples • Visual C++ • Reciprocated_VS2008 • Terminal_VS2008 • SPiiPlus COM Library Examples • .NET • COM Library Demo VS2005 • Enable Event VS2005 • Enable Event VS2008 • ReadWriteVariable VS2005 • ReadWriteVariable VS2008 • LabVIEW 7.X/8.X • CheckError • COM Library Demo • Enable Event • PROGRAMEND Callback • ReadWriteVariable • VBScript • COM Library Demo • Enable Event • ReadWriteVariable • Visual Basic • COM Library Demo VB6 • Enable Event VB6 • ReadWriteVariable VB6
Important Files / Programs • ACSCSRV.exe • User-mode driver for high-level communication support • Resides in User Mode Driver folder • ACSCL_x86.dll / ACSCL_x64.dll • Dynamic link libraries that contain API functions for C library • Resides in System32 Windows folder • ACSCL_x86.lib / ACSCL_x64.lib • Static LIB file required for a C / C++ project to access the DLLs • Resides in ACSC folder • ACSC.h • C header file with API function and constants declarations • Resides in ACSC folder • SPiiPlusCOM660_x86.dll / SPiiPlusCOM660_x64.dll • Resides in Common Files folder
Host Programming Example: 1 • Write a host application that connects to the Ethernet simulator, enables axis 1, does a point-to-point motion to 1000, and disconnects. • Connect to the Ethernet simulator with the MMI Application Studio and move axis 1 to position 0. Then open a watch window and monitor the feedback position (FPOS) • Run your host application.
Host Programming Example: 2 • Write a host application that connects to the Ethernet simulator, starts buffer 5 on line 1, waits for buffer 5 to finish, and reads the feedback position of axis 1 and displays it to the user. • Write an ACSPL+ program in buffer 5 that will enable axis 1, move the axis to position 1000, wait until the motion is complete, and then stop. • Run you your host application.