2 Public Function Motion_Complete(
gclib As Gclib)
3 Console.WriteLine(
"*************************************************************")
4 Console.WriteLine(
"Example GInterrupt() usage")
5 Console.WriteLine(
"*************************************************************")
7 'Simple check for appropriate communication bus
8 'EI will fail below
if interrupts are Not supported at all
15 If Not ei_support Then
16 Console.WriteLine(
"No support on this bus")
17 Return GALIL_EXAMPLE_ERROR
21 gclib.GCommand("EI0,0") 'Turn off interrupts
24 'Flush interrupts, status will be zero when queue Is empty
32 Console.WriteLine("Position: " +
gclib.
GCommand("RP")) 'Print reference position
37 gclib.
GCommand("PR 8000, 10000") 'Position Relative. B will take longer To make its move.
40 Console.WriteLine("Beginning independent motion...")
42 Check_Interrupts(
gclib, "AB") 'Block until motion Is complete On axes A And B
43 Console.WriteLine("Motion Complete on A and B")
44 Console.WriteLine("Position: " +
gclib.
GCommand("RP")) 'Print reference position
46 Return GALIL_EXAMPLE_OK
49 Private Sub Check_Interrupts(
gclib As Gclib, axes As String)
50 'bit mask of running axes, axes arg Is trusted to provide running axes.
51 'Low bit indicates running.
52 Dim axis_mask As Byte = &HFF
54 'iterate through all chars in axes to make the axis mask
55 For i = 0 To axes.Length - 1
60 axis_mask = axis_mask And &HFE
63 axis_mask = axis_mask And &HFD
66 axis_mask = axis_mask And &HFB
69 axis_mask = axis_mask And &HF7
72 axis_mask = axis_mask And &HEF
75 axis_mask = axis_mask And &HDF
78 axis_mask = axis_mask And &HBF
81 axis_mask = axis_mask And &H7F
86 'send EI axis mask to set up interrupt events.
91 While (axis_mask <> &HFF) 'wait for all interrupts to come in
94 Case &HD0 'Axis A complete
95 axis_mask = axis_mask Or &H1
97 Case &HD1 'Axis B complete
98 axis_mask = axis_mask Or &H2
100 Case &HD2 'Axis C complete
101 axis_mask = axis_mask Or &H4
103 Case &HD3 'Axis D complete
104 axis_mask = axis_mask Or &H8
106 Case &HD4 'Axis E complete
107 axis_mask = axis_mask Or &H10
109 Case &HD5 'Axis F complete
110 axis_mask = axis_mask Or &H20
112 Case &HD6 'Axis G complete
113 axis_mask = axis_mask Or &H40
115 Case &HD7 'Axis H complete
116 axis_mask = axis_mask Or &H80
string GCommand(string Command, bool Trim=true)
Used for command-and-response transactions.
byte GInterrupt()
Provides access to PCI and UDP interrupts from the controller.
void GTimeout(Int16 timeout_ms)
Set the timeout of communication transactions. Use -1 to set the original timeout from GOpen().
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
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.