![Galil DMC-4040 Скачать руководство пользователя страница 76](http://html1.mh-extra.com/html/galil/dmc-4040/dmc-4040_user-manual_3282915076.webp)
Galil Communications API with C/C++
Galil recommends the GalilTools Communication Library for all new applications.
When programming in C/C++, the communications API can be used as included functions or through a class library.
All Galil communications programs written in C must include the DMCCOM.H file and access the API functions
through the declared routine calls. C++ programs can use the DMCCOM.H routines or use the class library defined
in DMCWIN.H.
After installing DMCWin into the default directory, the DMCCOM.H header file is located in C:\Program
Files\Galil\DMCWIN\INCLUDE. C++ programs that use the class library need the files DMCWIN.H and
DMCWIN.CPP, which contain the class definitions and implementations respectively. These can be found in the C:\
ProgramFiles\Galil\DMCWIN\CPP directory.
To link the application with the DLL’s, the DMC32.lib file must be included in the project and is located at
C:\Program Files\Galil\DMCWIN\LIB
Example: A simple console application that sends commands to the controller
To initiate communication, declare a variable of type HANDLEDMC (a long integer) and pass the address of that
variable in the DMCOpen() function. If the DMCOpen() function is successful, the variable will contain the handle
to the Galil controller, which is required for all subsequent function calls. The following simple example program
written as a Visual C console application tells the controller to move the X axis 1000 encoder counts. Remember to
add DMC32.LIB to your project prior to compiling.
#include <windows.h>
#include <dmccom.h>
long lRetCode;
HANDLEDMC hDmc;
HWND hWnd;
int main(void)
{
// Connect to controller number 1
lRetCode= DMCOpen(1, hWnd, &hDmc);
if (rc == DMCNOERROR)
{
char szBuffer[64];
// Move the X axis 1000 counts
lRetCode = DMCCommand(hDmc, "PR1000;BGX;", szBuffer,
sizeof(szBuffer));
// Disconnect from controller number 1 as the last action
lRetCode = DMCClose(hDmc);
}
return 0;
}
Galil Communications API with Visual Basic
Declare Functions
Galil recommends the GalilTools Communication Library for all new applications.
To use the Galil communications API functions, add the module file included in the
C:\ProgramFiles\Galil\DMCWIN\VB directory named DMCCOM40.BAS. This module declares the routines
making them available for the VB project. To add this file, select ‘Add Module’ from the ‘Project’ menu in VB5/6.
Chapter 4 Software Tools and Communication
•
67
DMC-40x0 User Manual
Содержание DMC-4040
Страница 17: ...DMC 4080 Layout Figure 2 2 Outline of the of the DMC 4080 DMC 40x0 User Manual Chapter 2 Getting Started 8...
Страница 19: ...DMC 4040 Dimensions Figure 2 5 Dimensions of DMC 4040 DMC 40x0 User Manual Chapter 2 Getting Started 10...
Страница 20: ...DMC 4080 Dimensions Figure 2 6 Dimensions of DMC 4080 Chapter 2 Getting Started 11 DMC 40x0 User Manual...
Страница 54: ...Chapter 3 Connecting Hardware 45 DMC 40x0 User Manual...
Страница 55: ...DMC 40x0 User Manual Chapter 3 Connecting Hardware 46...
Страница 56: ...Chapter 3 Connecting Hardware 47 DMC 40x0 User Manual...
Страница 73: ...Figure 4 1 GalilTools DMC 40x0 User Manual Chapter 4 Software Tools and Communication 64...
Страница 185: ...THIS PAGE LEFT BLANK INTENTIONALLY DMC 40x0 User Manual Chapter 7 Application Programming 176...
Страница 205: ...THIS PAGE LEFT BLANK INTENTIONALLY DMC 40x0 User Manual Chapter 10 Theory of Operation 196...
Страница 220: ...Step 2 Remove ICM For DMC 4040 Proceed to Step 3 Configure Circuit Appendices 211 DMC 40x0 User Manual...
Страница 222: ...Step 2 Remove ICM s Appendices 213 DMC 40x0 User Manual...
Страница 232: ...DMC 4080 Steps 4 and 5 Step 4 Replace ICM s Appendices 223 DMC 40x0 User Manual...