11 cout <<
"\n************************************************************************\n";
12 cout <<
"Example GInterrupt() usage\n";
13 cout <<
"************************************************************************\n";
20 bool ei_support =
true;
23 ei_support = (strstr(buf,
"IH") != 0);
28 cout <<
"No support on this bus\n";
52 if ((status & 0xF0) == 0xF0)
54 cout <<
"\"UI " << (int)(status & 0x0F) <<
"\" executed.\n";
58 cout <<
"Unexpected interrupt, " << hex << (int)status << dec <<
'\n';
59 return GALIL_EXAMPLE_ERROR;
67 x_e(
GCmdT(g,
"RP", buf,
sizeof(buf), &trimmed));
68 cout <<
"\nPosition: " << trimmed <<
'\n';
70 x_e(
GCmd(g,
"AC 1280000,1280000"));
71 x_e(
GCmd(g,
"DC 1280000,1280000"));
74 cout <<
"Beginning independent motion... ";
77 cout <<
"Motion Complete on A and B\n";
78 x_e(
GCmdT(g,
"RP", buf,
sizeof(buf), &trimmed));
79 cout <<
"Position: " << trimmed <<
'\n';;
82 return GALIL_EXAMPLE_OK;
90 unsigned char axis_mask = 0xFF;
92 int len = strlen(axes);
93 for (
int i = 0; i < len; i++)
124 sprintf(buf,
"EI %u", (
unsigned char) ~axis_mask);
127 while (axis_mask != 0xFF)
GCLIB_DLL_EXPORTED GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response, GSize response_len, GCStringOut *front)
Wrapper around GCommand that trims the response.
GCLIB_DLL_EXPORTED GReturn GCALL GTimeout(GCon g, short timeout_ms)
Uses GUtility() and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout.
GCLIB_DLL_EXPORTED GReturn GCALL GCommand(GCon g, GCStringIn command, GBufOut buffer, GSize buffer_len, GSize *bytes_returned)
Performs a command-and-response transaction on the connection.
GCLIB_DLL_EXPORTED GReturn GCALL GInterrupt(GCon g, GStatus *status_byte)
Provides access to PCI and UDP interrupts from the controller.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload(GCon g, GCStringIn program, GCStringIn preprocessor)
Downloads a program to the controller's program buffer.
GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
unsigned char GStatus
Interrupt status byte.
#define G_NO_ERROR
Return value if function succeeded.
unsigned int GSize
Size of buffers, etc.
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
const char * GCStringIn
C-string input to the library. Implies null-termination.
void x_e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.
int x_ginterrupt(GCon g)
Example GInterrupt() usage.
int x_ei_motioncomplete(GCon g, GCStringIn axes)
Example of MotionComplete with interrupts.