18 cout <<
"\n*************************************************************\n";
19 cout <<
"Example GInterrupt() usage\n";
20 cout <<
"***************************************************************\n";
22 char buf[G_SMALL_BUFFER];
28 bool ei_support =
true;
29 if (GCommand(g,
"WH", buf, G_SMALL_BUFFER, &bytes_read) == G_NO_ERROR)
32 ei_support = (strstr(buf,
"IH") != 0);
37 cout <<
"No support on this bus\n";
38 return G_UNSUPPORTED_FUNCTION;
48 while ((GInterrupt(g, &status) == G_NO_ERROR) && status);
55 e(GCmdT(g,
"RP", buf, G_SMALL_BUFFER, &trimmed));
56 cout <<
"\nPosition: " << trimmed <<
'\n';
57 e(GCmd(g,
"SP 4000,4000"));
58 e(GCmd(g,
"AC 1280000,1280000"));
59 e(GCmd(g,
"DC 1280000,1280000"));
60 e(GCmd(g,
"PR 8000,10000"));
62 cout <<
"Beginning independent motion...\n";
65 cout <<
"Motion Complete on A and B\n";
66 e(GCmdT(g,
"RP", buf, G_SMALL_BUFFER, &trimmed));
67 cout <<
"Position: " << trimmed <<
'\n';
69 return GALIL_EXAMPLE_OK;
75 char buf[G_SMALL_BUFFER];
80 unsigned char axis_mask = 0xFF;
82 int len = strlen(axes);
84 for (
int i = 0; i < len; i++)
115 sprintf(buf,
"EI %u", (
unsigned char)~axis_mask);
118 while (axis_mask != 0xFF)
120 if ((rc = GInterrupt(g, &status)) == G_NO_ERROR)
GReturn motion_complete(GCon g)
Uses interrupts to track when the motion of controller is completed.
int check_interrupts(GCon g, GCStringIn axes)
Monitors interrupt status on the given axes and returns when interrupts are fired.
void e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.