2 Imports System.Text
'StringBuilder
3 Imports System.Runtime.InteropServices 'DLL
import
4 Imports System.IO
'File.Exists
6 Imports UB = System.Byte
7 Imports UW = System.UInt16
8 Imports SW = System.Int16
9 Imports SL = System.Int32
10 Imports UL = System.UInt32
12 #If PLATFORM = "x86" Then
13 Imports GReturn = System.Int32
14 Imports GCon = System.IntPtr
15 Imports GSize = System.UInt32
16 Imports GOption = System.Int32
17 Imports GCStringOut = System.Text.StringBuilder
18 Imports GCStringIn = System.String
19 Imports GBufOut = System.Text.StringBuilder
20 Imports GBufIn = System.String
21 Imports GStatus = System.Byte
22 ' IMPORTANT! Be sure that the paths below are correct
23 Public Module LibraryPath
24 Public Const GclibDllPath_ As String =
"C:\Program Files (x86)\Galil\gclib\dll\x86\gclib.dll"
25 Public Const GcliboDllPath_ As String =
"C:\Program Files (x86)\Galil\gclib\dll\x86\gclibo.dll"
28 #ElseIf PLATFORM = "x64" Then
29 Imports GReturn = System.Int32
30 Imports GCon = System.IntPtr
31 Imports GSize = System.UInt32
33 Imports GCStringOut = System.Text.StringBuilder
34 Imports GCStringIn = System.String
35 Imports GBufOut = System.Text.StringBuilder
36 Imports GBufIn = System.String
37 Imports GStatus = System.Byte
38 ' IMPORTANT! Be sure that the paths below are correct
39 Public Module LibraryPath
40 Public Const GclibDllPath_ As String = "C:\Program Files (x86)\Galil\gclib\dll\x64\gclib.dll"
41 Public Const GcliboDllPath_ As String = "C:\Program Files (x86)\Galil\gclib\dll\x64\gclibo.dll"
46 ''' Provides a
class that binds to
gclib's unmanaged dll. Wraps each call and provides a more user-friendly interface for use in Visual Basic.
49 ''' The
Gclib class assumes the default installation of
gclib, "C:\Program Files (x86)\Galil\gclib\".
50 ''' If the dlls are elsewhere, change the path strings GclibDllPath_, and GcliboDllPath_.
54 #Region "VB wrappers of gclib C calls"
56 #Region "Private properties"
57 Private Const BufferSize_ As Integer = 500000 'size of "char *" buffer. Big enough to fit entire 4000 program via UL/LS, or 24000 elements of array data.
58 Private Buffer_ As New System.Text.StringBuilder(BufferSize_) 'used to pass a "char *" to
gclib.
59 Private ByteArray_(512) As Byte 'byte array to hold data record and response to
GRead
60 Private ConnectionHandle_ As GCon 'keep track of the
gclib connection handle.
61 Private ConnectionStatus_ As Boolean 'keep track of the status of
gclib's connection.
65 ''' Constructor of the
gclib wrapper class.
67 ''' <remarks>Checks to ensure
gclib dlls are in the correct location.</remarks>
68 ''' <exception cref="System.Exception">Will throw an exception if either dll isn't found.</exception>
70 If Not File.Exists(GclibDllPath_) Then
71 Throw New System.Exception("Could not find gclib dll at " & GclibDllPath_)
74 If Not File.Exists(GcliboDllPath_) Then
75 Throw New System.Exception("Could not find gclibo dll at " & GcliboDllPath_)
80 ''' Return a string array of available connection addresses.
82 ''' <returns>String array containing all available
Galil Ethernet controllers, PCI controllers, and COM ports.</returns>
85 ''' An empty array is returned on
error.</remarks>
87 Dim rc As GReturn = DllGAddresses(Buffer_, BufferSize_)
89 Return Buffer_.ToString().Split({vbCr, vbLf}, System.StringSplitOptions.RemoveEmptyEntries)
91 Return New String() {}
96 ''' Downloads array data to a pre-dimensioned array in the controller
's array table.
98 ''' <param name=
"array_name">String containing the name of the array to download. Must match the array name used in DM.</param>
99 ''' <param name=
"data">A list of doubles, to be downloaded.</param>
100 ''' <param name=
"first">The first element of the array
for sub-array downloads.</param>
101 ''' <param name=
"last">The last element of the array
for sub-array downloads.</param>
104 ''' The array must already exist on the controller, see DM and LA.</remarks>
105 ''' <exception cref=
"System.Exception">Will
throw an exception
if anything other than
G_NO_ERROR is received from
gclib.</exception>
106 Public Sub
GArrayDownload(array_name As String, ByRef data As List(Of Double), Optional first As Int16 = -1, Optional last As Int16 = -1)
107 Dim ArrayData As New System.Text.StringBuilder(BufferSize_) 'for converting to ASCII
108 Dim len As Integer = data.Count()
109 For i As Integer = 0 To len - 1
110 ArrayData.Append(data(i).ToString("F4")) 'format to fixed point
112 ArrayData.Append(",") 'delimiter
115 Dim rc As GReturn = DllGArrayDownload(ConnectionHandle_, array_name, first, last, ArrayData.ToString())
117 Throw New System.Exception(
GError(rc))
122 ''' Allows downloading of a program array file to the controller.
124 ''' <param name="Path">The full filepath of the array csv file.</param>
128 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
130 Dim rc As GReturn = DllGArrayDownloadFile(ConnectionHandle_, Path)
132 Throw New System.Exception(
GError(rc))
137 ''' Uploads array data from the controller's array table.
139 ''' <param name="array_name">String containing the name of the array to upload.</param>
140 ''' <param name="first">The first element of the array for sub-array uploads.</param>
141 ''' <param name="last">The last element of the array for sub-array uploads.</param>
142 ''' <returns>The desired array as a list of doubles.</returns>
146 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
147 Public Function
GArrayUpload(array_name As String, Optional first As Int16 = -1, Optional last As Int16 = -1) As List(Of Double)
148 Dim array As New List(Of Double)
149 Dim rc As GReturn = DllGArrayUpload(ConnectionHandle_, array_name, first, last, 1, Buffer_, BufferSize_) '1 = comma delim
151 Throw New System.Exception(
GError(rc))
153 Dim tokens As String() = Buffer_.ToString.Split({
","}, System.StringSplitOptions.RemoveEmptyEntries)
155 For Each s As String In tokens
156 If Not Double.TryParse(s, value) Then
157 Throw New System.Exception(
"Could not parse " & s &
" into double")
165 ''' Allows uploading of a program array file from the controller to an array CSV file.
167 ''' <param name=
"Path">The full filepath of the array csv file to save.</param>
168 ''' <param name=
"Names">A space separated list of the array names to upload. A
null string uploads all arrays in the array table (LA).</param>
172 ''' <exception cref=
"System.Exception">Will
throw an exception
if anything other than
G_NO_ERROR is received from
gclib.</exception>
174 Dim rc As GReturn = DllGArrayUploadFile(ConnectionHandle_, Path, Names)
176 Throw New System.Exception(
GError(rc))
181 ''' Assigns IP address over the Ethernet to a controller at a given MAC address.
183 ''' <param name="ip">The ip address to assign. The hardware should not yet have an IP address. </param>
184 ''' <param name="mac">The MAC address of the hardware.</param>
188 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
189 Public Sub
GAssign(ip As String, mac As String)
190 Dim rc As GReturn = DllGAssign(ip, mac)
192 Throw New System.Exception(
GError(rc))
197 ''' Used to close a connection to
Galil hardware.
201 ''' Be sure to call
GClose() whenever a connection is finished.</remarks>
203 If ConnectionStatus_ Then
204 DllGClose(ConnectionHandle_)
207 ConnectionStatus_ = False
211 ''' Used for command-and-response transactions.
213 ''' <param name="Command">The command to send to the controller. Do not append a carriage return. Use only ASCII-based commmands.</param>
214 ''' <param name="Trim">If true, the response will be trimmed of the trailing colon and any leading or trailing whitespace.</param>
215 ''' <returns>The command's response.</returns>
219 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
220 Public Function
GCommand(Command As String, Optional Trim As Boolean = True) As String
221 Dim rc As GReturn = DllGCommand(ConnectionHandle_, Command, Buffer_, BufferSize_, 0)
223 Throw New System.Exception(
GError(rc))
226 Dim r As String = Buffer_.ToString()
227 If r(r.Count() - 1) = ":" Then
228 r = r.Substring(0, r.Count() - 1)
232 Return Buffer_.ToString()
238 ''' Used for command-And-response transactions.
240 ''' <param name="Command">The command to send to the controller. Do Not append a carriage return. Use only ASCII-based commmands.</param>
241 ''' <returns>The command's response parsed as an integer.</returns>
245 Public Function
GCmdI(Command As String) As Int16
246 Return Convert.ToInt16(Convert.ToDouble(
GCommand(Command)))
250 ''' Used for command-And-response transactions.
252 ''' <param name="Command">The command to send to the controller. Do Not append a carriage return. Use only ASCII-based commmands.</param>
253 ''' <returns>The command's response parsed as a
double.</returns>
257 Public Function
GCmdD(Command As String) As Double
258 Return Convert.ToDouble(
GCommand(Command))
264 ''' <param name="ErrorCode">The
gclib error code, as returned from a call to the
gclib.</param>
265 ''' <returns>Error
message string.</returns>
269 ''' This function is private, all public calls that throw errors use this command for setting the exception
message.
271 Private Function
GError(ErrorCode As GReturn) As String
272 DllGError(ErrorCode, Buffer_, BufferSize_)
273 Return ErrorCode.ToString & " " & Buffer_.ToString() & vbCrLf
277 ''' Upgrade firmware.
279 ''' <param name="filepath ">The full filepath of the firmware hex file.</param>
283 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
285 Dim rc As GReturn = DllGFirmwareDownload(ConnectionHandle_, filepath)
287 Throw New System.Exception(
GError(rc))
291 ''' <summary>Provides a useful connection
string.</summary>
295 ''' <returns>String containing connection information,
e.g. "192.168.0.43, DMC4020 Rev 1.2c, 291". A null
string indicates an
error was returned from the library.</returns>
296 Public Function
GInfo() As String
297 Dim rc As GReturn = DllGInfo(ConnectionHandle_, Buffer_, BufferSize_)
299 Return Buffer_.ToString()
306 ''' Provides access to PCI and UDP interrupts from the controller.
308 ''' <returns>The status
byte from the controller. Zero will be returned if a status
byte is not read.</returns>
311 ''' -s ALL or -s EI must be specified in the address argument of
GOpen() to receive interrupts.</remarks>
313 Dim StatusByte As Byte = 0
314 Dim rc As GReturn = DllGInterrupt(ConnectionHandle_, StatusByte)
323 ''' Provides a list of all
Galil controllers requesting IP addresses via BOOT-P or DHCP.
325 ''' <returns>Each line of the returned data will be of the form "model, serial_number, mac". </returns>
328 ''' An empty array is returned on
error.
329 ''' Call will take roughly 5 seconds to return.</remarks>
331 Dim rc As GReturn = DllGIpRequests(Buffer_, BufferSize_)
333 Return Buffer_.ToString().Split({vbCr, vbLf}, System.StringSplitOptions.RemoveEmptyEntries)
335 Return New String() {}
340 ''' Provides access to unsolicited messages.
342 ''' <returns>String containing all messages received by controller.</returns>
345 '''An empty
string is returned on
error.
346 ''' -s ALL or -s MG must be specified in the address argument of
GOpen() to receive messages.</remarks>
347 Public Function
GMessage() As String
348 Dim rc As GReturn = DllGMessage(ConnectionHandle_, Buffer_, BufferSize_)
350 Return Buffer_.ToString
357 ''' Blocking call that returns once all axes specified have completed their motion.
359 ''' <param name="axes">A
string containing a multiple-axes mask. Every character in the
string should be a valid argument to MG_BGm, i.
e. XYZWABCDEFGHST.</param>
363 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
365 Dim rc As GReturn = DllGMotionComplete(ConnectionHandle_, axes)
367 Throw New System.Exception(
GError(rc))
372 ''' Used to open a connection to
Galil hardware.
374 ''' <param name="address">Address
string including any connection switches. See
gclib documentation for
GOpen().</param>
378 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
379 Public Sub
GOpen(address As String)
380 Dim rc As GReturn = DllGOpen(address, ConnectionHandle_)
382 Throw New System.Exception(
GError(rc))
384 ConnectionStatus_ = True
389 ''' Allows downloading of a DMC program from a
string buffer.
391 ''' <param name="program">The program to download.</param>
392 ''' <param name="preprocessor">Preprocessor directives. Use nullstring for none.</param>
396 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
397 Public Sub
GProgramDownload(ByRef program As String, Optional preprocessor As String = "")
398 Dim rc As GReturn = DllGProgramDownload(ConnectionHandle_, program, preprocessor)
400 Throw New System.Exception(
GError(rc))
405 ''' Allows downloading of a DMC program from file.
407 ''' <param name="file_path">The full filepath of the DMC file.</param>
408 ''' <param name="preprocessor">Preprocessor directives. Use nullstring for none.</param>
412 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
414 Dim rc As GReturn = DllGProgramDownloadFile(ConnectionHandle_, file_path, preprocessor)
416 Throw New System.Exception(
GError(rc))
421 ''' Allows uploading of a DMC program to a
string.
426 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
428 Dim rc As GReturn = DllGProgramUpload(ConnectionHandle_, Buffer_, BufferSize_)
430 Throw New System.Exception(
GError(rc))
432 Return Buffer_.ToString()
437 ''' Allows uploading of a DMC program to a file.
439 ''' <param name="file_path">The full filepath of the DMC file to save.</param>
443 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
445 Dim rc As GReturn = DllGProgramUploadFile(ConnectionHandle_, file_path)
447 Throw New System.Exception(
GError(rc))
452 ''' Performs a read on the connection.
454 ''' <returns>String containing the read data, or a nullstring if nothing was read or an
error occured.</returns>
458 Public Function
GRead() As Byte()
460 Dim rc As GReturn = DllGRead(ConnectionHandle_, ByteArray_, ByteArray_.Length, read)
462 Dim ReturnData(read - 1) As Byte 'create an array of the correct size
463 For i As Integer = 0 To read - 1
464 ReturnData(i) = ByteArray_(i) 'copy over the data
473 ''' Used for retrieving data records from the controller.
475 ''' <returns>A struct containing the information of the retrieved data record.</returns>
476 ''' <param name="async">False to user QR, True to use DR.</param>
479 ''' To use async, -s ALL or -s DR must be specified in the address argument of
GOpen(),
480 ''' and the records must be started via DR or RecordRate().
482 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
484 Dim method As UShort = 0 'QR mode
489 Dim rc As GReturn = DllGRecord(ConnectionHandle_, ByteArray_, method)
493 Return ByteArrayToDataRecord(Of T)(ByteArray_)
497 ''' Sets the asynchronous data record to a user-specified period via DR.
499 ''' <param name="period_ms">Period, in milliseconds, to set up for the asynchronous data record.</param>
502 ''' Takes TM and product type into account and sets the DR period to the period requested by the user, if possible.</remarks>
503 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
505 Dim rc As GReturn = DllGRecordRate(ConnectionHandle_, period_ms)
512 ''' Set the timeout of communication transactions. Use -1 to set the original timeout from
GOpen().
514 ''' <param name="timeout_ms ">New timeout in miliseconds.</param>
519 DllGTimeout(ConnectionHandle_, timeout_ms)
522 ''' <summary>Used to get the
gclib version.</summary>
523 ''' <returns>The library version,
e.g. "104.73.179". A null
string indicates an
error was returned from the library.</returns>
528 Dim rc As GReturn = DllGVersion(Buffer_, BufferSize_)
530 Return Buffer_.ToString()
537 ''' Performs a write on the connection.
539 ''' <param name="buffer">The user's write buffer. To send a
Galil command, a terminating carriage return is usually required. </param>
543 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
544 Public Sub
GWrite(ByRef buffer As String)
545 Dim rc As GReturn = DllGWrite(ConnectionHandle_, buffer, buffer.Length())
552 ''' Allows downloading of a
Galil compressed backup (gcb) file to the controller.
554 ''' <param name="Path">The full filepath of the gcb file.</param>
555 ''' <param name="Options">A bit mask indicating which sectors of the gcb file to restore to the controller.</param>
556 ''' <returns>The controller information stored in the gcb file.</returns>
559 ''' If options is specified as 0, the return
string will have a number appended corresponding to a bit mask of the available gcb sectors
561 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR is received from
gclib.</exception>
563 'Dim _info As New System.Text.StringBuilder(BufferSize_)
564 Dim rc As GReturn = DllGSetupDownloadFile(ConnectionHandle_, Path, Options, Buffer_, BufferSize_)
565 Dim ret_buf As String = Buffer_.ToString()
566 ret_buf = Replace(ret_buf, vbCrLf, ", ")
568 If Not Options = 0 Then
573 ret_buf += """options""" + "," + rc.ToString() + vbLf
576 Return ret_buf.Split({vbLf}, System.StringSplitOptions.RemoveEmptyEntries)
580 ''' Connects
gclib to a New gcaps server
582 ''' <param name=
"server_name">Name of the server to connect.</param>
586 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR Is received from
gclib.</exception>
588 Dim rc As GReturn = DllGSetServer(server_name)
596 ''' Retrieves the name of your local gcaps server And whether Or Not it Is currently published
598 ''' <returns>A
string in the form "<server_name>, <isPublished>"</returns>
599 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR Is received from
gclib.</exception>
601 Dim rc As GReturn = DllGServerStatus(Buffer_, BufferSize_)
607 Return Buffer_.ToString()
611 ''' Retrieves a list of gcaps servers that are advertising themselves on the local network
613 ''' <returns>A list of available gcaps server names</returns>
614 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR Is received from
gclib.</exception>
616 Dim rc As GReturn = DllGListServers(Buffer_, BufferSize_)
622 Dim delimiters As Char() = New Char() {vbLf, vbNewLine}
623 Return Buffer_.ToString().Split(delimiters, System.StringSplitOptions.RemoveEmptyEntries)
627 ''' Publishes Or removes local gcaps server from the network
629 ''' <param name=
"server_name">Name to publish server under.</param>
630 ''' <param name=
"publish">True=publish server, False=
remove server.</param>
631 ''' <param name=
"save">Save
this configuration
for future server reboots.</param>
632 ''' <exception cref=
"System.Exception">Will
throw an exception
if anything other than
G_NO_ERROR Is received from
gclib.</exception>
633 Public Sub
GPublishServer(server_name As String, publish As Boolean, save As Boolean)
634 Dim rc As GReturn = DllGPublishServer(server_name, Convert.ToInt16(publish), Convert.ToInt16(save))
637 Throw New System.Exception(
GError(rc))
642 ''' Returns a list of IP Addresses that currently have an open connection to your hardware.
644 ''' <returns>Returns a list of IP Addresses that currently have an open connection to your hardware.</returns>
645 ''' <exception cref="System.Exception">Will throw an exception if anything other than
G_NO_ERROR Is received from
gclib.</exception>
647 Dim rc As GReturn = DllGRemoteConnections(Buffer_, BufferSize_)
653 Dim delimiters As Char() = New Char() {vbLf, vbNewLine}
654 Return Buffer_.ToString().Split(delimiters, System.StringSplitOptions.RemoveEmptyEntries)
659 #Region "DLL Imports"
661 'Import declarations for gclib functions. Functions are private to this class and are prefixed with "Dll" to distinguish from VB functions.
663 #Region "Error Codes"
665 ''' <remarks>Some functions
throw exceptions
if G_NO_ERROR is not returned.</remarks>
669 <DllImport(GcliboDllPath_, EntryPoint:=
"GAddresses", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
670 Private Shared Function DllGAddresses(addresses As GCStringOut, addresses_len As GSize) As GReturn
673 <DllImport(GclibDllPath_, EntryPoint:=
"GArrayDownload", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
674 Private Shared Function DllGArrayDownload(g As GCon, array_name As GCStringIn, first As
GOption,
675 last As
GOption, buffer As GCStringIn) As GReturn
678 <DllImport(GcliboDllPath_, EntryPoint:=
"GArrayDownloadFile", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
679 Private Shared Function DllGArrayDownloadFile(g As GCon, path As GCStringIn) As GReturn
682 <DllImport(GclibDllPath_, EntryPoint:=
"GArrayUpload", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
683 Private Shared Function DllGArrayUpload(g As GCon, array_name As GCStringIn, first As
GOption,
684 last As
GOption, delim As
GOption, buffer As GCStringOut, bufferLength As GSize) As GReturn
687 <DllImport(GcliboDllPath_, EntryPoint:=
"GArrayUploadFile", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
688 Private Shared Function DllGArrayUploadFile(g As GCon, path As GCStringIn, names As GCStringIn) As GReturn
691 <DllImport(GcliboDllPath_, EntryPoint:=
"GAssign", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
692 Private Shared Function DllGAssign(ip As GCStringIn, mac As GCStringIn) As GReturn
695 <DllImport(GclibDllPath_, EntryPoint:=
"GClose", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
696 Private Shared Function DllGClose(g As GCon) As GReturn
699 <DllImport(GclibDllPath_, EntryPoint:=
"GCommand", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
700 Private Shared Function DllGCommand(g As GCon, command As GCStringIn, buffer As GCStringOut,
701 bufferLength As GSize, ByRef bytesReturned As GSize) As GReturn
704 <DllImport(GcliboDllPath_, EntryPoint:=
"GError", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
705 Private Shared Sub DllGError(error_code As GReturn, errorbuf As GCStringOut, error_len As GSize)
708 <DllImport(GclibDllPath_, EntryPoint:="
GFirmwareDownload", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
709 Private Shared Function DllGFirmwareDownload(g As GCon, path As GCStringIn) As GReturn
712 <DllImport(GcliboDllPath_, EntryPoint:="
GInfo", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
713 Private Shared Function DllGInfo(g As GCon, info As GCStringOut, infoLength As GSize) As GReturn
716 <DllImport(GclibDllPath_, EntryPoint:="
GInterrupt", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
717 Private Shared Function DllGInterrupt(g As GCon, ByRef status_byte As GStatus) As GReturn
720 <DllImport(GcliboDllPath_, EntryPoint:="
GIpRequests", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
721 Private Shared Function DllGIpRequests(requests As GCStringOut, requests_len As GSize) As GReturn
724 <DllImport(GclibDllPath_, EntryPoint:="
GMessage", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
725 Private Shared Function DllGMessage(g As GCon, buffer As GCStringOut, bufferLength As GSize) As GReturn
728 <DllImport(GcliboDllPath_, EntryPoint:="
GMotionComplete", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
729 Private Shared Function DllGMotionComplete(g As GCon, axes As GCStringIn) As GReturn
732 <DllImport(GclibDllPath_, EntryPoint:="
GOpen", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
733 Private Shared Function DllGOpen(address As GCStringIn, ByRef g As GCon) As GReturn
736 <DllImport(GclibDllPath_, EntryPoint:="
GProgramDownload", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
737 Private Shared Function DllGProgramDownload(g As GCon, program As GCStringIn, preprocessor As GCStringIn) As GReturn
740 <DllImport(GcliboDllPath_, EntryPoint:="
GProgramDownloadFile", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
741 Private Shared Function DllGProgramDownloadFile(g As GCon, path As GCStringIn, preprocessor As GCStringIn) As GReturn
744 <DllImport(GclibDllPath_, EntryPoint:="
GProgramUpload", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
745 Private Shared Function DllGProgramUpload(g As GCon, buffer As GCStringOut, bufferLength As GSize) As GReturn
748 <DllImport(GcliboDllPath_, EntryPoint:="
GProgramUploadFile", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
749 Private Shared Function DllGProgramUploadFile(g As GCon, path As GCStringIn) As GReturn
752 <DllImport(GclibDllPath_, EntryPoint:="
GRead", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
753 Private Shared Function DllGRead(g As GCon, buffer As Byte(), buffer_len As GSize, ByRef bytes_read As GSize) As GReturn
756 <DllImport(GclibDllPath_, EntryPoint:="
GRecord", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
757 Private Shared Function DllGRecord(g As GCon, record As Byte(), method As
GOption) As GReturn
760 <DllImport(GcliboDllPath_, EntryPoint:="
GRecordRate", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
761 Private Shared Function DllGRecordRate(g As GCon, period_ms As Double) As GReturn
764 <DllImport(GcliboDllPath_, EntryPoint:="
GTimeout", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
765 Private Shared Sub DllGTimeout(g As GCon, timeoutMs As Short)
768 <DllImport(GcliboDllPath_, EntryPoint:="
GVersion", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
769 Private Shared Function DllGVersion(ver As GCStringOut, ver_len As GSize) As GReturn
772 <DllImport(GclibDllPath_, EntryPoint:="
GWrite", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
773 Private Shared Function DllGWrite(g As GCon, buffer As GCStringIn, buffer_len As GSize) As GReturn
776 <DllImport(GcliboDllPath_, EntryPoint:="
GSetupDownloadFile", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
777 Private Shared Function DllGSetupDownloadFile(g As GCon, path As GCStringIn, options As
GOption, info As GCStringOut, info_len As GSize) As GReturn
780 <DllImport(GcliboDllPath_, EntryPoint:="
GSetServer", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
781 Private Shared Function DllGSetServer(server_name As GCStringIn) As GReturn
784 <DllImport(GcliboDllPath_, EntryPoint:="
GServerStatus", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
785 Private Shared Function DllGServerStatus(status As GCStringOut, status_len As GSize) As GReturn
788 <DllImport(GcliboDllPath_, EntryPoint:="
GListServers", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
789 Private Shared Function DllGListServers(servers As GCStringOut, servers_len As GSize) As GReturn
792 <DllImport(GcliboDllPath_, EntryPoint:="
GPublishServer", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
793 Private Shared Function DllGPublishServer(server_name As GCStringIn, publish As
GOption, save As
GOption) As GReturn
796 <DllImport(GcliboDllPath_, EntryPoint:="
GRemoteConnections", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)>
797 Private Shared Function DllGRemoteConnections(connections As GCStringOut, connections_len As GSize) As GReturn
802 #Region "Data Record"
804 Private Function ByteArrayToDataRecord(Of T As
GDataRecord)(array As Byte()) As T
805 Dim handle As GCHandle = GCHandle.Alloc(array, GCHandleType.Pinned)
807 Return Marshal.PtrToStructure(Of T)(handle.AddrOfPinnedObject())
814 Function byte_array() As Byte()
818 Dim size As Integer = Marshal.SizeOf(record)
819 Dim arr(size) As Byte
821 Dim ptr As IntPtr = Marshal.AllocHGlobal(size)
822 Marshal.StructureToPtr(record, ptr, True)
823 Marshal.Copy(ptr, arr, 0, size)
824 Marshal.FreeHGlobal(ptr)
828 ' Data record struct for DMC-4000 controllers, including 4000, 4200, 4103, And 500x0.
829 <StructLayout(LayoutKind.Sequential, Pack:=1)>
833 Public header_0 As UB ' 1st Byte of Header.
834 Public header_1 As UB ' 2nd Byte of Header.
835 Public header_2 As UB ' 3rd Byte of Header.
836 Public header_3 As UB ' 4th Byte of Header.
838 Public sample_number As UW ' sample number.
840 Public input_bank_0 As UB ' general input bank 0 (inputs 1-8).
841 Public input_bank_1 As UB ' general input bank 1 (inputs 9-16).
842 Public input_bank_2 As UB ' general input bank 2 (inputs 17-24).
843 Public input_bank_3 As UB ' general input bank 3 (inputs 25-32).
844 Public input_bank_4 As UB ' general input bank 4 (inputs 33-40).
845 Public input_bank_5 As UB ' general input bank 5 (inputs 41-48).
846 Public input_bank_6 As UB ' general input bank 6 (inputs 49-56).
847 Public input_bank_7 As UB ' general input bank 7 (inputs 57-64).
848 Public input_bank_8 As UB ' general input bank 8 (inputs 65-72).
849 Public input_bank_9 As UB ' general input bank 9 (inputs 73-80).
851 Public output_bank_0 As UB ' general output bank 0 (outputs 1-8).
852 Public output_bank_1 As UB ' general output bank 1 (outputs 9-16).
853 Public output_bank_2 As UB ' general output bank 2 (outputs 17-24).
854 Public output_bank_3 As UB ' general output bank 3 (outputs 25-32).
855 Public output_bank_4 As UB ' general output bank 4 (outputs 33-40).
856 Public output_bank_5 As UB ' general output bank 5 (outputs 41-48).
857 Public output_bank_6 As UB ' general output bank 6 (outputs 49-56).
858 Public output_bank_7 As UB ' general output bank 7 (outputs 57-64).
859 Public output_bank_8 As UB ' general output bank 8 (outputs 65-72).
860 Public output_bank_9 As UB ' general output bank 9 (outputs 73-80).
862 Public reserved_0 As SW ' Reserved.
863 Public reserved_2 As SW ' Reserved.
864 Public reserved_4 As SW ' Reserved.
865 Public reserved_6 As SW ' Reserved.
866 Public reserved_8 As SW ' Reserved.
867 Public reserved_10 As SW ' Reserved.
868 Public reserved_12 As SW ' Reserved.
869 Public reserved_14 As SW ' Reserved.
871 Public ethernet_status_a As UB ' Ethernet Handle A Status.
872 Public ethernet_status_b As UB ' Ethernet Handle B Status.
873 Public ethernet_status_c As UB ' Ethernet Handle C Status.
874 Public ethernet_status_d As UB ' Ethernet Handle D Status.
875 Public ethernet_status_e As UB ' Ethernet Handle E Status.
876 Public ethernet_status_f As UB ' Ethernet Handle F Status.
877 Public ethernet_status_g As UB ' Ethernet Handle G Status.
878 Public ethernet_status_h As UB ' Ethernet Handle H Status.
880 Public error_code As UB '
error code.
881 Public thread_status As UB ' thread status
882 Public amplifier_status As UL ' Amplifier Status.
884 Public contour_segment_count As UL ' Segment Count for Contour Mode.
885 Public contour_buffer_available As UW ' Buffer space remaining, Contour Mode.
887 Public s_plane_segment_count As UW ' segment count of coordinated move for S plane.
888 Public s_plane_move_status As UW ' coordinated move status for S plane.
889 Public s_distance As SL ' distance traveled in coordinated move for S plane.
890 Public s_plane_buffer_available As UW ' Buffer space remaining, S Plane.
892 Public t_plane_segment_count As UW ' segment count of coordinated move for T plane.
893 Public t_plane_move_status As UW ' Coordinated move status for T plane.
894 Public t_distance As SL ' distance traveled in coordinated move for T plane.
895 Public t_plane_buffer_available As UW ' Buffer space remaining, T Plane.
897 Public axis_a_status As UW ' A axis status.
898 Public axis_a_switches As UB ' A axis switches.
899 Public axis_a_stop_code As UB ' A axis stop code.
900 Public axis_a_reference_position As SL ' A axis reference position.
901 Public axis_a_motor_position As SL ' A axis motor position.
902 Public axis_a_position_error As SL ' A axis position
error.
903 Public axis_a_aux_position As SL ' A axis auxiliary position.
904 Public axis_a_velocity As SL ' A axis velocity.
905 Public axis_a_torque As SL ' A axis torque.
906 Public axis_a_analog_in As UW ' A axis analog input.
907 Public axis_a_halls As UB ' A Hall Input Status.
908 Public axis_a_reserved As UB ' Reserved.
909 Public axis_a_variable As SL ' A User-defined variable (ZA).
911 Public axis_b_status As UW ' B axis status.
912 Public axis_b_switches As UB ' B axis switches.
913 Public axis_b_stop_code As UB ' B axis stop code.
914 Public axis_b_reference_position As SL ' B axis reference position.
915 Public axis_b_motor_position As SL ' B axis motor position.
916 Public axis_b_position_error As SL ' B axis position
error.
917 Public axis_b_aux_position As SL ' B axis auxiliary position.
918 Public axis_b_velocity As SL ' B axis velocity.
919 Public axis_b_torque As SL ' B axis torque.
920 Public axis_b_analog_in As UW ' B axis analog input.
921 Public axis_b_halls As UB ' B Hall Input Status.
922 Public axis_b_reserved As UB ' Reserved.
923 Public axis_b_variable As SL ' B User-defined variable (ZA).
925 Public axis_c_status As UW ' C axis status.
926 Public axis_c_switches As UB ' C axis switches.
927 Public axis_c_stop_code As UB ' C axis stop code.
928 Public axis_c_reference_position As SL ' C axis reference position.
929 Public axis_c_motor_position As SL ' C axis motor position.
930 Public axis_c_position_error As SL ' C axis position
error.
931 Public axis_c_aux_position As SL ' C axis auxiliary position.
932 Public axis_c_velocity As SL ' C axis velocity.
933 Public axis_c_torque As SL ' C axis torque.
934 Public axis_c_analog_in As UW ' C axis analog input.
935 Public axis_c_halls As UB ' C Hall Input Status.
936 Public axis_c_reserved As UB ' Reserved.
937 Public axis_c_variable As SL ' C User-defined variable (ZA).
939 Public axis_d_status As UW ' D axis status.
940 Public axis_d_switches As UB ' D axis switches.
941 Public axis_d_stop_code As UB ' D axis stop code.
942 Public axis_d_reference_position As SL ' D axis reference position.
943 Public axis_d_motor_position As SL ' D axis motor position.
944 Public axis_d_position_error As SL ' D axis position
error.
945 Public axis_d_aux_position As SL ' D axis auxiliary position.
946 Public axis_d_velocity As SL ' D axis velocity.
947 Public axis_d_torque As SL ' D axis torque.
948 Public axis_d_analog_in As UW ' D axis analog input.
949 Public axis_d_halls As UB ' D Hall Input Status.
950 Public axis_d_reserved As UB ' Reserved.
951 Public axis_d_variable As SL ' D User-defined variable (ZA).
953 Public axis_e_status As UW ' E axis status.
954 Public axis_e_switches As UB ' E axis switches.
955 Public axis_e_stop_code As UB ' E axis stop code.
956 Public axis_e_reference_position As SL ' E axis reference position.
957 Public axis_e_motor_position As SL ' E axis motor position.
958 Public axis_e_position_error As SL ' E axis position
error.
959 Public axis_e_aux_position As SL ' E axis auxiliary position.
960 Public axis_e_velocity As SL ' E axis velocity.
961 Public axis_e_torque As SL ' E axis torque.
962 Public axis_e_analog_in As UW ' E axis analog input.
963 Public axis_e_halls As UB ' E Hall Input Status.
964 Public axis_e_reserved As UB ' Reserved.
965 Public axis_e_variable As SL ' E User-defined variable (ZA).
967 Public axis_f_status As UW ' F axis status.
968 Public axis_f_switches As UB ' F axis switches.
969 Public axis_f_stop_code As UB ' F axis stop code.
970 Public axis_f_reference_position As SL ' F axis reference position.
971 Public axis_f_motor_position As SL ' F axis motor position.
972 Public axis_f_position_error As SL ' F axis position
error.
973 Public axis_f_aux_position As SL ' F axis auxiliary position.
974 Public axis_f_velocity As SL ' F axis velocity.
975 Public axis_f_torque As SL ' F axis torque.
976 Public axis_f_analog_in As UW ' F axis analog input.
977 Public axis_f_halls As UB ' F Hall Input Status.
978 Public axis_f_reserved As UB ' Reserved.
979 Public axis_f_variable As SL ' F User-defined variable (ZA).
981 Public axis_g_status As UW ' G axis status.
982 Public axis_g_switches As UB ' G axis switches.
983 Public axis_g_stop_code As UB ' G axis stop code.
984 Public axis_g_reference_position As SL ' G axis reference position.
985 Public axis_g_motor_position As SL ' G axis motor position.
986 Public axis_g_position_error As SL ' G axis position
error.
987 Public axis_g_aux_position As SL ' G axis auxiliary position.
988 Public axis_g_velocity As SL ' G axis velocity.
989 Public axis_g_torque As SL ' G axis torque.
990 Public axis_g_analog_in As UW ' G axis analog input.
991 Public axis_g_halls As UB ' G Hall Input Status.
992 Public axis_g_reserved As UB ' Reserved.
993 Public axis_g_variable As SL ' G User-defined variable (ZA).
995 Public axis_h_status As UW ' H axis status.
996 Public axis_h_switches As UB ' H axis switches.
997 Public axis_h_stop_code As UB ' H axis stop code.
998 Public axis_h_reference_position As SL ' H axis reference position.
999 Public axis_h_motor_position As SL ' H axis motor position.
1000 Public axis_h_position_error As SL ' H axis position
error.
1001 Public axis_h_aux_position As SL ' H axis auxiliary position.
1002 Public axis_h_velocity As SL ' H axis velocity.
1003 Public axis_h_torque As SL ' H axis torque.
1004 Public axis_h_analog_in As UW ' H axis analog input.
1005 Public axis_h_halls As UB ' H Hall Input Status.
1006 Public axis_h_reserved As UB ' Reserved.
1007 Public axis_h_variable As SL ' H User-defined variable (ZA).
1009 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1010 Return StructToByteArray(Me)
1014 ' Data record struct for DMC-52000 controller. Same as DMC-4000, with bank indicator added at
byte 40.
1015 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1019 Public header_0 As UB ' 1st Byte of Header.
1020 Public header_1 As UB ' 2nd Byte of Header.
1021 Public header_2 As UB ' 3rd Byte of Header.
1022 Public header_3 As UB ' 4th Byte of Header.
1024 Public sample_number As UW ' sample number.
1026 Public input_bank_0 As UB ' general input bank 0 (inputs 1-8).
1027 Public input_bank_1 As UB ' general input bank 1 (inputs 9-16).
1028 Public input_bank_2 As UB ' general input bank 2 (inputs 17-24).
1029 Public input_bank_3 As UB ' general input bank 3 (inputs 25-32).
1030 Public input_bank_4 As UB ' general input bank 4 (inputs 33-40).
1031 Public input_bank_5 As UB ' general input bank 5 (inputs 41-48).
1032 Public input_bank_6 As UB ' general input bank 6 (inputs 49-56).
1033 Public input_bank_7 As UB ' general input bank 7 (inputs 57-64).
1034 Public input_bank_8 As UB ' general input bank 8 (inputs 65-72).
1035 Public input_bank_9 As UB ' general input bank 9 (inputs 73-80).
1037 Public output_bank_0 As UB ' general output bank 0 (outputs 1-8).
1038 Public output_bank_1 As UB ' general output bank 1 (outputs 9-16).
1039 Public output_bank_2 As UB ' general output bank 2 (outputs 17-24).
1040 Public output_bank_3 As UB ' general output bank 3 (outputs 25-32).
1041 Public output_bank_4 As UB ' general output bank 4 (outputs 33-40).
1042 Public output_bank_5 As UB ' general output bank 5 (outputs 41-48).
1043 Public output_bank_6 As UB ' general output bank 6 (outputs 49-56).
1044 Public output_bank_7 As UB ' general output bank 7 (outputs 57-64).
1045 Public output_bank_8 As UB ' general output bank 8 (outputs 65-72).
1046 Public output_bank_9 As UB ' general output bank 9 (outputs 73-80).
1048 Public reserved_0 As SW ' Reserved.
1049 Public reserved_2 As SW ' Reserved.
1050 Public reserved_4 As SW ' Reserved.
1051 Public reserved_6 As SW ' Reserved.
1052 Public reserved_8 As SW ' Reserved.
1053 Public reserved_10 As SW ' Reserved.
1054 Public reserved_12 As SW ' Reserved.
1055 Public ethercat_bank As UB ' EtherCAT Bank Indicator.
1056 Public reserved_14 As UB ' Reserved.
1058 Public ethernet_status_a As UB ' Ethernet Handle A Status.
1059 Public ethernet_status_b As UB ' Ethernet Handle B Status.
1060 Public ethernet_status_c As UB ' Ethernet Handle C Status.
1061 Public ethernet_status_d As UB ' Ethernet Handle D Status.
1062 Public ethernet_status_e As UB ' Ethernet Handle E Status.
1063 Public ethernet_status_f As UB ' Ethernet Handle F Status.
1064 Public ethernet_status_g As UB ' Ethernet Handle G Status.
1065 Public ethernet_status_h As UB ' Ethernet Handle H Status.
1068 Public thread_status As UB ' thread status
1069 Public amplifier_status As UL ' Amplifier Status.
1071 Public contour_segment_count As UL ' Segment Count for Contour Mode.
1072 Public contour_buffer_available As UW ' Buffer space remaining, Contour Mode.
1074 Public s_plane_segment_count As UW ' segment count of coordinated move for S plane.
1075 Public s_plane_move_status As UW ' coordinated move status for S plane.
1076 Public s_distance As SL ' distance traveled in coordinated move for S plane.
1077 Public s_plane_buffer_available As UW ' Buffer space remaining, S Plane.
1079 Public t_plane_segment_count As UW ' segment count of coordinated move for T plane.
1080 Public t_plane_move_status As UW ' Coordinated move status for T plane.
1081 Public t_distance As SL ' distance traveled in coordinated move for T plane.
1082 Public t_plane_buffer_available As UW ' Buffer space remaining, T Plane.
1084 Public axis_a_status As UW ' A axis status.
1085 Public axis_a_switches As UB ' A axis switches.
1086 Public axis_a_stop_code As UB ' A axis stop code.
1087 Public axis_a_reference_position As SL ' A axis reference position.
1088 Public axis_a_motor_position As SL ' A axis motor position.
1089 Public axis_a_position_error As SL ' A axis position
error.
1090 Public axis_a_aux_position As SL ' A axis auxiliary position.
1091 Public axis_a_velocity As SL ' A axis velocity.
1092 Public axis_a_torque As SL ' A axis torque.
1093 Public axis_a_analog_in As UW ' A axis analog input.
1094 Public axis_a_halls As UB ' A Hall Input Status.
1095 Public axis_a_reserved As UB ' Reserved.
1096 Public axis_a_variable As SL ' A User-defined variable (ZA).
1098 Public axis_b_status As UW ' B axis status.
1099 Public axis_b_switches As UB ' B axis switches.
1100 Public axis_b_stop_code As UB ' B axis stop code.
1101 Public axis_b_reference_position As SL ' B axis reference position.
1102 Public axis_b_motor_position As SL ' B axis motor position.
1103 Public axis_b_position_error As SL ' B axis position
error.
1104 Public axis_b_aux_position As SL ' B axis auxiliary position.
1105 Public axis_b_velocity As SL ' B axis velocity.
1106 Public axis_b_torque As SL ' B axis torque.
1107 Public axis_b_analog_in As UW ' B axis analog input.
1108 Public axis_b_halls As UB ' B Hall Input Status.
1109 Public axis_b_reserved As UB ' Reserved.
1110 Public axis_b_variable As SL ' B User-defined variable (ZA).
1112 Public axis_c_status As UW ' C axis status.
1113 Public axis_c_switches As UB ' C axis switches.
1114 Public axis_c_stop_code As UB ' C axis stop code.
1115 Public axis_c_reference_position As SL ' C axis reference position.
1116 Public axis_c_motor_position As SL ' C axis motor position.
1117 Public axis_c_position_error As SL ' C axis position
error.
1118 Public axis_c_aux_position As SL ' C axis auxiliary position.
1119 Public axis_c_velocity As SL ' C axis velocity.
1120 Public axis_c_torque As SL ' C axis torque.
1121 Public axis_c_analog_in As UW ' C axis analog input.
1122 Public axis_c_halls As UB ' C Hall Input Status.
1123 Public axis_c_reserved As UB ' Reserved.
1124 Public axis_c_variable As SL ' C User-defined variable (ZA).
1126 Public axis_d_status As UW ' D axis status.
1127 Public axis_d_switches As UB ' D axis switches.
1128 Public axis_d_stop_code As UB ' D axis stop code.
1129 Public axis_d_reference_position As SL ' D axis reference position.
1130 Public axis_d_motor_position As SL ' D axis motor position.
1131 Public axis_d_position_error As SL ' D axis position
error.
1132 Public axis_d_aux_position As SL ' D axis auxiliary position.
1133 Public axis_d_velocity As SL ' D axis velocity.
1134 Public axis_d_torque As SL ' D axis torque.
1135 Public axis_d_analog_in As UW ' D axis analog input.
1136 Public axis_d_halls As UB ' D Hall Input Status.
1137 Public axis_d_reserved As UB ' Reserved.
1138 Public axis_d_variable As SL ' D User-defined variable (ZA).
1140 Public axis_e_status As UW ' E axis status.
1141 Public axis_e_switches As UB ' E axis switches.
1142 Public axis_e_stop_code As UB ' E axis stop code.
1143 Public axis_e_reference_position As SL ' E axis reference position.
1144 Public axis_e_motor_position As SL ' E axis motor position.
1145 Public axis_e_position_error As SL ' E axis position
error.
1146 Public axis_e_aux_position As SL ' E axis auxiliary position.
1147 Public axis_e_velocity As SL ' E axis velocity.
1148 Public axis_e_torque As SL ' E axis torque.
1149 Public axis_e_analog_in As UW ' E axis analog input.
1150 Public axis_e_halls As UB ' E Hall Input Status.
1151 Public axis_e_reserved As UB ' Reserved.
1152 Public axis_e_variable As SL ' E User-defined variable (ZA).
1154 Public axis_f_status As UW ' F axis status.
1155 Public axis_f_switches As UB ' F axis switches.
1156 Public axis_f_stop_code As UB ' F axis stop code.
1157 Public axis_f_reference_position As SL ' F axis reference position.
1158 Public axis_f_motor_position As SL ' F axis motor position.
1159 Public axis_f_position_error As SL ' F axis position
error.
1160 Public axis_f_aux_position As SL ' F axis auxiliary position.
1161 Public axis_f_velocity As SL ' F axis velocity.
1162 Public axis_f_torque As SL ' F axis torque.
1163 Public axis_f_analog_in As UW ' F axis analog input.
1164 Public axis_f_halls As UB ' F Hall Input Status.
1165 Public axis_f_reserved As UB ' Reserved.
1166 Public axis_f_variable As SL ' F User-defined variable (ZA).
1168 Public axis_g_status As UW ' G axis status.
1169 Public axis_g_switches As UB ' G axis switches.
1170 Public axis_g_stop_code As UB ' G axis stop code.
1171 Public axis_g_reference_position As SL ' G axis reference position.
1172 Public axis_g_motor_position As SL ' G axis motor position.
1173 Public axis_g_position_error As SL ' G axis position
error.
1174 Public axis_g_aux_position As SL ' G axis auxiliary position.
1175 Public axis_g_velocity As SL ' G axis velocity.
1176 Public axis_g_torque As SL ' G axis torque.
1177 Public axis_g_analog_in As UW ' G axis analog input.
1178 Public axis_g_halls As UB ' G Hall Input Status.
1179 Public axis_g_reserved As UB ' Reserved.
1180 Public axis_g_variable As SL ' G User-defined variable (ZA).
1182 Public axis_h_status As UW ' H axis status.
1183 Public axis_h_switches As UB ' H axis switches.
1184 Public axis_h_stop_code As UB ' H axis stop code.
1185 Public axis_h_reference_position As SL ' H axis reference position.
1186 Public axis_h_motor_position As SL ' H axis motor position.
1187 Public axis_h_position_error As SL ' H axis position
error.
1188 Public axis_h_aux_position As SL ' H axis auxiliary position.
1189 Public axis_h_velocity As SL ' H axis velocity.
1190 Public axis_h_torque As SL ' H axis torque.
1191 Public axis_h_analog_in As UW ' H axis analog input.
1192 Public axis_h_halls As UB ' H Hall Input Status.
1193 Public axis_h_reserved As UB ' Reserved.
1194 Public axis_h_variable As SL ' H User-defined variable (ZA).
1196 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1197 Return StructToByteArray(Me)
1202 'Data record struct for DMC-1806 controller.
1204 'The 18x6 Data record Is the same as 4000 except the following.
1205 '-
# No header bytes. Firmware strips it in DR. Software removes it from QR.
1206 '-# No Ethernet status (bytes 42-49).
1207 '-# No amplfifier status (bytes 52-55).
1208 '-# No axis-specific hall input status.
1209 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1210 Public Structure GDataRecord1806
1211 Implements GDataRecord
1213 Public sample_number As UW ' sample number.
1215 Public input_bank_0 As UB
'/*02*/ general input bank 0 (inputs 1-8).
1216 Public input_bank_1 As UB ' general input bank 1 (inputs 9-16).
1217 Public input_bank_2 As UB
'/*04*/ general input bank 2 (inputs 17-24).
1218 Public input_bank_3 As UB ' general input bank 3 (inputs 25-32).
1219 Public input_bank_4 As UB
'/*06*/ general input bank 4 (inputs 33-40).
1220 Public input_bank_5 As UB ' general input bank 5 (inputs 41-48).
1221 Public input_bank_6 As UB
'/*08*/ general input bank 6 (inputs 49-56).
1222 Public input_bank_7 As UB ' general input bank 7 (inputs 57-64).
1223 Public input_bank_8 As UB
'/*10*/ general input bank 8 (inputs 65-72).
1224 Public input_bank_9 As UB ' general input bank 9 (inputs 73-80).
1226 Public output_bank_0 As UB
'/*12*/ general output bank 0 (outputs 1-8).
1227 Public output_bank_1 As UB ' general output bank 1 (outputs 9-16).
1228 Public output_bank_2 As UB
'/*14*/ general output bank 2 (outputs 17-24).
1229 Public output_bank_3 As UB ' general output bank 3 (outputs 25-32).
1230 Public output_bank_4 As UB
'/*16*/ general output bank 4 (outputs 33-40).
1231 Public output_bank_5 As UB ' general output bank 5 (outputs 41-48).
1232 Public output_bank_6 As UB
'/*18*/ general output bank 6 (outputs 49-56).
1233 Public output_bank_7 As UB ' general output bank 7 (outputs 57-64).
1234 Public output_bank_8 As UB
'/*20*/ general output bank 8 (outputs 65-72).
1235 Public output_bank_9 As UB ' general output bank 9 (outputs 73-80).
1237 Public reserved_0 As SW
'/*22-23*/ Reserved.
1238 Public reserved_2 As SW ' Reserved.
1239 Public reserved_4 As SW
'/*26-27*/ Reserved.
1240 Public reserved_6 As SW ' Reserved.
1241 Public reserved_8 As SW
'/*30-31*/ Reserved.
1242 Public reserved_10 As SW ' Reserved.
1243 Public reserved_12 As SW
'/*34-35*/ Reserved.
1244 Public reserved_14 As SW ' Reserved.
1246 Public reserved_16 As UB
'/*38*/ Reserved.
1247 Public reserved_17 As UB ' Reserved.
1248 Public reserved_18 As UB
'/*40*/ Reserved.
1249 Public reserved_19 As UB ' Reserved.
1250 Public reserved_20 As UB
'/*42*/ Reserved.
1251 Public reserved_21 As UB ' Reserved.
1252 Public reserved_22 As UB
'/*44*/ Reserved.
1253 Public reserved_23 As UB ' Reserved.
1255 Public error_code As UB
'/*46*/ error code.
1256 Public thread_status As UB ' thread status.
1257 Public reserved_24 As UL
'/*48-51*/ Reserved.
1259 Public contour_segment_count As UL ' Segment Count
for Contour Mode.
1260 Public contour_buffer_available As UW
'/*56-57*/ Buffer space remaining, Contour Mode.
1262 Public s_plane_segment_count As UW ' segment count of coordinated move
for S plane.
1263 Public s_plane_move_status As UW
'/*60-61*/ coordinated move status for S plane.
1264 Public s_distance As SL ' distance traveled in coordinated move
for S plane.
1265 Public s_plane_buffer_available As UW
'/*66-67*/ Buffer space remaining, S Plane.
1267 Public t_plane_segment_count As UW ' segment count of coordinated move
for T plane.
1268 Public t_plane_move_status As UW
'/*70-71*/ Coordinated move status for T plane.
1269 Public t_distance As SL ' distance traveled in coordinated move
for T plane.
1270 Public t_plane_buffer_available As UW
'/*76-77*/ Buffer space remaining, T Plane.
1272 Public axis_a_status As UW ' A axis status.
1273 Public axis_a_switches As UB
'/*80*/ A axis switches.
1274 Public axis_a_stop_code As UB ' A axis stop code.
1275 Public axis_a_reference_position As SL
'/*82-85*/ A axis reference position.
1276 Public axis_a_motor_position As SL ' A axis motor position.
1277 Public axis_a_position_error As SL
'/*90-93*/ A axis position error.
1278 Public axis_a_aux_position As SL ' A axis auxiliary position.
1279 Public axis_a_velocity As SL
'/*98-101*/ A axis velocity.
1280 Public axis_a_torque As SL ' A axis torque.
1281 Public axis_a_analog_in As UW
'/*106-107*/ A axis analog input.
1282 Public axis_a_reserved_0 As UB ' Reserved.
1283 Public axis_a_reserved_1 As UB
'/*109*/ Reserved.
1284 Public axis_a_variable As SL ' A User-defined variable (ZA).
1286 Public axis_b_status As UW
'/*114-115*/ B axis status.
1287 Public axis_b_switches As UB ' B axis switches.
1288 Public axis_b_stop_code As UB
'/*117*/ B axis stop code.
1289 Public axis_b_reference_position As SL ' B axis reference position.
1290 Public axis_b_motor_position As SL
'/*122-125*/ B axis motor position.
1291 Public axis_b_position_error As SL ' B axis position
error.
1292 Public axis_b_aux_position As SL
'/*130-133*/ B axis auxiliary position.
1293 Public axis_b_velocity As SL ' B axis velocity.
1294 Public axis_b_torque As SL
'/*138-141*/ B axis torque.
1295 Public axis_b_analog_in As UW ' B axis analog input.
1296 Public axis_b_reserved_0 As UB
'/*144*/ Reserved.
1297 Public axis_b_reserved_1 As UB ' Reserved.
1298 Public axis_b_variable As SL
'/*146-149*/ B User-defined variable (ZA).
1300 Public axis_c_status As UW ' C axis status.
1301 Public axis_c_switches As UB
'/*152*/ C axis switches.
1302 Public axis_c_stop_code As UB ' C axis stop code.
1303 Public axis_c_reference_position As SL
'/*154-157*/ C axis reference position.
1304 Public axis_c_motor_position As SL ' C axis motor position.
1305 Public axis_c_position_error As SL
'/*162-165*/ C axis position error.
1306 Public axis_c_aux_position As SL ' C axis auxiliary position.
1307 Public axis_c_velocity As SL
'/*170-173*/ C axis velocity.
1308 Public axis_c_torque As SL ' C axis torque.
1309 Public axis_c_analog_in As UW
'/*178-179*/ C axis analog input.
1310 Public axis_c_reserved_0 As UB ' Reserved.
1311 Public axis_c_reserved_1 As UB
'/*181*/ Reserved.
1312 Public axis_c_variable As SL ' C User-defined variable (ZA).
1314 Public axis_d_status As UW
'/*186-187*/ D axis status.
1315 Public axis_d_switches As UB ' D axis switches.
1316 Public axis_d_stop_code As UB
'/*189*/ D axis stop code.
1317 Public axis_d_reference_position As SL ' D axis reference position.
1318 Public axis_d_motor_position As SL
'/*194-197*/ D axis motor position.
1319 Public axis_d_position_error As SL ' D axis position
error.
1320 Public axis_d_aux_position As SL
'/*202-205*/ D axis auxiliary position.
1321 Public axis_d_velocity As SL ' D axis velocity.
1322 Public axis_d_torque As SL
'/*210-213*/ D axis torque.
1323 Public axis_d_analog_in As UW ' D axis analog input.
1324 Public axis_d_reserved_0 As UB
'/*216*/ Reserved.
1325 Public axis_d_reserved_1 As UB ' Reserved.
1326 Public axis_d_variable As SL
'/*218-221*/ D User-defined variable (ZA).
1328 Public axis_e_status As UW ' E axis status.
1329 Public axis_e_switches As UB
'/*224*/ E axis switches.
1330 Public axis_e_stop_code As UB ' E axis stop code.
1331 Public axis_e_reference_position As SL
'/*226-229*/ E axis reference position.
1332 Public axis_e_motor_position As SL ' E axis motor position.
1333 Public axis_e_position_error As SL
'/*234-237*/ E axis position error.
1334 Public axis_e_aux_position As SL ' E axis auxiliary position.
1335 Public axis_e_velocity As SL
'/*242-245*/ E axis velocity.
1336 Public axis_e_torque As SL ' E axis torque.
1337 Public axis_e_analog_in As UW
'/*250-251*/ E axis analog input.
1338 Public axis_e_reserved_0 As UB ' Reserved.
1339 Public axis_e_reserved_1 As UB
'/*253*/ Reserved.
1340 Public axis_e_variable As SL ' E User-defined variable (ZA).
1342 Public axis_f_status As UW
'/*258-259*/ F axis status.
1343 Public axis_f_switches As UB ' F axis switches.
1344 Public axis_f_stop_code As UB
'/*261*/ F axis stop code.
1345 Public axis_f_reference_position As SL ' F axis reference position.
1346 Public axis_f_motor_position As SL
'/*266-269*/ F axis motor position.
1347 Public axis_f_position_error As SL ' F axis position
error.
1348 Public axis_f_aux_position As SL
'/*274-277*/ F axis auxiliary position.
1349 Public axis_f_velocity As SL ' F axis velocity.
1350 Public axis_f_torque As SL
'/*282-285*/ F axis torque.
1351 Public axis_f_analog_in As UW ' F axis analog input.
1352 Public axis_f_reserved_0 As UB
'/*288*/ Reserved.
1353 Public axis_f_reserved_1 As UB ' Reserved.
1354 Public axis_f_variable As SL
'/*290-293*/ F User-defined variable (ZA).
1356 Public axis_g_status As UW ' G axis status.
1357 Public axis_g_switches As UB
'/*296*/ G axis switches.
1358 Public axis_g_stop_code As UB ' G axis stop code.
1359 Public axis_g_reference_position As SL
'/*298-301*/ G axis reference position.
1360 Public axis_g_motor_position As SL ' G axis motor position.
1361 Public axis_g_position_error As SL
'/*306-309*/ G axis position error.
1362 Public axis_g_aux_position As SL ' G axis auxiliary position.
1363 Public axis_g_velocity As SL
'/*314-317*/ G axis velocity.
1364 Public axis_g_torque As SL ' G axis torque.
1365 Public axis_g_analog_in As UW
'/*322-323*/ G axis analog input.
1366 Public axis_g_reserved_0 As UB ' Reserved.
1367 Public axis_g_reserved_1 As UB
'/*325*/ Reserved.
1368 Public axis_g_variable As SL ' G User-defined variable (ZA).
1370 Public axis_h_status As UW
'/*330-331*/ H axis status.
1371 Public axis_h_switches As UB ' H axis switches.
1372 Public axis_h_stop_code As UB
'/*333*/ H axis stop code.
1373 Public axis_h_reference_position As SL ' H axis reference position.
1374 Public axis_h_motor_position As SL
'/*338-341*/ H axis motor position.
1375 Public axis_h_position_error As SL ' H axis position
error.
1376 Public axis_h_aux_position As SL
'/*346-349*/ H axis auxiliary position.
1377 Public axis_h_velocity As SL ' H axis velocity.
1378 Public axis_h_torque As SL
'/*354-357*/ H axis torque.
1379 Public axis_h_analog_in As UW ' H axis analog input.
1380 Public axis_h_reserved_0 As UB
'/*360*/ Reserved.
1381 Public axis_h_reserved_1 As UB ' Reserved.
1382 Public axis_h_variable As SL
'/*362-365*/ H User-defined variable (ZA).
1384 Public Function byte_array() As Byte() Implements GDataRecord.byte_array
1385 Return StructToByteArray(Me)
1389 ' Data record
struct for DMC-2103 controllers.
1390 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1394 Public header_0 As UB ' 1st Byte of Header.
1395 Public header_1 As UB ' 2nd Byte of Header.
1396 Public header_2 As UB ' 3rd Byte of Header.
1397 Public header_3 As UB ' 4th Byte of Header.
1399 Public sample_number As UW ' sample number.
1401 Public input_bank_0 As UB ' general input bank 0 (inputs 1-8).
1402 Public input_bank_1 As UB ' general input bank 1 (inputs 9-16).
1403 Public input_bank_2 As UB ' general input bank 2 (inputs 17-24).
1404 Public input_bank_3 As UB ' general input bank 3 (inputs 25-32).
1405 Public input_bank_4 As UB ' general input bank 4 (inputs 33-40).
1406 Public input_bank_5 As UB ' general input bank 5 (inputs 41-48).
1407 Public input_bank_6 As UB ' general input bank 6 (inputs 49-56).
1408 Public input_bank_7 As UB ' general input bank 7 (inputs 57-64).
1409 Public input_bank_8 As UB ' general input bank 8 (inputs 65-72).
1410 Public input_bank_9 As UB ' general input bank 9 (inputs 73-80).
1412 Public output_bank_0 As UB ' general output bank 0 (outputs 1-8).
1413 Public output_bank_1 As UB ' general output bank 1 (outputs 9-16).
1414 Public output_bank_2 As UB ' general output bank 2 (outputs 17-24).
1415 Public output_bank_3 As UB ' general output bank 3 (outputs 25-32).
1416 Public output_bank_4 As UB ' general output bank 4 (outputs 33-40).
1417 Public output_bank_5 As UB ' general output bank 5 (outputs 41-48).
1418 Public output_bank_6 As UB ' general output bank 6 (outputs 49-56).
1419 Public output_bank_7 As UB ' general output bank 7 (outputs 57-64).
1420 Public output_bank_8 As UB ' general output bank 8 (outputs 65-72).
1421 Public output_bank_9 As UB ' general output bank 9 (outputs 73-80).
1423 Public error_code As UB '
error code.
1424 Public general_status As UB ' general status
1426 Public s_plane_segment_count As UW ' segment count of coordinated move for S plane.
1427 Public s_plane_move_status As UW ' coordinated move status for S plane.
1428 Public s_distance As SL ' distance traveled in coordinated move for S plane.
1430 Public t_plane_segment_count As UW ' segment count of coordinated move for T plane.
1431 Public t_plane_move_status As UW ' Coordinated move status for T plane.
1432 Public t_distance As SL ' distance traveled in coordinated move for T plane.
1434 Public axis_a_status As UW ' A axis status.
1435 Public axis_a_switches As UB ' A axis switches.
1436 Public axis_a_stop_code As UB ' A axis stop code.
1437 Public axis_a_reference_position As SL ' A axis reference position.
1438 Public axis_a_motor_position As SL ' A axis motor position.
1439 Public axis_a_position_error As SL ' A axis position
error.
1440 Public axis_a_aux_position As SL ' A axis auxiliary position.
1441 Public axis_a_velocity As SL ' A axis velocity.
1442 Public axis_a_torque As SW ' A axis torque.
1443 Public axis_a_analog_in As UW ' A axis analog input.
1445 Public axis_b_status As UW ' B axis status.
1446 Public axis_b_switches As UB ' B axis switches.
1447 Public axis_b_stop_code As UB ' B axis stop code.
1448 Public axis_b_reference_position As SL ' B axis reference position.
1449 Public axis_b_motor_position As SL ' B axis motor position.
1450 Public axis_b_position_error As SL ' B axis position
error.
1451 Public axis_b_aux_position As SL ' B axis auxiliary position.
1452 Public axis_b_velocity As SL ' B axis velocity.
1453 Public axis_b_torque As SW ' B axis torque.
1454 Public axis_b_analog_in As UW ' B axis analog input.
1456 Public axis_c_status As UW ' C axis status.
1457 Public axis_c_switches As UB ' C axis switches.
1458 Public axis_c_stop_code As UB ' C axis stop code.
1459 Public axis_c_reference_position As SL ' C axis reference position.
1460 Public axis_c_motor_position As SL ' C axis motor position.
1461 Public axis_c_position_error As SL ' C axis position
error.
1462 Public axis_c_aux_position As SL ' C axis auxiliary position.
1463 Public axis_c_velocity As SL ' C axis velocity.
1464 Public axis_c_torque As SW ' C axis torque.
1465 Public axis_c_analog_in As UW ' C axis analog input.
1467 Public axis_d_status As UW ' D axis status.
1468 Public axis_d_switches As UB ' D axis switches.
1469 Public axis_d_stop_code As UB ' D axis stop code.
1470 Public axis_d_reference_position As SL ' D axis reference position.
1471 Public axis_d_motor_position As SL ' D axis motor position.
1472 Public axis_d_position_error As SL ' D axis position
error.
1473 Public axis_d_aux_position As SL ' D axis auxiliary position.
1474 Public axis_d_velocity As SL ' D axis velocity.
1475 Public axis_d_torque As SW ' D axis torque.
1476 Public axis_d_analog_in As UW ' D axis analog input.
1478 Public axis_e_status As UW ' E axis status.
1479 Public axis_e_switches As UB ' E axis switches.
1480 Public axis_e_stop_code As UB ' E axis stop code.
1481 Public axis_e_reference_position As SL ' E axis reference position.
1482 Public axis_e_motor_position As SL ' E axis motor position.
1483 Public axis_e_position_error As SL ' E axis position
error.
1484 Public axis_e_aux_position As SL ' E axis auxiliary position.
1485 Public axis_e_velocity As SL ' E axis velocity.
1486 Public axis_e_torque As SW ' E axis torque.
1487 Public axis_e_analog_in As UW ' E axis analog input.
1489 Public axis_f_status As UW ' F axis status.
1490 Public axis_f_switches As UB ' F axis switches.
1491 Public axis_f_stop_code As UB ' F axis stop code.
1492 Public axis_f_reference_position As SL ' F axis reference position.
1493 Public axis_f_motor_position As SL ' F axis motor position.
1494 Public axis_f_position_error As SL ' F axis position
error.
1495 Public axis_f_aux_position As SL ' F axis auxiliary position.
1496 Public axis_f_velocity As SL ' F axis velocity.
1497 Public axis_f_torque As SW ' F axis torque.
1498 Public axis_f_analog_in As UW ' F axis analog input.
1500 Public axis_g_status As UW ' G axis status.
1501 Public axis_g_switches As UB ' G axis switches.
1502 Public axis_g_stop_code As UB ' G axis stop code.
1503 Public axis_g_reference_position As SL ' G axis reference position.
1504 Public axis_g_motor_position As SL ' G axis motor position.
1505 Public axis_g_position_error As SL ' G axis position
error.
1506 Public axis_g_aux_position As SL ' G axis auxiliary position.
1507 Public axis_g_velocity As SL ' G axis velocity.
1508 Public axis_g_torque As SW ' G axis torque.
1509 Public axis_g_analog_in As UW ' G axis analog input.
1511 Public axis_h_status As UW ' H axis status.
1512 Public axis_h_switches As UB ' H axis switches.
1513 Public axis_h_stop_code As UB ' H axis stop code.
1514 Public axis_h_reference_position As SL ' H axis reference position.
1515 Public axis_h_motor_position As SL ' H axis motor position.
1516 Public axis_h_position_error As SL ' H axis position
error.
1517 Public axis_h_aux_position As SL ' H axis auxiliary position.
1518 Public axis_h_velocity As SL ' H axis velocity.
1519 Public axis_h_torque As SW ' H axis torque.
1520 Public axis_h_analog_in As UW ' H axis analog input.
1522 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1523 Return StructToByteArray(Me)
1527 ' Data record struct for DMC-1802 controllers.
1529 'The 18x2 Data record Is the Same as 2103 except the following.
1530 '-# No header bytes. Software removes it from QR.
1531 '-# No analog in axis data.
1532 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1536 Public sample_number As UW ' sample number.
1538 Public input_bank_0 As UB ' general input bank 0 (inputs 1-8).
1539 Public input_bank_1 As UB ' general input bank 1 (inputs 9-16).
1540 Public input_bank_2 As UB ' general input bank 2 (inputs 17-24).
1541 Public input_bank_3 As UB ' general input bank 3 (inputs 25-32).
1542 Public input_bank_4 As UB ' general input bank 4 (inputs 33-40).
1543 Public input_bank_5 As UB ' general input bank 5 (inputs 41-48).
1544 Public input_bank_6 As UB ' general input bank 6 (inputs 49-56).
1545 Public input_bank_7 As UB ' general input bank 7 (inputs 57-64).
1546 Public input_bank_8 As UB ' general input bank 8 (inputs 65-72).
1547 Public input_bank_9 As UB ' general input bank 9 (inputs 73-80).
1549 Public output_bank_0 As UB ' general output bank 0 (outputs 1-8).
1550 Public output_bank_1 As UB ' general output bank 1 (outputs 9-16).
1551 Public output_bank_2 As UB ' general output bank 2 (outputs 17-24).
1552 Public output_bank_3 As UB ' general output bank 3 (outputs 25-32).
1553 Public output_bank_4 As UB ' general output bank 4 (outputs 33-40).
1554 Public output_bank_5 As UB ' general output bank 5 (outputs 41-48).
1555 Public output_bank_6 As UB ' general output bank 6 (outputs 49-56).
1556 Public output_bank_7 As UB ' general output bank 7 (outputs 57-64).
1557 Public output_bank_8 As UB ' general output bank 8 (outputs 65-72).
1558 Public output_bank_9 As UB ' general output bank 9 (outputs 73-80).
1560 Public error_code As UB '
error code.
1561 Public general_status As UB ' general status
1563 Public s_plane_segment_count As UW ' segment count of coordinated move for S plane.
1564 Public s_plane_move_status As UW ' coordinated move status for S plane.
1565 Public s_distance As SL ' distance traveled in coordinated move for S plane.
1567 Public t_plane_segment_count As UW ' segment count of coordinated move for T plane.
1568 Public t_plane_move_status As UW ' Coordinated move status for T plane.
1569 Public t_distance As SL ' distance traveled in coordinated move for T plane.
1571 Public axis_a_status As UW ' A axis status.
1572 Public axis_a_switches As UB ' A axis switches.
1573 Public axis_a_stop_code As UB ' A axis stop code.
1574 Public axis_a_reference_position As SL ' A axis reference position.
1575 Public axis_a_motor_position As SL ' A axis motor position.
1576 Public axis_a_position_error As SL ' A axis position
error.
1577 Public axis_a_aux_position As SL ' A axis auxiliary position.
1578 Public axis_a_velocity As SL ' A axis velocity.
1579 Public axis_a_torque As SW ' A axis torque.
1580 Public axis_a_reserved_0 As UB ' Reserved.
1581 Public axis_a_reserved_1 As UB ' Reserved.
1583 Public axis_b_status As UW ' B axis status.
1584 Public axis_b_switches As UB ' B axis switches.
1585 Public axis_b_stop_code As UB ' B axis stop code.
1586 Public axis_b_reference_position As SL ' B axis reference position.
1587 Public axis_b_motor_position As SL ' B axis motor position.
1588 Public axis_b_position_error As SL ' B axis position
error.
1589 Public axis_b_aux_position As SL ' B axis auxiliary position.
1590 Public axis_b_velocity As SL ' B axis velocity.
1591 Public axis_b_torque As SW ' B axis torque.
1592 Public axis_b_reserved_0 As UB ' Reserved.
1593 Public axis_b_reserved_1 As UB ' Reserved.
1595 Public axis_c_status As UW ' C axis status.
1596 Public axis_c_switches As UB ' C axis switches.
1597 Public axis_c_stop_code As UB ' C axis stop code.
1598 Public axis_c_reference_position As SL ' C axis reference position.
1599 Public axis_c_motor_position As SL ' C axis motor position.
1600 Public axis_c_position_error As SL ' C axis position
error.
1601 Public axis_c_aux_position As SL ' C axis auxiliary position.
1602 Public axis_c_velocity As SL ' C axis velocity.
1603 Public axis_c_torque As SW ' C axis torque.
1604 Public axis_c_reserved_0 As UB ' Reserved.
1605 Public axis_c_reserved_1 As UB ' Reserved.
1607 Public axis_d_status As UW ' D axis status.
1608 Public axis_d_switches As UB ' D axis switches.
1609 Public axis_d_stop_code As UB ' D axis stop code.
1610 Public axis_d_reference_position As SL ' D axis reference position.
1611 Public axis_d_motor_position As SL ' D axis motor position.
1612 Public axis_d_position_error As SL ' D axis position
error.
1613 Public axis_d_aux_position As SL ' D axis auxiliary position.
1614 Public axis_d_velocity As SL ' D axis velocity.
1615 Public axis_d_torque As SW ' D axis torque.
1616 Public axis_d_reserved_0 As UB ' Reserved.
1617 Public axis_d_reserved_1 As UB ' Reserved.
1619 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1620 Return StructToByteArray(Me)
1624 ' Data record struct for DMC-30010 controllers.
1625 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1629 Public header_0 As UB ' 1st Byte of Header.
1630 Public header_1 As UB ' 2nd Byte of Header.
1631 Public header_2 As UB ' 3rd Byte of Header.
1632 Public header_3 As UB ' 4th Byte of Header.
1634 Public sample_number As UW ' sample number.
1636 Public input_bank_0 As UB ' general input bank 0 (inputs 1-8).
1637 Public input_bank_1 As UB ' general input bank 1 (inputs 9-16).
1639 Public output_bank_0 As UB ' general output bank 0 (outputs 1-8).
1640 Public output_bank_1 As UB ' general output bank 1 (outputs 9-16).
1642 Public error_code As UB '
error code.
1643 Public thread_status As UB ' thread status.
1645 Public input_analog_2 As UW ' Analog input 2. 1 is in axis data, see axis_a_analog_in.
1647 Public output_analog_1 As UW ' Analog output 1.
1648 Public output_analog_2 As UW ' Analog output 2.
1650 Public amplifier_status As UL ' Amplifier Status.
1652 Public contour_segment_count As UL ' Segment Count for Contour Mode.
1653 Public contour_buffer_available As UW ' Buffer space remaining, Contour Mode.
1655 Public s_plane_segment_count As UW ' segment count of coordinated move for S plane.
1656 Public s_plane_move_status As UW ' coordinated move status for S plane.
1657 Public s_distance As SL ' distance traveled in coordinated move for S plane.
1658 Public s_plane_buffer_available As UW ' Buffer space remaining, S Plane.
1660 Public axis_a_status As UW ' A axis status.
1661 Public axis_a_switches As UB ' A axis switches.
1662 Public axis_a_stop_code As UB ' A axis stop code.
1663 Public axis_a_reference_position As SL ' A axis reference position.
1664 Public axis_a_motor_position As SL ' A axis motor position.
1665 Public axis_a_position_error As SL ' A axis position
error.
1666 Public axis_a_aux_position As SL ' A axis auxiliary position.
1667 Public axis_a_velocity As SL ' A axis velocity.
1668 Public axis_a_torque As SL ' A axis torque.
1669 Public axis_a_analog_in As UW ' A axis analog input.
1670 Public axis_a_halls As UB ' A Hall Input Status.
1671 Public axis_a_reserved As UB ' Reserved.
1672 Public axis_a_variable As SL ' A User-defined variable (ZA).
1674 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1675 Return StructToByteArray(Me)
1679 ' Data record struct for RIO-471xx and RIO-472xx PLCs. Includes encoder fields.
1680 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1684 Public header_0 As UB ' 1st Byte of Header.
1685 Public header_1 As UB ' 2nd Byte of Header.
1686 Public header_2 As UB ' 3rd Byte of Header.
1687 Public header_3 As UB ' 4th Byte of Header.
1689 Public sample_number As UW ' Sample number.
1690 Public error_code As UB ' Error code.
1691 Public general_status As UB ' General status.
1693 Public output_analog_0 As UW ' Analog output 0.
1694 Public output_analog_1 As UW ' Analog output 1.
1695 Public output_analog_2 As UW ' Analog output 2.
1696 Public output_analog_3 As UW ' Analog output 3.
1697 Public output_analog_4 As UW ' Analog output 4.
1698 Public output_analog_5 As UW ' Analog output 5.
1699 Public output_analog_6 As UW ' Analog output 6.
1700 Public output_analog_7 As UW ' Analog output 7.
1702 Public input_analog_0 As UW ' Analog input 0.
1703 Public input_analog_1 As UW ' Analog input 1.
1704 Public input_analog_2 As UW ' Analog input 2.
1705 Public input_analog_3 As UW ' Analog input 3.
1706 Public input_analog_4 As UW ' Analog input 4.
1707 Public input_analog_5 As UW ' Analog input 5.
1708 Public input_analog_6 As UW ' Analog input 6.
1709 Public input_analog_7 As UW ' Analog input 7.
1711 Public output_bank_0 As UW ' Digital outputs 0-15;
1713 Public input_bank_0 As UW ' Digital inputs 0-15;
1715 Public pulse_count_0 As UL ' Pulse counter (see PC).
1716 Public zc_variable As SL ' ZC User-defined variable (see ZC).
1717 Public zd_variable As SL ' ZD User-defined variable (see ZD).
1719 Public encoder_0 As SL ' Encoder channel 0. Data only valid for parts with -BISS, -QUAD, or -SSI.
1720 Public encoder_1 As SL ' Encoder channel 1. Data only valid for parts with -BISS, -QUAD, or -SSI.
1721 Public encoder_2 As SL ' Encoder channel 2. Data only valid for parts with -BISS, -QUAD, or -SSI.
1722 Public encoder_3 As SL ' Encoder channel 3. Data only valid for parts with -BISS, -QUAD, or -SSI.
1724 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1725 Return StructToByteArray(Me)
1729 ' Data record struct for RIO-47300. Includes encoder fields.
1730 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1734 Public header_0 As UB ' 1st Byte of Header.
1735 Public header_1 As UB ' 2nd Byte of Header.
1736 Public header_2 As UB ' 3rd Byte of Header.
1737 Public header_3 As UB ' 4th Byte of Header.
1739 Public sample_number As UW ' Sample number.
1740 Public error_code As UB ' Error code.
1741 Public general_status As UB ' General status.
1743 Public output_analog_0 As UW ' Analog output 0.
1744 Public output_analog_1 As UW ' Analog output 1.
1745 Public output_analog_2 As UW ' Analog output 2.
1746 Public output_analog_3 As UW ' Analog output 3.
1747 Public output_analog_4 As UW ' Analog output 4.
1748 Public output_analog_5 As UW ' Analog output 5.
1749 Public output_analog_6 As UW ' Analog output 6.
1750 Public output_analog_7 As UW ' Analog output 7.
1752 Public input_analog_0 As UW ' Analog input 0.
1753 Public input_analog_1 As UW ' Analog input 1.
1754 Public input_analog_2 As UW ' Analog input 2.
1755 Public input_analog_3 As UW ' Analog input 3.
1756 Public input_analog_4 As UW ' Analog input 4.
1757 Public input_analog_5 As UW ' Analog input 5.
1758 Public input_analog_6 As UW ' Analog input 6.
1759 Public input_analog_7 As UW ' Analog input 7.
1761 Public output_bank_0 As UW ' Digital outputs 0-15;
1762 Public output_bank_1 As UW ' Digital outputs 16-23;
1764 Public input_bank_0 As UW ' Digital inputs 0-15;
1765 Public input_bank_1 As UW ' Digital inputs 16-23;
1767 Public pulse_count_0 As UL ' Pulse counter (see PC).
1768 Public zc_variable As SL ' ZC User-defined variable (see ZC).
1769 Public zd_variable As SL ' ZD User-defined variable (see ZD).
1771 Public encoder_0 As SL ' Encoder channel 0. Data only valid for parts with -BISS, -QUAD, or -SSI.
1772 Public encoder_1 As SL ' Encoder channel 1. Data only valid for parts with -BISS, -QUAD, or -SSI.
1773 Public encoder_2 As SL ' Encoder channel 2. Data only valid for parts with -BISS, -QUAD, or -SSI.
1774 Public encoder_3 As SL ' Encoder channel 3. Data only valid for parts with -BISS, -QUAD, or -SSI.
1776 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1777 Return StructToByteArray(Me)
1781 ' Data record struct for RIO-47300 with 24EX I/O daughter board.
1782 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1786 Public header_0 As UB ' 1st Byte of Header.
1787 Public header_1 As UB ' 2nd Byte of Header.
1788 Public header_2 As UB ' 3rd Byte of Header.
1789 Public header_3 As UB ' 4th Byte of Header.
1791 Public sample_number As UW ' Sample number.
1792 Public error_code As UB ' Error code.
1793 Public general_status As UB ' General status.
1795 Public output_analog_0 As UW ' Analog output 0.
1796 Public output_analog_1 As UW ' Analog output 1.
1797 Public output_analog_2 As UW ' Analog output 2.
1798 Public output_analog_3 As UW ' Analog output 3.
1799 Public output_analog_4 As UW ' Analog output 4.
1800 Public output_analog_5 As UW ' Analog output 5.
1801 Public output_analog_6 As UW ' Analog output 6.
1802 Public output_analog_7 As UW ' Analog output 7.
1804 Public input_analog_0 As UW ' Analog input 0.
1805 Public input_analog_1 As UW ' Analog input 1.
1806 Public input_analog_2 As UW ' Analog input 2.
1807 Public input_analog_3 As UW ' Analog input 3.
1808 Public input_analog_4 As UW ' Analog input 4.
1809 Public input_analog_5 As UW ' Analog input 5.
1810 Public input_analog_6 As UW ' Analog input 6.
1811 Public input_analog_7 As UW ' Analog input 7.
1813 Public output_bank_0 As UW ' Digital outputs 0-15.
1814 Public output_bank_1 As UW ' Digital outputs 16-23.
1816 Public input_bank_0 As UW ' Digital inputs 0-15.
1817 Public input_bank_1 As UW ' Digital inputs 16-23.
1819 Public pulse_count_0 As UL ' Pulse counter (see PC)8.
1820 Public zc_variable As SL ' ZC User-defined variable (see ZC).
1821 Public zd_variable As SL ' ZD User-defined variable (see ZD).
1823 Public output_bank_2 As UW ' Digital outputs 24-39. Data only valid for parts with 24EXOUT.
1824 Public output_back_3 As UW ' Digital outputs 40-47. Data only valid for parts with 24EXOUT.
1826 Public input_bank_2 As UW ' Digital inputs 24-39. Data only valid for parts with 24EXIN.
1827 Public input_bank_3 As UW ' Digital inputs 40-47. Data only valid for parts with 24EXIN.
1829 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1830 Return StructToByteArray(Me)
1834 'Data record struct for RIO-47162.
1835 <StructLayout(LayoutKind.Sequential, Pack:=1)>
1839 Public header_0 As UB ' 1st Byte of Header.
1840 Public header_1 As UB ' 2nd Byte of Header.
1841 Public header_2 As UB ' 3rd Byte of Header.
1842 Public header_3 As UB ' 4th Byte of Header.
1844 Public sample_number As UW ' Sample number.
1845 Public error_code As UB ' Error code.
1846 Public general_status As UB ' General status.
1848 Public output_analog_0 As UW ' Analog output 0.
1849 Public output_analog_1 As UW ' Analog output 1.
1850 Public output_analog_2 As UW ' Analog output 2.
1851 Public output_analog_3 As UW ' Analog output 3.
1852 Public output_analog_4 As UW ' Analog output 4.
1853 Public output_analog_5 As UW ' Analog output 5.
1854 Public output_analog_6 As UW ' Analog output 6.
1855 Public output_analog_7 As UW ' Analog output 7.
1857 Public input_analog_0 As UW ' Analog input 0.
1858 Public input_analog_1 As UW ' Analog input 1.
1859 Public input_analog_2 As UW ' Analog input 2.
1860 Public input_analog_3 As UW ' Analog input 3.
1861 Public input_analog_4 As UW ' Analog input 4.
1862 Public input_analog_5 As UW ' Analog input 5.
1863 Public input_analog_6 As UW ' Analog input 6.
1864 Public input_analog_7 As UW ' Analog input 7.
1866 Public output_byte_0 As UB ' Digital outputs 0-7.
1867 Public output_byte_1 As UB ' Digital outputs 8-15.
1868 Public output_byte_2 As UB ' Digital outputs 16-23.
1870 Public input_byte_0 As UB ' Digital inputs 0-7.
1871 Public input_byte_1 As UB ' Digital inputs 8-15.
1872 Public input_byte_2 As UB ' Digital inputs 16-23.
1873 Public input_byte_3 As UB ' Digital inputs 24-31.
1874 Public input_byte_4 As UB ' Digital inputs 32-39.
1876 Public pulse_count_0 As UL ' Pulse counter (see PC).
1877 Public zc_variable As SL ' ZC User-defined variable (see ZC).
1878 Public zd_variable As SL ' ZD User-defined variable (see ZD).
1880 Public encoder_0 As SL ' Encoder channel 0. Data only valid for parts with -BISS, -QUAD, or -SSI.
1881 Public encoder_1 As SL ' Encoder channel 1. Data only valid for parts with -BISS, -QUAD, or -SSI.
1882 Public encoder_2 As SL ' Encoder channel 2. Data only valid for parts with -BISS, -QUAD, or -SSI.
1883 Public encoder_3 As SL ' Encoder channel 3. Data only valid for parts with -BISS, -QUAD, or -SSI.
1885 Public Function byte_array() As Byte() Implements
GDataRecord.byte_array
1886 Return StructToByteArray(Me)
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete(GCon g, GCStringIn axes)
Blocking call that returns once all axes specified have completed their motion.
GCLIB_DLL_EXPORTED GReturn GCALL GPublishServer(GCStringIn name, GOption publish, GOption save)
Uses GUtility(), G_UTIL_GCAPS_PUBLISH_SERVER to publish local gcaps server to the local network.
GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownloadFile(GCon g, GCStringIn file_path)
Array download from file.
GCLIB_DLL_EXPORTED GReturn GCALL GFirmwareDownload(GCon g, GCStringIn filepath)
Upgrade firmware.
GCLIB_DLL_EXPORTED GReturn GCALL GRecord(GCon g, union GDataRecord *record, GOption method)
Provides a fresh copy of the controller's data record. Data is cast into a union, GDataRecord.
GCLIB_DLL_EXPORTED GReturn GCALL GAssign(GCStringIn ip, GCStringIn mac)
Uses GUtility(), G_UTIL_GCAPS_ASSIGN or G_UTIL_ASSIGN to assign an IP address over the Ethernet to a ...
GCLIB_DLL_EXPORTED GReturn GCALL GArrayUploadFile(GCon g, GCStringIn file_path, GCStringIn names)
Array upload to file.
GCLIB_DLL_EXPORTED GReturn GCALL GClose(GCon g)
Closes a connection to a Galil Controller.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor)
Program download from file.
GCLIB_DLL_EXPORTED GReturn GCALL GIpRequests(GCStringOut requests, GSize requests_len)
Uses GUtility(), G_UTIL_GCAPS_IPREQUEST or G_UTIL_IPREQUEST to provide a list of all Galil controller...
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 GListServers(GCStringOut servers, GSize servers_len)
Uses GUtility(), G_UTIL_GCAPS_LIST_SERVERS to provide a list of all available gcaps services on the l...
GCLIB_DLL_EXPORTED GReturn GCALL GSetupDownloadFile(GCon g, GCStringIn file_path, GOption options, GCStringOut info, GSize info_len)
Download a saved controller configuration from a file.
GCLIB_DLL_EXPORTED GReturn GCALL GVersion(GCStringOut ver, GSize ver_len)
Uses GUtility(), G_UTIL_VERSION and G_UTIL_GCAPS_VERSION to provide the library and gcaps version num...
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 GRemoteConnections(GCStringOut connections, GSize connections_length)
Uses GUtility(), G_UTIL_GCAPS_REMOTE_CONNECTIONS to get a list of remote addresses connected to the l...
GCLIB_DLL_EXPORTED GReturn GCALL GWrite(GCon g, GBufIn buffer, GSize buffer_len)
Performs a write on the connection.
GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownload(GCon g, const GCStringIn array_name, GOption first, GOption last, GCStringIn buffer)
Downloads array data to a pre-dimensioned array in the controller's array table.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload(GCon g, GBufOut buffer, GSize buffer_len)
Uploads a program from the controller's program buffer.
GCLIB_DLL_EXPORTED void GCALL GError(GReturn rc, GCStringOut error, GSize error_len)
Provides a human-readable description string for return codes.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path)
Program upload to file.
GCLIB_DLL_EXPORTED GReturn GCALL GMessage(GCon g, GCStringOut buffer, GSize buffer_len)
Provides access to unsolicited messages from the controller.
GCLIB_DLL_EXPORTED GReturn GCALL GRecordRate(GCon g, double period_ms)
Sets the asynchronous data record to a user-specified period via DR.
GCLIB_DLL_EXPORTED GReturn GCALL GCmdI(GCon g, GCStringIn command, int *value)
Wrapper around GCommand that provides the return value of a command parsed into an int.
GCLIB_DLL_EXPORTED GReturn GCALL GServerStatus(GCStringOut status, GSize status_len)
Uses GUtility(), G_UTIL_GCAPS_SERVER_STATUS to get information on the local server name and if it is ...
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 GInfo(GCon g, GCStringOut info, GSize info_len)
Uses GUtility() and G_UTIL_INFO to provide a useful connection string.
GCLIB_DLL_EXPORTED GReturn GCALL GSetServer(GCStringIn server_name)
Uses GUtility(), G_UTIL_GCAPS_SET_SERVER to set the new active server.
GCLIB_DLL_EXPORTED GReturn GCALL GCmdD(GCon g, GCStringIn command, double *value)
Wrapper around GCommand that provides the return value of a command parsed into a double.
GCLIB_DLL_EXPORTED GReturn GCALL GRead(GCon g, GBufOut buffer, GSize buffer_len, GSize *bytes_read)
Performs a read on the connection.
GCLIB_DLL_EXPORTED GReturn GCALL GAddresses(GCStringOut addresses, GSize addresses_len)
Uses GUtility(), G_UTIL_GCAPS_ADDRESSES or G_UTIL_ADDRESSES to provide a listing of all available con...
GCLIB_DLL_EXPORTED GReturn GCALL GOpen(GCStringIn address, GCon *g)
Open a connection to a Galil Controller.
GCLIB_DLL_EXPORTED GReturn GCALL GArrayUpload(GCon g, const GCStringIn array_name, GOption first, GOption last, GOption delim, GBufOut buffer, GSize buffer_len)
Uploads array data from the controller's array table.
int GOption
Option integer for various formatting, etc.
#define G_NO_ERROR
Return value if function succeeded.
void e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.
GReturn message(GCon g)
Demonstrates how to receive messages from the controller and detect differences in Trace and crashed ...
void error(GCon g, GReturn rc)
An example of error handling and debugging information.