Home
gclib 280 - Galil Motion Control
Contents
1. Example GMotionComplete usage ERAERKKKKKKKKKKKKKKK AAA AAA RARA RARA KKK TH AAA AAA AA RARA FH KK KK KK KK AAA Position 0 0 Beginning independent motion Motion Complete on A Position 8000 O Position 0 0 Beginning vector motion Motion Complete on vector plane S Position 6000 O examples cpp executed OK main is finished Press Enter to exit 5 1 5 clang OS X The following instructions were performed on sw_vers ProductName Mac OS X ProductVersion 10 10 5 BuildVersion 14F27 gcc version Configured with prefix Library Developer CommandLineTools usr with gxx include dir usr include c 4 2 Apple LLVM version 6 1 0 clang 602 0 53 based on LLVM 3 6 0svn Target x86_64 apple darwin14 5 0 Thread model posix Copy Files cd mkdir test cd test gclib 280 5 1 C C 39 tar xzf Applications gclib examples gclib_229_examples tar gz cp Applications gclib include x cp Applications gclib dylib x ls gclib 0 dylib x_arrays cpp x_gmotioncomplete cpp gclib h x_examples cpp x_gread_gwrite cpp gclib_errors h x_examples h x_grecord cpp gclib_record h x_gcommand cpp x_nonblocking cpp gclibo 0 dylib x_ginterrupt cpp x_programs cpp gclibo h x_gmessage cpp x_simple c x_simple c e In a text editor open x_simple c Find the GOpen call and up
2. A KH A KH A HA KH A AH AH KK 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 o 0073004 kkkkxkxkxkxkxkxkxkxkkkkkkkkkkkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkkkkkxkxkkkkkkkkkxk Example GInterrupt usage KKK KKK KKK KKK KKK KKK KK KKK KEK TI HH TH FH A FH KH A TA A A TH KH A A AH A A KH A A AH UI 8 executed KREKKKKKKKK KKK KKK KKK KKK KKK HH TH TH TH KH KH TH TH TH TH TH TA A A A I TH TH FH AH AH AH Example GMotionComplete usage KR KKK KKK KKK KKK KKK KKK KKK HH TH TH KH TH AH TH TH TA TH TA TH TH TH AH TH A KH KKK Position 0 0 Beginning independent motion Motion Complete on A Position 8000 0 Position 0 0 Beginning vector motion Motion Complete on vector plane S Position 6000 O ES Example GMessage non blocking usage KREKKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK K
3. KK KK KK AAA AAA KK KH TH TH RARA KK KKKKKKKKKKKKK KKK KKK KA AAA Example GRead and GWrite usage TH RARA KK AAA KK KK KA TH TH KH RARA KKEKKKKKKKKKKKK KKK AAA AAA Read 155 OR bytes KKEKKKKKKKK KKK KKK KKK KKK AAA RARA RA TH TH A TH TH AK FF TH TH AAA KK KK KK Example GCommand usage KKKKKKKKKKKKKKK KK KKK KKK KK KK TH KH KH KH TH TH TH TH TH A KK TI TH AAA TH TH TH TH A Revision report R V DMC4020 Rev 1 2b Command Values val is 10 val is 11 val is 3 1415 val is 9 869 Command Trimming gt 179798738 0000 E lt gt 179798738 0000 lt gt 179798738 0000 lt Receiving Binary Data OR read 155 bytes Error handling QD correctly trapped not allowed try GArrayDownload DL correctly trapped not allowed try GProgramDownload Modifying timeout Burning program kkkkxkxkxkxkxkxkxkxkxkkxkxkkkxkkxkxkxkxkxkxkxkkxkkkkxkxkxkxkx
4. bytes_returned The size of the data returned from the controller This does not include null termination This argument may be null if the value is not desired Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Referenced by GCmd GCmdD GCmdl GCmdT and GMotionComplete 9 2 2 5 GCLIB_DLL_EXPORTED GReturn GCALL GFirmwareDownload GCon g GCStringin filepath Upgrade firmware Parameters g Connection s handle filepath The full file path to the Galil supplied firmware hex file See http www galil com downloads firmware Returns The success status or error code of the function See gclib_errors h for possible values ec GInfo g buf sizeof buf get conntroller info cout lt lt buf lt lt An print the info ec GFirmwareDownload g F 1806 dmc dmc 1806 rlla hex ec GInfo g buf sizeof buf get the info again cout lt lt buf lt lt n example output GALILPCI1 DMC1846 Rev 1 la CM 4232 GALILPCI1 DMC1846 Rev 1 13 2 9 2 2 6 GCLIB_DLL_EXPORTED GReturn GCALL Ginterrupt GCon g GStatus status_byte Provides access to PCI and UDP interrupts from the controller Interrupts can be generated automatically by the firmware on important events via EI Enable Interrupt or by the user in embedded DMC code via UI User Interrupt To use this function
5. Definition at line 34 of file gclibo c References G_UTIL_ASSIGN and GuUtility 9 6 2 5 GCLIB_DLL_EXPORTED GReturn GCALL GCmd GCon g GCStringln command Wrapper around GCommand for use when the return value is not desired The returned data is still checked for error e g or timeout but is not brought out through the prototype Parameters g Connection s handle command Null terminated command string to send to the controller Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Definition at line 44 of file gclibo c References G_SMALL_BUFFER and GCommand Referenced by GRecordRate and H_DownloadArraysFromList 9 6 2 6 GCLIB_DLL_EXPORTED GReturn GCALL GCmdD GCon g GCStringIn command double x value Wrapper around GCommand that provides the return value of a command parsed into a double Use this function to retrieve the full Galil 4 2 range e g for a variable value with fractional data or the value of an Analog input or Output Parameters g Connection s handle command Null terminated command string to send to the controller value Pointer to a double that will be filled with the return value Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Definition at line 97 of file gc
6. Inthe Solution Explorer right click on gclib_example and choose Add gt Existing Item Choose C Program Files x86 Galil gclib source wrappers cs gclib cs Run Demo Type F5 to run the program Type a valid GOpen address in the text box and click Go gclib 280 5 3 Net 47 Create Project from scratch with MSVC 2013 For brevity these instructions assume the default installation location of C Program Files x86 Galil gclib Configure Project e Launch Visual Studio 2013 Choose File gt New gt Project In the New Project dialog choose Visual 0 gt Windows Forms Application Type gclib_example for the Name Choose a Location e g C Users user Desktop Check Create directory for solution Click OK the project will configure itself e In the Solution Explorer right click on Solution gelib_example 1 project and choose Configuration Man ager In the gclib_example project row click in the Platform column and choose lt New gt Choose x86 from Type or select the new platform Choose Any CPU from Copy settings from Check Create new solutions platform Click OK If x64 support is also desired repeat the lt New gt procedure for x64 In the Active solution platform combobox at the top of the Configuration Manager dialog choose lt Edit gt Select Any CPU and click the Remove button Click Close Close the Configuration Manager dialog In the
7. gclib 280 3 2 Apple OS X 13 gt gt gt print g GInfo dev tty usbserial0 DMC4143 Rev 1 2b 9998 gt gt gt g GClose gt gt gt exit user mac user Installed files The gclib shared object files Applications gclib dylib gclib 0 dylib Applications gclib dylib gclibo 0 dylib The gclib header files Applications gclib include gclib_errors h Applications gclib include gclibo h Applications gclib include gclib h Applications gclib include gclib_record h gclib documentation tarball Applications gclib doc gclib_226_doc tar gz Example source tarball Applications gclib examples gclib_226_examples tar gz Source files to modify rebuild libgclibo so Applications gclib source gclibo_229 src tar gz GalilTools Communication Library gcl wrapper Applications gclib source gclib_229 gcl tar gz Documentation The documentation is left as a tarball to minimize disk usage The latest release version of the user manual is available at the following link http www galil com sw pub all doc gclib html Offline pdf The following allows viewing of the pdf docs from the installation Browse in the Finder to Applications gclib doc Double click the tar gz file to extact it Open the resultant directory Open the pdf gclib 280 14 Installation Offline html The following allows viewing of the html docs from the instal
8. 54 File Index gclib 280 Chapter 8 Data Structure Documentation 8 1 GDataRecord Union Reference Data record union containing all structs and a generic byte array accessor include lt gclib_record h gt Data Fields struct GDataRecord4000 dmc4000 The DMC 4000 data record e struct GDataRecord4000 dmc4103 The DMC 4103 data record struct GDataRecord4000 dmc50000 The DMC 50000 data record struct GDataRecord30000 dmc30000 The DMC 30000 data record e struct GDataRecord2103 dmc2103 The DMC 21x3 data record struct GDataRecord1806 dmc1806 The DMC 1806 data record e struct GDataRecord1802 dmc1802 The DMC 1802 data record struct GDataRecord47000_ENC rio47000 The RIO 471xx 8 472xx data record including encoder support struct GDataRecord47300_ENC rio47300 The RIO 473xx data record including encoder support struct GDataRecord47300_24EX rio47300_24ex The RIO 473xx data record with 24EXOUT 24EXIN support unsigned char byte_array GALILDATARECORDMAXLENGTH Generic byte array for offsets 8 1 1 Detailed Description Data record union containing all structs and a generic byte array accessor Named structs can be used to access typed data by name Offsets into the data record can also be used by referencing the member byte_array 56 Data Structure Documentation Getting the sample counter for the DMC 4000 cout lt lt data_record gt dmc4000 sample_number lt
9. Modify source Make any necessary changes For this example the Glnfo function was changed from GReturn GCALL GInfo GCon g GCStringOut info GSize info_len return GUtility g G_UTIL_INFO info amp info_len to GReturn GCALL GInfo GCon g GCStringOut info GSize info_len strncpy info My controller info_len return G_NO_ERROR return GUtility g G_UTIL_INFO info amp info_len Make and install make f makefile_gclibo Open source component libgclibo so 0 0 Compiling open source component gcc c Wall Werror fPIC fvisibility hidden DBUILDING_GCLIB DHAVE_VISIBILITY x c Linking open source component into shared library gcc shared o libgclibo so 0 0 o Wl soname libgcelibo so 0 strip strip unneeded libgclibo so 0 0 Cleaning up 5 sudo make install f makefile_gclibo Installing libgclibo so 0 0 install m 755 libgclibo so 0 0 usr lib ldconfig 5 make clean f makefile_gclibo Cleaning project Test Extract simple example 5 tar xzf usr share doc gclib src gclib_165_examples tar gz x_simple c Edit GOpen call as necessary Compile gcc x_simple c Wall Werror lgclib lgclibo o simple Execute 5 simple rerig version 85 60 131 re 0 ee 0 info My controller ze 0 response 182879322 0000 OS X gclib 280 Rebuilding gclibo Copy files mkdir test cd test tar xvf Applications gclib source gclibo_253_src tar gz x gclibo h gclibo c arr
10. gclib 280 34 Using gclib x_examples cpp Review and Modify source In a text editor open x_examples cpp Find the GOpen call and update the address to match the desired hardware See the documentation for GOpen for address formatting options e Find the if 0 preprocessor block enclosing the example calls Change to if 1 to run the examples Comment out the function calls to be avoided Note some calls attempt to move motors and not all functions are compatible with all Galil products Compile C temp borland gt bcc32 c cpp Link C temp borland gt bcc32 o examples exe obj gclib lib gclibo lib Execute C temp borland gt examples exe Library version 130 115 279 192 168 0 43 DMC4020 Rev 1 2b 291 AS Example GRead and GWrite usage EEES Read 155 OR bytes KREKKKKKKK KKK KKK KKK AAA KKK KKK KKK KKK KKK KARA AAA AAA AAA A AAA ARA KA KA Example GCommand usage EAS Revision report R V DMC4020 Rev 1 2b Command Values val is 10 val is 11 val is 3 1415 val is 9 869 Command Trimming gt 95653016 0000 ig gt 95653016 0000 lt gt 95653016 0000 lt Receiving Binary Data OR read 155 bytes Error handling QD correctly trapped not allowed try GArrayDownload DL correctly trapped not allowed try GProgramDownload Modifying timeout Burning program OK kkkxkxkk
11. reas g version 85 60 138 rez 0 re 10 info 10 1 3 17 DMC4020 Rev 1 2b 291 rez 0 response 1584328 0000 x_examples cpp Review and Modify source e In a text editor open x_examples cpp Find the GOpen call and update the address to match the desired hardware See the documentation for GOpen for address formatting options e Find the if 0 preprocessor block enclosing the example calls Change to if 1 to run the examples Comment out the function calls to be avoided Note some calls attempt to move motors and not all functions are compatible with all Galil products Compile Launch the MinGW terminal e g Start gt All Programs gt MinGW W64 project gt 686 4 9 1 posix dwarf rt_v3 rev3 gt Run Terminal Navigate to the directory with the files above Compile the code C temp mingw gt g cpp L lgclibo lgclib o examples exe Execute C temp mingw gt examples exe Library version 41 35 34 192 168 0 43 DMC4020 Rev 1 2b 291 gclib 280 5 1 C C 31 ERAERKKKKKKKKKKKKKKK AAA AA RARA KK KA KKK TH AAA AA AAA TH KK KK KA Example GRead and GWrite usage KKK KKK KKK KKK KKK KKK KKK KKK KA KT KH KH KH KH AA KARA AAA KARA AAA AAA AAA Read 155 OR bytes
12. s EI must be used in the GOpen address string to subscribe to interrupts Parameters g Connection s handle status_byte A pointer to a GStatus to receive the status byte Returns The success status or error code of the function See gclib_errors h for possible values Ginterrupt will block until an interrupt is received or the function times out gclib 280 94 File Documentation Note If this function is called with a timeout of zero a non blocking read is performed If interrupt data is waiting in the interrupt queue the oldest byte will be popped off the queue If there is no interrupt data queued but there is data waiting in the socket or PCI FIFO one read will be performed to process the waiting data If new data is still not found after these two attempts G_GCLIB_NON_BLOCKING_READ_EMPTY will be returned See x_ginterrupt cpp for an example See x_nonblocking cpp for an example of non blocking usage 9 2 2 7 GCLIB_DLL_EXPORTED GReturn GCALL GMessage GCon g GCStringOut buffer GSize buffer_len Provides access to unsolicited messages from the controller To use this function s MG must be used in the GOpen address string to subscribe to messages Unsolicited bytes must be flagged by the high bit setting Cw 1 The driver will automatically set this when subscribing to messages The user should not overwrite this setting Unsolicited messages are data generated by the contr
13. 1 root dialout 4 66 Mar 16 39 dev ttyS2 H root dialout 4 67 Mar root dialout 188 0 Mar 16 39 dev ttyS3 11 08 dev ttyUSBO CIW IW DNWW WW Hm CIW TW S AE In the above listing dialout is the group that needs to be joined uucp is another common group that may be listed Add the desired username to the group sudo gpasswd a username dialout sudo password for username Adding user username to group dialout Log out and back in for change to take effect groups username wheel dialout gclib can now connect to serial and usb devices from user username PCI Controllers If using a Galil PCI controller the PCI driver must be installed Install prerequisites sudo yum install kernel devel uname r sudo yum install kernel headers uname r sudo yum install gcc Extract source and build driver tar xf usr share doc gclib src gclib_202_pci tar gz make Copy module and add to kernel sudo cp galilpci ko lib modules uname r sudo depmod sudo modprobe galilpci Add galil group for access to PCI sudo groupadd f K GID_MIN 100 K GID_MAX 499 galil sudo cp 90 galilpci rules etc udev rules d sudo udevadm control reload rules sudo udevadm trigger sudo usermod a G galil username exchange username with actual user s name YY UE ds UY DY gclib 280 3 5 Red Hat 8 CentOS Linux 19 Logout and back in The PCI hardware is now available for access
14. 6 4 u 3 wu bbb EEL ewe RR REAL a a bees 88 8 1 2 FUACUON DOCUMENTO 22 lt e soe es ee Kai 88 91 21 GArrayDownloadhile s u sa 02 PR a ee we i 88 A e a lt 0 26 0 a oma a 06d aR RE RRR wee a 88 8 1 2 3 H_DownloadArraysframlist o sa sa nsawo ee ee 88 92 gelib h File Reference oo 2240002 2 0 ee ba a Ba oe 89 921 Detailed Desenpien ise cs ewe ras nah Re a ee A 91 G22 Funken DOCUMGHIANON oca a ede bee ea So ee Pee ee bdo 91 5221 GArayD wnoad e e se eni so 24 ee et ee a ee ee Bee we 91 paee o se ccs bus bbe ue Rit ape ee eg be ea es Se a a a 91 Ooms WAGE eeg ea ok ee Be a Pee ee Se gw 4 92 224 GOMAN v se Roi goa ap ne et 92 S225 GrinmwareDowiload 2 2464 046s a be a owe ee 93 See 500083811 oam be ee ee oe ee heb hed 93 59227 GEIGE oad cis a a Be a i ee AD ee ee ee ee 94 92 28 GOREN sao ee ee k ee Se SE OP RY ea ae 94 gclib 280 CONTENTS v 94229 GProramDownlead s scc oeer pea a 96 2 2 10 GPSgamlBAd a A RAR an re 98 22211 GREA s ca a er eS 98 DENE GRECO AAA 98 E GUDE o i ahd a desk woe PE bo ee a eo d 99 ee CNRS ge kee fy Ss he ee Eo ae Ee a ee ee 102 93 gelib errars h File Reference oc s ee 8 40200 a A ee ee 103 21 Detailed 10656 310615 lt ss aoe Rae RR Ea ee eee ee ee ee eS 104 94 gelib recordi File Releet o co kk Pe ew RR ke RR ee eo 104 341 Detailed Descniplien
15. 9 5 1 Detailed Description Partial implementation of gclibo h Definition in file gclibo c 9 5 2 Function Documentation 9 5 2 1 GReturn GCALL GAddresses GCStringOut addresses GSize addresses_len Uses GuUtility and G_UTIL_ADDRESSES to provide a listing of all available connection addresses Note Serial ports are listed e g COM1 It may be necesary to specify a baud rate for the controller e g baud 19200 Default baud is 115200 See GOpen Parameters addresses Buffer to hold the output string Buffer will be null terminated even if the data must be truncated to do so addresses_len Length of buffer Returns The success status or error code of the function See gclib_errors h for possible values Definition at line 24 of file gclibo c References G_UTIL_ADDRESSES and GuUtility 9 5 2 2 GReturn GCALL GAssign char x ip char x mac Assigns IP address over the Ethernet to a controller at a given MAC address Parameters ip The null terminated ip address to assign The hardware should not yet have an IP address mac The null terminated MAC address of the hardware Returns The success status or error code of the function See gclib_errors h for possible values The desired IP address will be pinged prior to the assigment If the ping is returned GAssign will return G_GCLIB_UTILI gt TY_IP_TAKEN Note Linux OS X users must be root to use GAssign and have UDP acc
16. A axis switches UB axis_a_stop_code A axis stop code SL axis_a_reference_position A axis reference position SL axis_a_motor_position A axis motor position SL axis_a_position_error gclib 280 8 4 GDataRecord2103 Struct Reference 69 A axis position error SL axis_a_aux_position A axis auxiliary position SL axis_a velocity A axis velocity SW axis_a_torque A axis torque UW axis_a_analog_in A axis analog input UW axis_b_status B axis status UB axis_b_switches B axis switches UB axis_b_stop_code B axis stop code SL axis_b_reference_position B axis reference position SL axis_b_motor_position B axis motor position SL axis_b_position_error B axis position error SL axis_b_aux_position B axis auxiliary position SL axis_b_ velocity B axis velocity SW axis_b_torque B axis torque UW axis_b_analog_in B axis analog input UW axis_c_status C axis status UB axis_c_switches C axis switches UB axis_c_stop_code C axis stop code SL axis_c_reference_position C axis reference position SL axis_c_motor_position C axis motor position SL axis_c_position_error C axis position error SL axis_c_aux_position C axis auxiliary position SL axis_c_velocity C axis velocity SW axis_c_torque C axis torque UW axis_c_analog_in C axis analog input UW axis_d_ status D axis status gclib 280 70 Data Structure Docume
17. Data Structure Index 6 1 Data Structures Here are the data structures with brief descriptions GDataRecord Data record union containing all structs and a generic byte array accessor GDataRecord1802 Data record struct for DMC 1802 controllers Same as 2103 except no analog in axis data GDataRecord1806 Data record struct for DMC 1806 controller o o e GDataRecord2103 Data record struct for DMC 2103 controllers 22mm o o 2200000 GDataRecord30000 Data record struct for DMC 30010 controllers 2 00002200000 GDataRecord4000 Data record struct for DMC 4000 controllers including 4000 4200 4103 and 500x0 GDataRecord47000_ENC Data record struct for RIO 471xx and RIO 472xx PLCs Includes encoder fields GDataRecord47300_24EX Data record struct for RIO 47300 with 24EX I O daughter board GDataRecord47300_ENC Data record struct for RIO 47300 Includes encoder fields H_ArrayData Structure to create a linked list for array data 2 ee ee 52 Data Structure Index gclib 280 Chapter 7 File Index 7 1 File List Here is a list of all documented files with brief descriptions ANTE 6 ot hee eae da o e A don da de das ld de dd BR Bs 87 A A 89 e AIN 103 a ARA 104 CIDOC ec ae ei ka Oh a ae eee a Gp Berke eee en ee 105 a a ete se BADGE te Be EES bankas 113
18. Ethernet for the DMC 21x3 series define G_FIRMWARE_LOAD_NOT_SUPPORTED_S firmware cannot be loaded on this communication bus to this hardware define G_ARRAY_NOT_DIMENSIONED 1200 Array operation was called on an array that was not in the controller s array table see LA command define G_ARRAY_NOT_DIMENSIONED_S array not dimensioned on controller or wrong size define G_ILLEGAL_DATA_IN_PROGRAM 1202 Data to download not valid e g in data define G_ILLEGAL_DATA_IN_PROGRAM_S illegal ASCII character in program define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT 1203 Program preprocessor could not compress the program within the user s constraints define G_UNABLE _TO_COMPRESS_PROGRAM_TO_FIT_S program cannot be compressed to fit on the controller gclib 280 104 File Documentation define G_BAD_RESPONSE_QUESTION_MARK 10000 Operation received a indicating controller has a TC error define G_BBAD_RESPONSE _QUESTION_MARK_S question mark returned by controller define G_BAD_VALUE_RANGE 10002 Bad value or range e g GCon g variable passed to function was bad define G_BAD_VALUE RANGE_S value passed to function was bad or out of range define G_BAD_FULL_MEMORY 10003 Not enough memory for an operation e g all connections allowed for a process already taken define G_BAD_FULL_MEMORY_S operation could not complete because of a memory error define G_BAD_LOST_DATA 10004 Los
19. distance traveled in coordinated move for S plane UWs plane_buffer_available Buffer space remaining S Plane gclib 280 76 Data Structure Documentation UW t_plane_segment_count segment count of coordinated move for T plane UW t_plane_move_status Coordinated move status for T plane SL t_distance distance traveled in coordinated move for T plane UW t_plane_buffer_available Buffer space remaining T Plane UW axis_a_status A axis status UB axis_a_switches A axis switches UB axis_a_stop_code A axis stop code SL axis_a_reference_position A axis reference position SL axis_a_motor_position A axis motor position SL axis_a_position_error A axis position error SL axis_a_aux_position A axis auxiliary position SL axis_a_velocity A axis velocity SL axis_a_torque A axis torque UW axis_a_analog_in A axis analog input UB axis_a_halls A Hall Input Status UB axis_a_reserved Reserved SL axis_a_variable A User defined variable ZA UW axis_b_status B axis status UB axis_b_ switches B axis switches UB axis_b_stop_code B axis stop code SL axis_b_reference_position B axis reference position SL axis_b_motor_position B axis motor position SL axis_b_position_error B axis position error SL axis_b_aux_position B axis auxiliary position SL axis_b_velocity B axis velocity SL axis_b_torque gclib 280 8 6 GDataRecord4000 Struct Reference 77 B axis torque UW axis_b_analog_in B
20. kkkkkxkkkxkkxkxkkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkxkkkkkkxkxkkkkkkxkkkkkkkkxkkkkkkkkkxk Example GCommand usage KKK KK KKK KKK KKK KKK KKK KKK KKKKK AAA RRA AAA AA AAA AA Revision report R V DMC4020 Rev 1 2b Command Values val is 10 val is 11 val is 3 1415 val is 9 869 Command Trimming gt 95653016 0000 58 gt 95653016 0000 lt gt 95653016 0000 lt Receiving Binary Data OR read 155 bytes Error handling QD correctly trapped not allowed try GArrayDownload DL correctly trapped not allowed try GProgramDownload Modifying timeout Burning program OK KKKKKKKKKKKKKK KKK KKK AAA ARA AA RARA TH TH TH TA AAA ARA AAA KK KK TH A AR Example GProgramDownload and GProgramUpload usage KK AAA AAA TH AAA TH TH TH KA AAA AAA RARA RRA KA KA TH GProgramDownload correctly errored Can t fit with level 3 compression Program Downloaded with compression level 4 Uploading program A i 0
21. lt access by 4000 product cout lt lt unsigned short data_record gt byte_array 4 lt lt ARES access by pointer arithmetic Definition at line 875 of file gclib_record h The documentation for this union was generated from the following file gclib_record h 8 2 GDataRecord1802 Struct Reference Data record struct for DMC 1802 controllers Same as 2103 except no analog in axis data include lt gclib_record h gt Data Fields UB header_0 1st Byte of Header UB header_1 2nd Byte of Header UB header_2 3rd Byte of Header UB header_3 4th Byte of Header UW sample_number sample number UB input_bank_0 general input bank 0 inputs 1 8 UB input_bank_1 general input bank 1 inputs 9 16 UB input_bank_2 general input bank 2 inputs 17 24 UB input_bank_3 general input bank 3 inputs 25 32 UB input_bank_4 general input bank 4 inputs 33 40 UB input_bank_5 general input bank 5 inputs 41 48 UB input_bank_6 general input bank 6 inputs 49 56 UB input_bank_7 general input bank 7 inputs 57 64 UB input_bank_8 general input bank 8 inputs 65 72 UB input_bank_9 general input bank 9 inputs 73 80 UB output_bank_0 general output bank 0 outputs 1 8 UB output_bank_1 general output bank 1 outputs 9 16 gclib 280 8 2 GDataRecord1802 Struct Reference 57 UB output_bank_2 general output bank 2
22. outputs 17 24 UB output_bank_3 general output bank 3 outputs 25 32 UB output_bank_4 general output bank 4 outputs 33 40 UB output_bank_5 general output bank 5 outputs 41 48 UB output_bank_6 general output bank 6 outputs 49 56 UB output_bank_7 general output bank 7 outputs 57 64 UB output_bank_8 general output bank 8 outputs 65 72 UB output_bank_9 general output bank 9 outputs 73 80 UB error_code error code UB general_status general status UWs plane_segment_count segment count of coordinated move for S plane UWs plane_move_status coordinated move status for S plane SLs distance distance traveled in coordinated move for S plane UWt_plane_segment_count segment count of coordinated move for T plane UWt_plane_move_status Coordinated move status for T plane SLt distance distance traveled in coordinated move for T plane UW axis_a_status A axis status UB axis_a_switches A axis switches UB axis_a_stop_code A axis stop code SL axis_a_reference_position A axis reference position SL axis_a_motor_position A axis motor position SL axis_a_position_error A axis position error SL axis_a_aux_position A axis auxiliary position SL axis_a_velocity A axis velocity SW axis_a_torque A axis torque UW axis_b_status gclib 280 58 Data Structure Documentation B axis status UB axis_b_switches B axis
23. tes 0 info My controller rez 0 response 182879322 0000 gclib 280 Rebuilding gclibo gclib 280 Chapter 3 Installation gclib is available on the following operating systems Microsoft Windows 7 x64 x86 8 x64 x86 8 1 x64 x86 10 x64 x86 Apple 05 X Yosemite 10 10 x64 Mavericks 10 9 x64 Ubuntu Linux 14 04 LTS x64 12 04 LTS x64 Fedora Linux fc22 x64 fc21 x64 Red Hat amp CentOS Linux rhel7 x64 rhel6 x64 CentOs 7 x64 CentOs 6 x64 Don t see your OS Please email softwaresupport galil com orcallGalil Applications 3 1 Microsoft Windows Tested versions See the installation page for supported versions 10 Installation Installation On Windows gclib is distributed in the following formats An executable installer which will install the library in the proper location to work with the included examples and documentation PCI users can optionally install the PCI driver from within this installer A zip file containing the same set of files as the executable but in a zip archive PCI users can use the stand alone PCI driver installer Astand alone PCI driver installer for PCI users DMC 1806 1800 1802 1417 Note The PCI driver is compatible with GalilTools but is enhanced for gclib communications Download Installer Recommended all instructions and examples depend on installation paths Download
24. 5 ls 1 dev galilx erw rw 1 root galil 10 56 Jun 9 11 07 dev galilpci0 echo e x12 x16 r gt dev galilpci0 cat dev galilpci0 DMC1846 Rev l la Documentation The documentation is left as a tarball to minimize disk usage The latest release version of the user manual is available at the following link http ww galil com sw pub al1 doc gclib html Offline pdf The following allows viewing of the pdf docs from the installation 5 tar xzf usr share doc gclib gclib_132_doc tar gz gclib_132 pdf evince gclib_132 pdf Offline html The following allows viewing of the html docs from the installation tar xzf usr share doc gclib gclib_132_doc tar gz html firefox html index html 3 5 Red Hat amp CentOS Linux Tested versions See the installation page for supported versions Installation On Red Hat gclib is distributed in an RPM repository The following steps can be performed to install gclib Download Galil s repository information This step installs Galil s RPM repositories and only needs to be done once Attention Red Hat 7 and CentOS 7 Point a browser at http www galil com sw pub rhel 7 galilrpm 2 1 noarch rpm and install the rpm Red Hat 6 and CentOS 6 Point a browser at http www galil com sw pub rhel 6 galilrpm 2 1 2 noarch rpm and install the rpm gclib 280 20 Installation Install Package Install gclib package approve Installed siz
25. Command Values val is 10 val is 11 val is 3 1415 val is 9 869 Command Trimming gt 408978 0000 ES gt 408978 0000 lt gt 408978 0000 lt Receiving Binary Data OR read 155 bytes Error handling QD correctly trapped not allowed try GArrayDownload DL correctly trapped not allowed try GProgramDownload Modifying timeout Burning program OK KKKKKKK KKK KKK KKK KKK KKK KKK KKK RARA ARK TH TH TH TH RARA AAA KK KK KK Example GProgramDownload and GProgramUpload usage KKKKKKKKKK KKK KKK KKK KKK KKK KKK RAR KH TH AAA AAA RARA AAA AA KK KK GProgramDownload correctly errored Can t fit with level 3 compression Program Downloaded with compression level 4 Uploading program A i 0 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 EN Program executed as expected kkkkxkkxkxkxkxkxkxkxkkxkxkkkkkxkxkxkkxkxkxkkxkxkkkkkxkxkxkkxkxkxkkkkkxkxkkkkxkkkxkxkkkkkxkxkxkkkxkxkkxkkkkx k Example GArrayDownload GArrayUploadFile GArrayDownloadFile and GArrayUpload usage kkkkxkxkxkxkxkxkxkxkxkxkxkxkkkxkkxkxkxkxkxkxkxkkxkxkkkxkxkxkxkxkkxkxkxkkkkkkkkkkxkkkkxkkkxkkkxkxkkxkxkxkkxkkkkx k 2 0000 4 0000 6 0000 8 0000 10 0000 12 0000 14
26. Empty Project Choose a Name e g gclib_example Choose a Location e g C Users user Desktop Check Create directory for solution Click OK Inthe Solution Explorer right click on Source Files and choose Add gt Existing Item Navigate to the gclib installation directory then to examples cpp in the installation directory In File Name type x_x cpp and click Ada this will filter out the files needed Select all files in the file chooser and click Add In the Solution Explorer right click on gclib_example choose Properties highlight Configuration Properties and set the following project properties At the top of the window change Configuration to All Configurations and ensure Platform lists Active Win32 Configuration Properties gt C C gt Additional Include Directories add C Program Files x86 Galil gclib include Configuration Properties gt Linker gt General gt Additional Library Directories add C Program Files x86 Galil gclib lib dynamic x86 Configuration Properties gt Linker gt Input gt Additional Dependencies add gclib lib gclibo lib rest of text where rest of text is the original string that was in the cell Note the semicolons between library files Configuration Properties gt Debugging gt Environment add PATH C Program Files x86 Galil gclib dII x86 P ATH In the Solution Explorer open x_examples cpp Find the GOpen call
27. GCStringOut info GSize info_len return GUtility g G_UTIL_INFO info amp info_len to GReturn GCALL GInfo GCon g GCStringOut info GSize info_len strncpy info My controller info_len return G_NO_ERROR return GUtility g G_UTIL_INFO info sinfo_len Rebuilding gclibo Compile and copy Compile the source code Note the quotes C temp gt cl c c I Sbaseslinclude DBUILDING_GCLIB Link the source code Note the quotes C temp gt link DLL obj Sbase lib dynamic x86 gclib lib OUT gclibo dll Copy Copy back to the installation location from the file explorer Copy gclibo lib to C Program Files x86 Galil gclib lib dynamic x86 Copy gclibo dll to C Program Files x86 Galil gclib dll x86 Test Copy simple example C temp gt copy Sbase examples cpp x_simple c Edit GOpen call as necessary Compile C temp gt cl x_simple c Sbase lib dynamic x86 lib I base include Set Path to DLL C temp gt set PATH base d11 x86 3PATH Execute C temp gt x_simple exe zos 0 version 85 60 138 rez 0 rey 0 info My controller rez 0 response 355000958 0000 Linux Copy files 5 mkdir test cd test tar xvf usr share doc gclib src gclibo_164_src tar gz gclibo h gclibo c arrays c makefile_gclibo cp usr include gclibx h ls arrays c gclib h gclibo h makefile_gclibo gclib_errors h gclibo c gclib_record h gclib 280
28. GStatus status_byte Provides access to PCI and UDP interrupts from the controller e GCLIB_DLL_EXPORTED GReturn GCALL GFirmwareDownload GCon g GCStringin filepath Upgrade firmware GCLIB_DLL_EXPORTED GReturn GCALL GuUtility GCon g GOption request GMemory memory1 G Memory memory2 Provides read write access to driver settings and convenience features based on the request variable 9 2 1 Detailed Description Defines the interface for the Galil C Library GCLIB Definition in file gclib h 9 2 2 Function Documentation 9 2 2 1 GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownload GCon g const GCStringIn array_name GOption first GOption last GCStringln buffer Downloads array data to a pre dimensioned array in the controller s array table Warning The array must already exist on the controller and be sufficient dimension to hold the desired array data e g via DM Parameters g Connection s handle array_name Null terminated string containing the name of the array to download Must match the array name used in DM first The first element of the array for sub array downloads G_BOUNDS to omit last The last element of the array for sub array downloads G_BOUNDS to omit buffer Buffer containing the null terminated data to be sent to the controller The array data may be separated with carriage return carriage return line feed or a comma No spaces Returns The success statu
29. UB axis_a_switches A axis switches UB axis_a_stop_code A axis stop code SL axis_a_reference_position A axis reference position SL axis_a_motor_position A axis motor position SL axis_a_position_error gclib 280 8 3 GDataRecord1806 Struct Reference 63 A axis position error SL axis_a_aux_position A axis auxiliary position SL axis_a velocity A axis velocity SL axis_a_torque A axis torque UW axis_a_analog_in A axis analog input UB axis_a_reserved_0 Reserved UB axis_a_reserved_1 Reserved SL axis_a_variable A User defined variable ZA UW axis_b_ status B axis status UB axis_b_switches B axis switches UB axis_b_stop_code B axis stop code SL axis_b_reference_position B axis reference position SL axis_b_motor_position B axis motor position SL axis_b_position_error B axis position error SL axis_b_aux_position B axis auxiliary position SL axis_b_ velocity B axis velocity SL axis_b_torque B axis torque UW axis_b_analog_in B axis analog input UBaxis_b reserved_0 Reserved UBaxis_b reserved_1 Reserved SL axis _b variable B User defined variable ZA UW axis_c status C axis status UB axis_c_switches C axis switches UB axis_c_stop_code C axis stop code SL axis_c_reference_position C axis reference position SL axis_c_motor_position C axis motor position gclib 280 64 Data Structure Documentation S
30. Zip For custom deployment or non default file locations If an earlier version is required see http www galil com sw pub win gclib for a list of all builds Required third party DLLs gclib is built using MSVC2013 and requires run time components available in the Visual C Redistributable Pack ages for Visual Studio 2013 On machines that don t already have Visual Studio 2013 installed the required files can be installed from Microsoft Be sure to install the appropriate architecture x86 or x64 e http www microsoft com en us download details aspx id 40784 Uninstall gclib e Run uninstall exe in C Program Files x86 Galil gclib Installed Files Installation from the executable installer looks like the following C Program Files x86 Galil gclib gt tree a Folder PATH listing for volume OS Volume serial number is AE3F 6836 CH d11 x64 x86 doc html search examples cpp cs 2013 12 0 gclib_example gclib_example Properties gclib 280 3 1 Microsoft Windows 11 Q00 mingw msvc i 2013_12 0 gclib_example gclib_example vb 2013_12 0 gclib_example gclib_example My Project include lib dynamic x64 x86 source gclibo wrappers cs gcl vb dil The dll directory contains the binary dynamic link libraries DLLs for both x86 and x64 archi
31. axis_g_reference_position G axis reference position SL axis_g_motor_position G axis motor position SL axis_g_position_error G axis position error SL axis_g_aux_position G axis auxiliary position SL axis_g_velocity G axis velocity SW axis_g_torque G axis torque UW axis_g_analog_in G axis analog input UW axis_h_status H axis status UB axis_h_switches H axis switches UB axis_h_stop_code H axis stop code SL axis_h_reference_position H axis reference position SL axis_h_motor_position H axis motor position SL axis_h_position_error H axis position error SL axis_h_aux_position H axis auxiliary position SL axis_h_velocity H axis velocity SW axis_h_torque H axis torque UW axis_h_analog_in H axis analog input gclib 280 72 Data Structure Documentation 8 4 1 Detailed Description Data record struct for DMC 2103 controllers Definition at line 401 of file gclib_record h The documentation for this struct was generated from the following file gclib_record h 8 5 GDataRecord30000 Struct Reference Data record struct for DMC 30010 controllers include lt gclib_record h gt Data Fields UB header_0 1st Byte of Header UB header_1 2nd Byte of Header UB header_2 3rd Byte of Header UB header_3 4th Byte of Header UW sample_number sample number UB input_bank_0 general input bank 0 input
32. demonstrates how to use gclib vb The following instructions were performed on Visual Studio Professional 2013 and can be extended to other Visual Studio versions Running the included Visual Basic Example For brevity these instructions assume the default installation location of C Program Files x86 Galil gclib Copy files Navigate to a convenient empty writable location e g C ltemp Copy the contents of C Program Files x86 Galil gclib examples vb 2013_12 0 gclib_example to this loca tion Open in Microsoft Visual Studio 2013 Open gclib_example sin in Visual Studio This demo was tested on MSVS 2013 Add existing item gclib vb Inthe Solution Explorer right click on gclib_example and choose Add gt Existing Item Choose C Program Files x86 Galil gclib source wrappers vb gclib vb Run Demo Type 25 to run the program Type a valid GOpen address in the text box and click Go gclib 280 5 3 Net 45 Create Project from scratch with MSVC 2013 For brevity these instructions assume the default installation location of C Program Files x86 Galil gclib Configure Project Launch Visual Studio 2013 Choose File gt New gt Project In the New Project dialog choose Visual Basic gt Windows Forms Application Type gclib_example for the Name Choose a Location e g C Users user Desktop Check Create directory for solution Click OK the project will conf
33. device on the network define G_GCLIB_NON_BLOCKING_READ_EMPTY 4 GMessage Ginterrupt and GRecord can be called with a zero timeout If there wasn t data waiting in memory this error is returned define G_GCLIB_NON_BLOCKING_READ_EMPTY_S data was not waiting for a zero timeout read define G_TIMEOUT 1100 Operation timed out Timeout is set by the timeout option in GOpen and can be overriden by GSetting define G_TIMEOUT_S device timed out define G_OPEN_ERROR 1101 Device could not be opened E G Serial port or PCI device already open define G_OPEN_ERROR_S device failed to open define G_INVALID_PREPROCESSOR_OPTIONS 1204 GProgramDownload was called with a bad preprocessor directive define G_INVALID_PREPROCESSOR_OPTIONS_S preprocessor did not recognize options define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND 1106 GCommana was called with an illegal command e g ED DL or QD define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND_S illegal command passed to command call define G_DATA_RECORD_ERROR 1107 Data record error e g DR attempted on serial connection define G_DATA_RECORD_ERROR_S data record error define G_UNSUPPORTED_FUNCTION 1109 Function cannot be called on this bus E G Ginterrupt on serial define G_UNSUPPORTED_FUNCTION_S function not supported on this communication bus define G_FIRMWARE_LOAD_NOT_SUPPORTED 1110 Firmware is not supported on this bus e g
34. i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 EN Program executed as expected kkkkxkkxkxkxkxk xkxkxkxkxkxkkxkkxkxkxkxkxkxkxkxkkxkkkkkkxkxkxkkxkkxkkkkkxkxkxkxkxkxkkkxkxkkkxkkkkkkxkxkxkkxkkkk kx Example GArrayDownload and GArrayUpload usage kkkkxkxkxkxkxkxkxkxkxkkxkxkkkxkkxkxkxkxkxkxkxkkxkxkkkxkkxkxkxkkxkxkkkkkkkkkkkxkkkkkkkxkkxkxkxkkkxkkkxkkkkx 2 0000 4 0000 6 0000 8 0000 10 0000 12 0000 14 0000 16 0000 18 000 0000 2 0000 1 0000 3 0000 5 0000 10 0000 12 0000 14 0000 16 0000 18 000 0000 3 0000 5 0000 10 0000 kkkkxkxkxkxkxkxkxkxkxkxkxkxkxkkxkxkxkxkxkxkxkxkxkxkxkxkkkkkxkxkxkxkxkxkxkkkkkkxkkkxkxkkkkkkkxkkkxkkkkxkxkkkkkkx Example GRecord usage kkkkxkxkxkxkxkxkxkxkxkxkxkxkkxkxkkxkxkxkxkxkxkxkkxkxkkkxkxkxkxkxkkxkxkxkkkxkkkxkkkxkxkkkxkkkkxkkxkxkxkxkxkxkkkxkkkkxx OR based data record 38564 393216000 DR based data record 38670 38772 38874 38976 39078 39180 39282 gclib 280 32 Using gclib 39384 39486 39588 39690 OR based data record with offsets 39692 39692 A TH TH TH FH TH TH A TH TH TH TH KH KH KKEKKKKKKKKK KKK KKK KKK KKK KKK KKK Example GMessage usage KKEKKKKKKK KKK KKK KK KKK KK
35. lt lt i272 8 96 be ede FAG dew Yee Sethe ows 105 9 5 gelboc File Relerence o gt 2 a 2 2 28 e a een 105 931 Detailed Descnption zur e EO en ee 106 3952 Funcion Dosumeniatl n s i 2 a naar een 106 9521 5800768884 edad ad eed 106 ee MASSA as aa e A ae Se a ee Eee Ma 106 az SOE s 2 ce ae eas Seal aw Ss ee Re Ee E 107 524 O e 2 4 e465 oa oe ee RG ea AG SESS PE bee ee Ss 107 Ma SO ern A ae Seay ah Ge pe ee me Bk eae de a A 107 O50 AN 108 Soer DE gs ne ein ie ok ne eG et hs TE a 108 Oe RAN So ee pete ee hE A we ee bd de ee ee ei 109 9529 BIPROQUESIS ick as kee Gop ee Ble de a ee ee dae Be a a 110 9 5210 GMotionGComplete lt se se racc a aca pe bet ne eben 110 9 5 2 11 GProgramDownloadFile o e e e 111 25212 EPrgramiploSdElE o enc ee ee oe ee Re nr 111 5 213 01366601018816 a s eos de Row ae a PR ae ee ag ee aes 111 DOES E RN eae eee es ur 112 392 19 ATIMEDDL e ek aN bk DES A a e oe bE ee hee ES 112 95216 GYSSON ne a ee es eR a Ee a Rk es 112 96 gelben File Referente o se c eee ee Se Ee ne eee ee ee Se 113 61 Detailed 08581811618 i s sor a ei a ae Se PE a a ee ee ee ee ee eS 114 962 ELNCUON Documentation 228 6 42 Re an ee RR we RR Oe ee 114 521 5007168888 un ea ee A PRS we EE PE EEE 114 9 6 2 2 GArrayDownloadFile aooo 115 9623 GArayUploadFile
36. lt s s sos 22 p e ea an 116 95024 GASSOT Aa ak ee in Goce de oe i et et aA 116 958625 A wie pia aag a ee ed 117 pazo GCA y as ipaa ae kag a le ent A ae ee at En a EA ees a eS 117 GAF SOR oe ho de ok en A ei ne 117 s a a e N A ees 118 gclib 280 vi CONTENTS 46 29 9 6 2 10 25 211 96 2 12 9 6 2 13 9 6 2 14 0 215 9 6 2 16 96 2 17 9 6 2 18 GENOE 254 aa Be ee ha mer 118 GO a g be eee ee an ee es Se oe 4 ea Der Br te 119 61015881065187 Ge ie eae E Soe e ha ee ee ee a 119 GMotionComplete ea ra eni tk ioana Ra eG a ee a 120 GProgramDownloadFil lt lt oc eae eR ee 120 GProgramUploadFile o 542 44 shee wee bbe ee pw be ees 120 II tr Gol ag ee Boa ea een at Gh els Bee 121 CMS gt ncn a A ee we PD be ee we eee ee 121 901166191 ie yaoi A Ee a ee eee 121 Ry ere A aie brand oe es Be hem Gos Gop dhe aoa E 122 gclib 280 Chapter 1 Getting Started gclib is a C compatible application programming interface API for communicating with Galil motion controllers and PLCs The library consists of a basic set of function calls gclib h and an open source extension library gclibo h A number of examples are provided to demonstrate how to use the library with various languages and on various platforms gclib will import virtually anywhere a dll so dylib can be imported See Using gclib for detai
37. not necessary i e g may be null The address to assign will be pinged to ensure its availability before the assign packet is sent G_GCLIB_UTILITY_IP_TAKEN will be returned by Ge Utility if the ping returns a response 102 File Documentation memory2 An untyped pointer to data type required for request Returns The success status or error code of the function See gclib_errors h for possible values See source of gclibo c for examples of G_UTIL_TIMEOUT G_UTIL_TIMEOUT_OVERRIDE G_UTIL_VER gt SION G_UTIL_INFO G_UTIL_ SLEEP Except for serial ports each line from G_UTIL_ADDRESSES will be of the form address revision report R V 1 10 1 3 168 DMC30010 Rev 1 2d 2 GALILPCI1 DMC1826 Rev 1 la 3 7 4 8 See GAddresses for an example of G_UTIL_ADDRESSES Note Linux OS X users must be root to use G_UTIL_IPREQUEST and have UDP access to bind and listen on port 67 Each line from G_UTIL_IPREQUEST will be of the form model serial_number mac 1 DMC4000 291 00 50 4c 20 01 23 2 DMC30000 4184 00 50 4c 40 10 58 example for getting controllers requesting IPs char buf 1024 GSize len sizeof buf GUtility 0 G_UTIL_IPREQUEST buf amp len cout lt lt buf lt lt An Note Linux users must be root to use G_UTIL_ASSIGN and have UDP access to send on port 68 example of assigning an IP address cUtility 0 GLUTILLASSI
38. python setup py install running install running build running build_py creating build creating build lib copying gclib py gt build lib running install_lib copying build lib gclib py gt C Python34 Lib site packages byte compiling C Python34 Lib site packages gclib py to gclib cpython 34 pyc running install_egg_info Writing C Python34 Lib site packages gclib 1 0 py3 4 egg info FAGA GG The gclib Python wrapper is now installed Go to the next section Using gclib from the Python Interpreter Linux Type the following commands into a Terminal prompt mkdir python_temp 5 cd python_temp tar xvf usr share doc gclib src gclib_256_python tar gz gclib py setup py tar xvf usr share doc gclib src gclib_256_python_examples tar gz example py 5 sudo python setup py install sudo password for user running install running build running build_py creating build creating build lib copying gclib py gt build lib running install_lib copying build lib gclib py gt usr lib python2 7 site packages byte compiling usr lib python2 7 site packages gclib py to gclib pyc running install_egg_info Writing usr lib python2 7 site packages gclib 1 0 py2 7 egg info The gclib Python wrapper is now installed Go to the next section Using gclib from the Python Interpreter OS X Be sure that the Create Environment Variable step has been followed in the OS X installation instructions T
39. string containing the path to the array file file will be overwritten if it exists names Null terminated string containing the arrays to upload delimited with space or null uploads all arrays listed in LA Returns The success status or error code of the function See gclib_errors h for possible values See x_arrays cpp for an example Definition at line 326 of file arrays c References G_NO_ERROR GCmaT H_FreeArrays H_InitArrayNode H_UploadArrayToList and H_Write ArrayCsv 9 1 2 3 GReturn H_DownloadArraysFromList GCon g ArrayNode head Walks through the array linked list downloading each gclib 280 9 2 gclib h File Reference 89 Warning This function will call DA and DM which modifies the controllers array table This should NOT be done while running record array see RA RC RD or while using the MODBUS array sharing feature see ME To prevent any possibility of array table issues dimension all the arrays used in the applications with the appropriate lengths before use and comment out the array table modification section below Definition at line 126 of file arrays c References G_BOUNDS G_NO_ERROR GArrayDownload and GCma Referenced by GArrayDownloadFile 9 2 gclib h File Reference include gclib_record h include gclib_errors h Macros define GCLIB_DLL_EXPORTED define GCALL __ stdcall Specify calling convention for Windows define G_
40. 0000 16 0000 18 0000 20 0000 2 0000 1 0000 3 0000 5 0000 10 0000 12 0000 14 0000 16 0000 18 0000 20 0000 w 0000 5 0000 10 0000 2 0000 1 0000 3 0000 5 0000 10 0000 12 0000 14 0000 16 0000 18 0000 20 0000 KKEKKKKKKKK KKK KKK KKK KKK KKK KKK TH KH KH TH TH TH KH TH TH TH A KK TH TH TH KK TH TH TH Example GRecord usage KKKKKKKKKK KKK KKK KKK AAA KK KK TH KH KH KH TH TH TH TH TH TH A KK TH FH KK TH TH TH TH A OR based data record 8358 0 DR based data record 8462 8564 8666 8768 8870 8972 9074 9176 9278 9380 gclib 280 5 2 Python 41 19482 OR based data record with offsets 19482 19482 KEK KK KKK KKK KKK KKK KKK KKK KKK KKK TH TH TH AH TH TH TA KA TA FH TH AH TH A KH KKK Example GMessage usage KKK KKK KKK KKK KKK KKK KK KKK TH FH KH AH KH AH KH TH TH AH KH AH A
41. 27 110 250 192 168 0 42 DMC4080 Rev 1 2c 783 Experiment with the example by uncommenting sections between the triple quotes python example py gclib version py 127 110 250 192 168 0 42 DMC4080 Rev 1 2c 783 GProgramDownload correctly errored Can t fit with level 3 compression Uploaded program A i 0 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 EN Downloaded program verified Array element verified 187942 0000 Starting move done gclib 280 44 Using gclib Getting help gt gt gt help g GOpen Help on method GOpen in module gclib GOpen address method of gclib py instance Opens a connection a galil controller See the gclib docs for address string formatting See Link GOpen lt http www galil com sw pub al1 doc gclib html gclib_8h_aeflaec8a85630eed029 b7a46aea7db gt gt gt help g GCommand Help on method GCommand in module gclib GCommand command method of gclib py instance Performs a command and response transaction on the connection Trims the response See Link GCommand lt http www galil com sw pub all doc gclib html gclib_8h_a5ac03le76efc965affdd73albecl gt gt gt for a full listing try help g 5 3 Net VB NET C NET 5 3 1 VB NET gclib ships with gclib vb a Visual Basic class which exposes the functionality of the gclib In addition a VB forms example is included which
42. 39 dev ttyS3 08 dev ttyUSBO In the above listing dialout is the group that needs to be joined uucp is another common group that may be listed gclib 280 3 5 Red Hat 8 CentOS Linux 21 Add the desired username to the group sudo gpasswd a username dialout sudo password for username Adding user username to group dialout Log out and back in for change to take effect groups username wheel dialout gelib can now connect to serial and usb devices from user username PCI Controllers If using a Galil PCI controller the PCI driver must be installed Install prerequisites 5 sudo yum install kernel devel uname r sudo yum install kernel headers uname r sudo yum install gcc Extract source and build driver tar xf usr share doc gclib src gclib_202_pci tar gz make Copy module and add to kernel sudo cp galilpci ko lib modules uname r sudo depmod sudo modprobe galilpci Add galil group for access to PCI sudo groupadd f K GID_MIN 100 K GID_MAX 499 galil sudo cp 90 galilpci rules etc udev rules d sudo udevadm control reload rules sudo udevadm trigger sudo usermod a G galil username exchange username with actual user s name UN UN 117 17 Ue Logout and back in The PCI hardware is now available for access 5 ls 1 dev galilx erw rw 1 root galil 10 56 Jun 9 1 07 0 echo e x12 x16 r gt dev galilpci0 cat 0 DMC1846 Rev 1 la Documentatio
43. CStringln file_path After filling the array list this function is called to write out the CSV e GReturn GCALL GArrayDownloadFile GCon g GCStringln file_path Array download from file GReturn GCALL GArrayUploadFile GCon g GCStringln file_path GCStringIn names Array upload to file 88 File Documentation 9 1 1 Detailed Description Function calls for uploading and downloading arrays with CSV files Definition in file arrays c 9 1 2 Function Documentation 9 1 2 1 GReturn GCALL GArrayDownloadFile GCon GCStringin file_path Array download from file Downloads a csv file containing array data at file_path If the arrays don t exist they will be dimensioned Parameters g Connection s handle file_path Null terminated string containing the path to the array file Returns The success status or error code of the function See gclib_errors h for possible values See x_arrays cpp for an example Definition at line 251 of file arrays c References G_BAD_FILE G_NO_ERROR H_ArrayAddElement H_CreateArrayNode H_DownloadArrays FromList H_FreeArrays and H_InitArrayNode 9 1 2 2 GReturn GCALL GArrayUploadFile GCon GCStringin file_path GCStringIn names Array upload to file Uploads the entire controller array table or a subset and saves the data as a csv file specified by file_path Parameters g Connection s handle file_path Null terminated
44. DR 1 Value for GRecord method variable for acquiring a data record via DR mode define G_QR 0 Value for GRecord method variable for acquiring a data record via QR mode define G_BOUNDS 1 For functions that take range options e g GArrayUpload use this value for full range define G_CRO For GArrayUpload use this value in the delim field to delimit with carriage returns define G_COMMA 1 For GArrayUpload use this value in the delim field to delimit with commas define G_UTIL_TIMEOUT 1 GUtility Access to timeout define G_UTIL_TIMEOUT_ OVERRIDE 2 GUtility read write access to timeout override define G_USE_INITIAL_TIMEOUT 1 GUtility for timeout override Set G_UTIL_TIMEOUT_OVERRIDE to this value to use initial GOpen timeout timeout define G_UTIL_VERSION 128 GuUtility get a library version string define G_UTIL_INFO 9 GUtility get a connection info string define G_UTIL_SLEEP 0 GUtility specify an interval to sleep define G_UTIL_ADDRESSES 131 GUtility get a list of available connections define G_UTIL_IPREQUEST 132 GUtility get a list of hardware requesting IPs define G_UTIL_ASSIGN 133 GUtility assign gclib 280 90 File Documentation define G_SMALL_BUFFER 1024 Most reads writes to Galil are small This value will easily hold most e g TH TZ etc define G_HUGE_BUFFER 524288 Most reads writes to Galil hardware ar
45. EN 10 1 3 178 00750 4c 40 10 58 Assign 10 1 3 178 TO 0050465403 10558 Referenced by GAddresses GAssign Glnfo GlpRequests GSleep GTimeout and GVersion 9 2 2 14 GCLIB_DLL_EXPORTED GReturn GCALL GWrite GCon g GBufln buffer GSize buffer_len Performs a write on the connection Parameters g Connection s handle buffer The user s write buffer To send a Galil command a terminating carriage return is usually required buffer_len The length of the data in the buffer Returns The success status or error code of the function See gclib_errors h for possible values If G_NO_ERROR is returned all bytes were written See x_gread_gwrite cpp for an example gclib 280 9 3 gclib_errors h File Reference 103 9 3 gclib_errors h File Reference Macros define G_NO_ERROR 0 Return value if function succeeded define G_NO_ERROR_S no error define G_GCLIB_ERROR 1 General library error Indicates internal API caught an unexpected error Contact Galil support if this error is returned softwaresupport galil com define G_GCLIB_ERROR_S gclib unexpected error define G_GCLIB_UTILITY_ERROR 2 An invalid request value was specified to GUtility define G_GCLIB_UTILITY_ERROR_S invalid request value or bad arguments were specified to GUtility define G_GCLIB_UTILITY_IP_TAKEN 3 define G_GCLIB_UTILITY_IP_TAKEN_S ip address is already taken by a
46. GMessage usage KKK KKK KKK KKK KKK KKK KK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 o OF 5 00 wo kkkkkkkkxkkxkxkkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkxkxkkkkkkxkkkkkkkkxkkkkkkkkkxk Example GInterrupt usage KKK KKK KKK KKK KKK KKK KK KKK KKK HK TH KH KH KH KH KH KK AH KH TH TH KH TA TH TH AH A UI 8 executed kkkkxkxkkkkkxkxkkkkkkkkkkkkkkkkkkkkkkkxkkkkkkkkkkkkxkxkxkkkkkkxkkkkkkkkxkkkkkkkkkxk Example GMotionComplete usage KKKKKKK KKK KKK KKK KKK KKK KKK KK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KK KK KK Position 0 0 Beginning independent motion Motion Complete on A Position 8000 0 Position 0 0 Beginning vector motion Motion Complete on vector plane S Position 6000 O gclib 280 36 Using gclib examples cpp executed OK main is finished Press Enter to exit 5 1 4 gcc Linux The following instructions were performed on uname a Linux localhost localdomain 3 17 4 301 fc21 x86_64 1 SMP Thu Nov 27 19 09 10 UTC 2014 x86_64 x86_64 x86_64 GN 5 g version
47. GProgramDownloadFile GCon g GCStringin file_path GC Stringln preprocessor Program download from file GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile GCon g GCStringlIn file_path Program upload to file GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownloadFile GCon g GCStringin file_path Array download from file GCLIB_DLL_EXPORTED GReturn GCALL GArrayUploadFile GCon GCStringin file_path GCStringIn names Array upload to file GCLIB_DLL_EXPORTED GReturn GCALL GlpRequests GCStringOut requests GSize requests_len Provides a list of all Galil controllers requesting IP addresses via BOOT P or DHCP e GCLIB_DLL_EXPORTED GReturn GCALL GAssign char xip char mac Assigns IP address over the Ethernet to a controller at a given MAC address e GCLIB_DLL_EXPORTED void GCALL GError GReturn rc GCStringOut error GSize error_len Provides a human readable description string for return codes 9 6 1 Detailed Description Open source convenience functions for Galil C Lib Please email softwarefeedback galil com with sug gestions for useful missing functions Definition in file gclibo h 9 6 2 Function Documentation 9 6 2 1 GCLIB_DLL_EXPORTED GReturn GCALL GAddresses GCStringOut addresses GSize addresses_len Uses GuUtility and G_UTIL_ADDRESSES to provide a listing of all available connection addresses Note Serial ports are listed e g COM1 It may be necesary to specify a baud rate for t
48. K RARA RARA ARK KKK AAA AAA AAA AAA FH KA KK KK KK o 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00 KK AA AAA RARA AAA KH KARA AAA KKKKKKKKKKKK Example GInterrupt usage ES UI 8 executed KKKKKKKKKKKK KKK KK KKK KKK KKK KKK KKK ARK TH TH AAA AAA AAA AAA TH A KK KK KA KKK Position Beginning Position Position Beginning Position Example GMotionComplete usage KKKKKKKKKKKK KKK KK KKK KKK KKK KKK KKK RRA KK AAA AAA AAA AAA AAA AAA AAA KK KK AAA 0 0 independent motion Motion Complete on A 8000 0 Ue vector motion Motion Complete on vector plane S 6000 O examples cpp executed OK main is finished Press Enter to exit 5 1 3 Borland C The following instructions were performed on Embarcadero C 7 10 for Win32 Copyright c 1993 2015 Embarcadero Technologies Inc For brevity these instructions assume the default installation location of C Program Files x86 Galil g
49. KK KKK KKK KKK AAA AAA AAA AAA AA AAA AAA KA 422902 0000 KREKKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KKK KKK KKK KKK KKK Example GInterrupt non blocking usage KEKKK KK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KKK KKK KKK TH TH A RU F1 AS Example GRecord non blocking usage KKK KKK KKK KKK KKK KK KK KKK KEK KKK KK KKK KKK A AAA AAA KARA AAA AAA KARA KA AA AAA A 33786 examples cpp executed OK main is finished Press Enter to exit 5 2 Python Install gclib The gclib Python wrapper assumes the default gclib installation location Install Python e See https www python org if Python is not already installed on the system The gclib Python wrapper supports Python versions 2 and 3 gclib 280 42 Using gclib On Windows choose to add Python to the environment variable during installation This allows Python to be invoked from the command line Install the gclib Python module Windows Type the following commands into a command prompt Users username gt cd Desktop Users username Desktop gt mkdir python_temp Users username Desktop gt cd python_temp Users username Desktop python_temp gt copy c Program Files x86 Galil gclib source wrappers python Users username Desktop python_temp gt copy c Program Files x86 Galil gclib examples python x Users username Desktop python_temp gt
50. L axis_c_position_error C axis position error SL axis_c_aux_position C axis auxiliary position SL axis_c_velocity C axis velocity SL axis_c_torque C axis torque UW axis_c_analog_in C axis analog input UB axis_c_reserved_0 Reserved UB axis_c_reserved_1 Reserved SL axis_c_variable C User defined variable ZA UW axis_d_ status D axis status UB axis_d_switches D axis switches UB axis_d_stop_code D axis stop code SL axis_d_reference_position D axis reference position SL axis_d_motor_position D axis motor position SL axis_d_position_error D axis position error SL axis_d_aux_position D axis auxiliary position SL axis_d_velocity D axis velocity SL axis_d_torque D axis torque UW axis_d_analog_in D axis analog input UB axis_d_reserved_0 Reserved UB axis_d_reserved_1 Reserved SL axis_d_variable D User defined variable ZA UW axis_e status E axis status UB axis_e switches E axis switches UB axis_e stop code E axis stop code SL axis_e_reference_position E axis reference position SL axis_e_motor_position gclib 280 8 3 GDataRecord1806 Struct Reference 65 E axis motor position SL axis_e position_error E axis position error SL axis_e aux_position E axis auxiliary position SL axis_e velocity E axis velocity SL axis_e torque E axis torque UW axis_e_analog_in E axis analog input UBaxis_e reserved_0 Reserved UBaxis_e reserved_1 Reserved SL ax
51. R period to the period requested by the user if possible gclib 280 112 File Documentation Parameters g Connection s handle period_ms Period in milliseconds to set up for the asynchronous data record Returns The success status or error code of the function See gclib_errors h for possible values See x_grecord cpp for an example Definition at line 134 of file gclibo c References G_NO_ERROR G_SMALL_BUFFER GCmd GCmdD and GCmdT 9 5 2 14 void GCALL GSleep unsigned int timeout_ms Uses GuUtility and G_UTIL_SLEEP to provide a blocking sleep call which can be useful for timing based chores Parameters timeout_ms The timeout in milliseconds to block before returning See GMotionComplete for an example Definition at line 9 of file gclibo c References G_UTIL_SLEEP and GuUtility Referenced by GMotionComplete 9 5 2 15 GReturn GCALL GTimeout GCon g short timeout_ms Uses GuUtility and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout Parameters g Connection s handle timeout_ms The value to be used for the timeout Use G_USE_INITIAL_TIMEOUT to set the timeout back to the initial GOpen value timeout Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp and x_gread_gwrite cpp for examples Definition at line 29 of file gcl
52. ROGRAM G_INVALID_ PREPROCESSOR_OPTIONS G_NO_ERROR G_OPEN_ERROR G_TIMEO UT G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT and G_UNSUPPORTED_FUNCTION 9 6 2 10 GCLIB_DLL_EXPORTED GReturn GCALL Ginfo GCon g GCStringOut info GSize info_len Uses GuUtility and G_UTIL_INFO to provide a useful connection string Parameters g Connection s handle info Buffer to hold the output string Buffer will be null terminated even if the data must be truncated to do so info_len Length of buffer Returns The success status or error code of the function See gclib_errors h for possible values See x_examples cpp for an example Definition at line 19 of file gclibo c References G_UTIL_INFO and GuUtility 9 6 2 11 GCLIB_DLL_EXPORTED GReturn GCALL GipRequests GCStringOut requests GSize requests_len Provides a list of all Galil controllers requesting IP addresses via BOOT P or DHCP Parameters requests The buffer to hold the list of requesting controllers Data will be null terminated even if the data must be truncated to do so requests_len The length of the requests buffer Returns The success status or error code of the function See gclib_errors h for possible values GlpRequests will block about 5 seconds while listening for requests Note Linux OS X users must be root to use GlpRequests and have UDP access to bind and listen on port 67 example of listening for controller
53. Solution Explorer right click on gclib_example and choose Properties Choose the Build item on the left In the Configuration combobox choose All Configurations Choose x86 from the Platform combobox In Conditional compilation symbols type x86 If x64 is to be used also add an x64 token as well to the x64 Platform Save and close the Properties window Inthe Solution Explorer right click on gclib_example and choose Add gt Existing Item Navigate to the installation location C Program Files x86 Galil gclib source wrappers cs Choose gclib cs e Inthe Solution Explorer double click on gclib cs Note that there is a preprocessor definition starting with i f x86 and telif x64 Note that these sections of code enable disable with the choice of the Solution Platform x86 x64 usually found in the Visual Studio toolbar If a non default gclib installation location is used the paths in these sections of code must be updated to reflect the dll locations gclib 280 48 Using gclib Add some simple code Inthe Solution Explorer right click on Form1 cs and choose View Code Replace the text in Form 1 vb with the following code using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Ling using System Text using System Threading Tasks using System Windows Forms namespace gclib_example public pa
54. The directory gclib examples msvc has fully functional MSVC examples These instructions detail how to use the 2013 version Copy gclib lexamples msvc 2013_12 0 gclib_example to a convenient writable location e g C temp Run gclib_example gclib_example copy_source bat to copy the files Open gclib_example gclib_example sin in Visual Studio 2013 Inthe Solution Explorer expand the gclib_example and expand Source Files to show a listing of source Open x_examples cpp Find the GOpen call and update the address to match the desired hardware See the documentation for GOpen for address formatting options e Find the if 0 preprocessor block enclosing the example calls Change to if 1 to run the examples Comment out the function calls to be avoided Note some calls attempt to move motors and not all functions are compatible with all Galil products Hit F5 to build and run the example Create Project with MSVC 2013 x_examples cpp The instructions below allow building a project from scratch The following instructions were performed on Visual Studio Professional 2013 and can be extended to other Vi sual Studio versions For brevity the instructions assume the default installation location of C Program Files x86 Galil gclib and a build type of x86 win32 gclib 280 5 1 C C 29 Launch Visual Studio 2013 Choose File gt New gt Project In the New Project dialog choose Visual C gt
55. UB error_code Error code UB general_status General status UW output_analog_0 Analog output 0 UW output_analog_1 Analog output 1 UW output_analog_2 Analog output 2 gclib 280 8 7 GDataRecord47000_ENC Struct Reference 81 UW output_analog_3 Analog output 3 UW output_analog_4 Analog output 4 UW output_analog_5 Analog output 5 UW output_analog_6 Analog output 6 UW output_analog_7 Analog output 7 UW input_analog_0 Analog input 0 UW input_analog_1 Analog input 1 UW input_analog_2 Analog input 2 UW input_analog_3 Analog input 3 UW input_analog_4 Analog input 4 UW input_analog_5 Analog input 5 UW input_analog_6 Analog input 6 UW input_analog_7 Analog input 7 UW output_bank_0 Digital outputs 0 15 UW input_bank_0 Digital inputs 0 15 UL pulse_count_0 Pulse counter see PC SLzc variable ZC User defined variable see ZC SL zd variable ZD User defined variable see ZD SLencoder_0 Encoder channel 0 Data only valid for parts with BISS QUAD or SSI SL encoder_1 Encoder channel 1 Data only valid for parts with BISS QUAD or SSI SL encoder _2 Encoder channel 2 Data only valid for parts with BISS QUAD or SSI SL encoder _3 Encoder channel 3 Data only valid for parts with BISS QUAD or SSI 8 7 1 Detailed Description Data record struct for RIO 471xx and RIO 472xx PLCs Includes encoder fi
56. Using gclib 36306 36408 36510 36612 36714 36816 36918 37020 37122 37224 OR based data record with offsets 37224 37224 A AH TH TA TH TA KA KH KH KH KH A KH KKK KKK KKK KKK KKK KKK KKK KKK KKK KT Example GMessage usage kkkkxkxkxkkxkkxkxkkkkkkkkkkkkkxkxkxkkkkkkkkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkxkxkkkkkkkkkxk 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 o 3004 00 kkkkkkkkkkxkxkkkkkkkkkkkkkkxkkkkkkkkkkkkkkk kkkkkkkxkxkxkkkkkkxkkkkkkkkxkkkkkkkkkxk Example GInterrupt usage KKK KKK KKK KKK KKK KKK KK KKK KKK HK TH KH TH KH KH KH KK AH KH TH TH TH A KH KH KH TA FH TH TH A KKK UI 8 executed TH TH TH TH FH A TH FH TH A KK TH TH TH TH TH KH KH KK KK TH
57. Vi sual Studio versions For brevity the instructions assume the default installation location of C Program Files x86 Galil gclib and a build type of x86 win32 Launch the compiler command prompt Open VS2013 x86 Native Tools Command Prompt Navigate to a convenient writable location e g C ltemp Set an environment variable for the base path C temp gt set base C Program Files x86 Galil gclib Compile the source code Note the quotes C temp gt cl c Sbase source wrappers gcl cpp I Sbaseslinclude EHsc MD 24 Legacy Compatibility Link the source code Note the quotes C temp gt link DLL gcl_datarecord obj gcl_galil obj base lib dynamic x86 gclib lib Sbase lib dynamic x86 The output files galil2 dll and galil2 lib can now be used in a project using the GCL Test Help the loader find the right dlls C temp gt set PATH PATH SBASE d11 x86 Link the simple example C temp gt link gcl_simple obj base lib dynamic x86 gclib lib Sbase lib dynamic x86 gclibo lib galil2 lib Run the example C temp gt simple exe Galil2 dll wrapper gclib 106 75 180 10 1 3 169 DMC4020 Rev 1 2c 291 Linux Copy files tar xzf usr share doc gclib src gclib_164_gcl tar gz 18 Galil h gcl_galil cpp gcl_simple cpp gcl_datarecord cpp gcl_galil h makefile Make and install make gcl open source wrapper for gclib Compiling wrapper libgalil so 2 0 g c fPIC std c 11 gcl_dat
58. _0 Analog input 0 UW input_analog_1 Analog input 1 UW input_analog_2 Analog input 2 UW input_analog_3 Analog input 3 UW input_analog_4 Analog input 4 UW input_analog_5 Analog input 5 UW input_analog_6 Analog input 6 UW input_analog_7 Analog input 7 UW output_bank_0 Digital outputs 0 15 UW output_bank_1 Digital outputs 16 23 UW input_bank_0 Digital inputs 0 15 UW input_bank_1 Digital inputs 16 23 UL pulse_count_0 Pulse counter see PC SL zc_variable ZC User defined variable see ZC gclib 280 8 10 H_ArrayData Struct Reference SL zd variable ZD User defined variable see ZD SL encoder_0 Encoder channel 0 Data only valid for parts with BISS QUAD or SSI SL encoder_1 Encoder channel 1 Data only valid for parts with BISS QUAD or SSI SL encoder _2 Encoder channel 2 Data only valid for parts with BISS QUAD or SSI SL encoder_3 Encoder channel 3 Data only valid for parts with BISS QUAD or SSI 8 9 1 Detailed Description Data record struct for RIO 47300 Includes encoder fields Definition at line 763 of file gclib_record h The documentation for this struct was generated from the following file gclib_record h 8 10 H_ArrayData Struct Reference Structure to create a linked list for array data Data Fields char name 16 char x data intlen e int elements int index struct H_ArrayData next struc
59. _BLOCKING_READ_EMPTY G_GCLIB_UTILITY_ERROR G_ILLEGAL_DA gt TA_IN_PROGRAM G_INVALID_ PREPROCESSOR_OPTIONS G_NO_ERROR G_OPEN_ERROR G_TIMEO UT G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT and G_UNSUPPORTED_FUNCTION gclib 280 9 5 gclibo c File Reference 109 9 5 2 8 GReturn GCALL Ginfo GCon g GCStringOut info GSize info_len Uses GuUtility and G_UTIL_INFO to provide a useful connection string gclib 280 110 File Documentation Parameters g Connection s handle info Buffer to hold the output string Buffer will be null terminated even if the data must be truncated to do so info_len Length of buffer Returns The success status or error code of the function See gclib_errors h for possible values See x_examples cpp for an example Definition at line 19 of file gclibo c References G_UTIL_INFO and GuUtility 9 5 2 9 GReturn GCALL GlpRequests GCStringOut requests GSize requests_len Provides a list of all Galil controllers requesting IP addresses via BOOT P or DHCP Parameters requests The buffer to hold the list of requesting controllers Data will be null terminated even if the data must be truncated to do so requests_len The length of the requests buffer Returns The success status or error code of the function See gclib_errors h for possible values GlpRequests will block about 5 seconds while listening for requests Note Linu
60. accessor Macros define GALILDATARECORDMAXLENGTH 512 Max size for any Galil data record equal to dual port ram size of PCI gclib 280 9 5 gclibo c File Reference 105 Typedefs e typedef unsigned char UB typedef unsigned short UW typedef short SW typedef int SL e typedef unsigned int UL 9 4 1 Detailed Description Defines a union for data records Each supported controller has a struct member in the union with named record types Offsets into the data record can also be used by referencing the member byte_array Definition in file gclib_record h 9 5 gclibo c File Reference include gclibo h Functions void GCALL GSleep unsigned int timeout_ms Uses GUtility and G_UTIL_SLEEP to provide a blocking sleep call which can be useful for timing based chores GReturn GCALL GVersion GCStringOut ver GSize ver_len Uses GUtility and G_UTIL_VERSION to provide the library version number GReturn GCALL Ginfo GCon g GCStringOut info GSize info_len Uses GuUtility and G_UTIL_ INFO to provide a useful connection string GReturn GCALL GAddresses GCStringOut addresses GSize addresses_len Uses GuUtility and G_UTIL_ADDRESSES to provide a listing of all available connection addresses GReturn GCALL GTimeout GCon g short timeout_ms Uses GuUtility and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout GReturn GCALL GAssign char xip char mac Assigns IP address over the Ethernet
61. and update the address to match the desired hardware See the documentation for GOpen for address formatting options e Find the if 0 preprocessor block enclosing the example calls Change to if 1 to run the examples Comment out the function calls to be avoided Note some calls attempt to move motors and not all functions are compatible with all Galil products Hit F5 to build and run the example 5 1 2 MinGW The following instructions were performed with x86 Minimalist GNU for Windows MinGW installed from http mingw w64 sourceforge net download php mingw builds For brevity these instructions assume the default installation location of C Program Files x86 Galil gclib Copy Files Copy gclib examples mingw to a convenient writable location e g C temp Run temp mingw copye _source bat to copy all files gclib 280 30 Using gclib x_simple c Edit GOpen call as necessary In a text editor open x_simple c Find the GOpen call and update the address to match the desired hardware See the documentation for GOpen for address formatting options Compile Launch the MinGW terminal e g Start gt All Programs gt MinGW W64 project gt 686 4 9 1 posix dwarf rt_v3 rev3 gt Run Terminal Navigate to the directory with the files above Compile the code C temp mingw gt gcc x_simple c L lgclibo lgclib o simple exe Execute C temp mingw gt simple exe
62. arecord cpp gcl_galil cpp Linking wrapper into shared library g shared o libgalil so 2 0 o Wl soname libgalil so 2 strip strip unneeded libgalil so 2 0 Cleaning up sudo make install Installing libgalil so 2 0 install m 755 libgalil so 2 0 usr lib install m 644 Galil h usr lib ldconfig In s usr lib libgalil so 2 usr lib libgalil so make clean Cleaning project Test g gcl_simple cpp lgalil lgclib lgclibo o simple 5 simple Galil2 dll wrapper gclib 95 71 164 10 1 3 169 DMC4020 Rev 1 2c 291 gclib 280 4 2 DMC32 OSU 25 4 2 DMC32 OSU Note gclib provides the communications foundation for the DMC32 Operating System Upgrade OSU project DMC32 OSU is intended for existing applications that used software based on the legacy DMCWIN32 library for Windows XP and earlier If such an application must be upgraded to Windows 7 8 or 8 1 DMC32 OSU may be used on these O S upgrades Galil s Windows XP support statement http www galil com about xp support For more information refer to the documentation http www galil com sw pub all doc dmc32osu html ir html See the release notes for changes http www galil com sw pub all rn dmc32osu html The installer is available for download from Galil s website http www galil com sw pub win dmc32osu gali _dmc32_osu_exe html gclib 280 26 Legacy Compatibility gclib 280 Chapter 5 Using gclib A number of e
63. axis analog input UB axis_b_halls B Hall Input Status UB axis_b_reserved Reserved SL axis_b_variable B User defined variable ZA UW axis_c_status C axis status UB axis_c_switches C axis switches UB axis_c_stop_code C axis stop code SL axis_c_reference_position C axis reference position SL axis_c_motor_position C axis motor position SL axis_c_position_error C axis position error SL axis_c_aux_position C axis auxiliary position SL axis_c_velocity C axis velocity SL axis_c_torque C axis torque UW axis_c_analog_in C axis analog input UB axis_c_halls C Hall Input Status UB axis_c reserved Reserved SLaxis_c variable C User defined variable ZA UW axis_d_status D axis status UB axis_d switches D axis switches UB axis_d_stop_code D axis stop code SL axis_d_reference_position D axis reference position SL axis_d_motor_position D axis motor position SL axis_d_position_error D axis position error SL axis_d_aux_position D axis auxiliary position SL axis_d_velocity D axis velocity gclib 280 78 Data Structure Documentation SL axis_d_torque D axis torque UW axis_d_analog_in D axis analog input UB axis_d_halls D Hall Input Status UB axis_d_reserved Reserved SL axis_d_variable D User defined variable ZA UW axis_e status E axis status UB axis_e switches E axis switches UB axis_e stop code E axis sto
64. ays c makefile_gclibo cp Applications gclib include x cp Applications gclib dylib gclib 0 dylib ls arrays c gclib h gclib_record h gclibo h gclib 0 dylib gclib_errors h gclibo c makefile_gclibo KK MH 76 Modify source Make any necessary changes For this example the Glnfo function was changed from GReturn GCALL GInfo GCon g GCStringOut info GSize info_len return GUtility g G_UTIL_INFO info amp info_len to GReturn GCALL GInfo GCon g GCStringOut info GSize info_len strncpy info My controller info_len return G_NO_ERROR return GUtility g G_UTIL_INFO info sinfo_len Make and install 5 make f makefile_gclibo Open source component gclibo 0 dylib Compiling open source component gcc c Wall Werror fPIC fvisibility hidden DBUILDING_GCLIB DHAVE_VISIBILITY c Linking open source component into shared library gcc dynamiclib o gclibo 0 dylib o gclib 0 dylib strip u r gclibo 0 dylib Cleaning up make install f makefile_gclibo Installing gclibo 0 dylib cp gclibo 0 dylib Applications gclib dylib make clean f makefile_gclibo Cleaning project Test Extract simple example tar xzf Applications gclib examples gclib_253_examples tar gz x_simple c Edit GOpen call as necessary Compile 5 gcc x_simple c Wall Werror gclib 0 dylib gclibo 0 dylib o simple Execute 5 simple gclib 280 tas N version 127 110 253 tes 0
65. clib Copy Files Copy gclib examples borland to a convenient writable location e g C temp RunC temp borland copy gt _source bat to copy all files C temp gt cd borland C temp b Program Program Program Program Program Program Program Program or Fil Fil Fi Fi Fil Fil Fil Fil land gt copy_source bat es x86 Galil gclib examples cpp x_arrays cpp es x86 Galil gclib examples cpp x_examples cpp les x86 Galil gclib examples cpp x_examples h les x86 Galil gclib examples cpp x_gcommand cpp les x86 Galil gclib examples cpp x_ginterrupt cpp es x86 Galil gclib examples cpp x_gmessage cpp es x86 Galil gclib examples cpp x_gmotioncomplete cpp es x86 Galil gclib examples cpp x_gread_gwrite cpp gclib 280 5 1 C C 33 x86 x86 Galil gclib examples cpp x_nonblocking cpp Program Files x86 Galil gclib examples cpp x_programs cpp Program Files x86 Galil gclib examples cpp x_simple c Galil gclib examples cpp x_grecord cpp 12 file s copied Program Files Program Files tr Program Files x86 Galil gclib include gclib h Program Files x86 Galil gclib include gclibo h Program Files x86 Galil gclib include gclib_errors h Program Files x86 Galil gclib include gclib_record h 4 file s copied Program Files x86 Galil gclib lib dynamic x86 gclib lib Program Files x86 Galil gclib lib dynamic
66. cquisition Returns The success status or error code of the function See gclib_errors h for possible values When using G_DR the asynchronous data record must already be set up s DR must be used in the GOpen address string to subscribe to records The driver will automatically set the second argument of DR where applicable GRecordRate should be issued to set DR to an appropriate interval n The interval must be no faster than the rate at which GRecord is called GRecord will block until the data record is received or the transaction times out Note If this function is called with a timeout of zero and the G_DR method a non blocking read is performed If a data record has been processed since the last time the function was called this data will be returned If there is not a processed data reecord but there is data waiting in the socket or PCI FIFO one read will be performed to process the waiting data If new data is still not found after these two attempts G_GCLIB_NO N_BLOCKING_READ_EMPTY will be returned See x_grecord cpp for an example See x_nonblocking cpp for an example of non blocking usage 9 2 2 13 GCLIB_DLL_EXPORTED GReturn GCALL GuUtility GCon g GOption request GMemory memory1 GMemory memory2 Provides read write access to driver settings and convenience features based on the request variable gclib 280 100 File Documentation Note The open source library gclibo h
67. date the address to match the desired hard ware See the documentation for GOpen for address formatting options Compile 5 gcc Wall Werror x_simple c gclib 0 dylib gclibo 0 dylib o simple Run simple rez 0 version 126 108 229 ror 0 rez 0 info 10 1 3 142 DMC4020 Rev 1 2a BH 291 ros 0 response 206676 0000 X_examples cpp e In a text editor open x_examples cpp Find the GOpen call and update the address to match the desired hardware See the documentation for GOpen for address formatting options Don t forget s ALL if data records interrupts and messages are to be tested e Find the if 0 preprocessor block enclosing the example calls Change to if 1 to run the examples Comment out the function calls to be avoided Note some calls attempt to move motors and not all functions are compatible with all Galil products Compile g x_ cpp gclib 0 dylib gclibo 0 dylib o example Run 5 example Library version 126 108 229 10 1 3 142 DMC4020 Rev 1 2a BH 291 PORRO RR RO ROO ROO ROO ROO ee ROO ee ROO RR RR RR RR AR Example GRead and GWrite usage AS Read 1 byte s gclib 280 40 Using gclib Program test OK KKEKKKKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KK KK AR Example GCommand usage KKKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK AAA KKK KKK KKK KKK KKK KKK Revision report R V DMC4020 Rev 1 2a BH
68. e and Importing GPG key if prompted sudo yum install gclib Uninstall Package To uninstall gelib sudo yum remove gclib Installed files The gclib shared object files usr lib libgclibo so usr lib libgclib so The gclib header files usr include gclib_errors h usr include gclibo h usr include gclib h usr include gclib_record h gclib documentation tarball usr share doc gclib gclib_129_doc tar gz Example source tarball usr share doc gclib src gclib_129_examples tar gz e Source files to modify rebuild libgclibo so usr share doc gclib src gclibo_129_src tar gz GalilTools Communication Library gcl wrapper usr share doc gclib src gclib_129_gcl tar gz PCI driver files usr share doc gclib src gclib_129 pci tar gz Serial Ports and USB If access to the serial ports or USB e g DMC 4103 is desired through gclib the following will provide steps to join the correct access group If using USB be sure the controller is powered and the usb is plugged in before beginning Determine group with access ls l dev ttyUSBx dev ttySx erw rw 1 crw rw 1 crw rw 1 crw rw 1 crw rw 1 root root root root root dialout 4 dialout 4 dialout 4 dialout 4 dialout 188 64 65 66 67 Mar Mar Mar Mar Mar N WW Y WwW 16 16 T6 16 11 39 dev ttys0 39 dev ttysl 39 dev ttyS2
69. e g 100 Program insertion will occur on the line after the line specified Variable name e g myvar Program insertion will occur on the line after the line equal to the value of the variable Label callout e g mylabel Program insertion will occur on the line after the label A lone symbol Program insertion will occur on the line after the last line in the program buffer Important Warning It is the user s responsibility to ensure that the code will fit in the inserted location The preprocessor will not check line numbers when executing the insert option Compression directives max and min are followed All original code following the point of insertion is cleared gclib 280 Not all products support the insert operation e g DMC 30010 See the DL command for support 98 File Documentation Returns The success status or error code of the function See gclib_errors h for possible values See x_programs cpp for an example Referenced by GProgramDownloadFile 9 2 2 10 GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload GCon g GBufOut buffer GSize buffer_len Uploads a program from the controller s program buffer Parameters g Connection s handle buffer Buffer to receive the controller s program The data will be null terminated unless function returns G_BAD_LOST_DATA due to the buffer being too small to hold the data buffer_len The length of the receive buf
70. e small This value will hold the largest array or program upload download possible Typedefs typedef int GReturn Every function returns a value of type GReturn See gclib_errors h for possible values e typedef void x GCon Connection handle Unique for each connection in process Assigned a non zero value in GOpen typedef unsigned int GSize Size of buffers etc typedef int GOption Option integer for various formatting etc typedef char GCStringOut C string output from the library Implies null termination typedef const char GCStringIn C string input to the library Implies null termination typedef char GBufOut Data output from the library No null termination implied Returned values may be null terminated see function documentation for details typedef const char GBufln Data input to the library No null termination function will have a GSize to indicate bytes to write typedef unsigned char GStatus Interrupt status byte e typedef void x GMemory Pointer to untyped memory for use in GUtility Functions GCLIB_DLL_EXPORTED GReturn GCALL GOpen GCStringIn address GCon xg Open a connection to a Galil Controller GCLIB_DLL_EXPORTED GReturn GCALL GClose GCon g Closes a connection to a Galil Controller GCLIB_DLL_EXPORTED GReturn GCALL GRead GCon g GBufOut buffer GSize buffer_len GSize xbytes_read Performs a read on the connection e GCLIB_DLL_EXPORTED GReturn GCALL GWrite GCon
71. ed_ The trimmed response from the controller Trailing space is trimmed by null terminating any response trailing spaces carriage returns or line feeds response_len The length of the trimmed_response buffer front If non null upon return front will point to the first non space character in trimmed_response This allows trimming the front of the string without modifying the user s buffer pointer which may be allocated on the heap Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Definition at line 51 of file gclibo c References G_NO_ERROR and GCommand Referenced by GArrayUploadFile and GRecordRate 9 5 2 7 void GCALL GError GReturn rc GCStringOut error GSize error_len Provides a human readable description string for return codes Parameters rc The return code to lookup error The buffer to fill with the error text Buffer will be null terminated even if the data must be truncated to do so error_len The length of the error buffer See x_examples cpp for an example Definition at line 251 of file gelibo c References G_ARRAY_NOT_DIMENSIONED G_BAD_ADDRESS G_BAD_FILE G_BAD_FULL_MEMORY G_ BAD_LOST_DATA G_BAD_RESPONSE_QUESTION_MARK G_BAD_VALUE_RANGE G_COMMAND_CALL gt ED_WITH_ILLEGAL_COMMAND G_DATA_RECORD_ERROR G_FIRMWARE_LOAD_NOT_SUPPORTED Ge _GCLIB_ERROR G_GCLIB_NON
72. elds Definition at line 715 of file gclib_record h The documentation for this struct was generated from the following file gclib_record h gclib 280 82 Data Structure Documentation 8 8 GDataRecord47300_24EX Struct Reference Data record struct for RIO 47300 with 24EX I O daughter board include lt gclib_record h gt Data Fields UB header_0 1st Byte of Header UB header_1 2nd Byte of Header UB header_2 3rd Byte of Header UB header_3 4th Byte of Header UW sample_number Sample number UB error_code Error code UB general_status General status UW output_analog_0 Analog output 0 UW output_analog_1 Analog output 1 UW output_analog_2 Analog output 2 UW output_analog_3 Analog output 3 UW output_analog_4 Analog output 4 UW output_analog_5 Analog output 5 UW output_analog_6 Analog output 6 UW output_analog_7 Analog output 7 UW input_analog_0 Analog input 0 UW input_analog_1 Analog input 1 UW input_analog_2 Analog input 2 UW input_analog_3 Analog input 3 UW input_analog_4 Analog input 4 UW input_analog_5 Analog input 5 UW input_analog_6 gclib 280 8 9 GDataRecord47300_ENC Struct Reference 83 Analog input 6 UW input_analog_7 Analog input 7 UW output_bank_0 Digital outputs 0 15 UW output_bank_1 Digital outputs 16 23 UW input_bank_0 Digital inputs 0 15 UW input_bank_1 Digital inputs 16 23 UL pulse_count_0 Pulse counte
73. equested by the user if possible Parameters g Connection s handle period_ms Period in milliseconds to set up for the asynchronous data record Returns The success status or error code of the function See gclib_errors h for possible values See x_grecord cpp for an example Definition at line 134 of file gclibo c References G_NO_ERROR G_SMALL_BUFFER GCmd GCmdD and GCmdT 9 6 2 16 GCLIB_DLL_EXPORTED void GCALL GSleep unsigned int timeout_ms Uses GuUtility and G_UTIL_SLEEP to provide a blocking sleep call which can be useful for timing based chores Parameters timeout_ms The timeout in milliseconds to block before returning See GMotionComplete for an example Definition at line 9 of file gclibo c References G_UTIL_SLEEP and GuUtility Referenced by GMotionComplete 9 6 2 17 GCLIB_DLL_EXPORTED GReturn GCALL GTimeout GCon g short timeout_ms Uses GuUtility and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout Parameters g Connection s handle gclib 280 122 File Documentation timeout_ms The value to be used for the timeout Use G_USE_INITIAL_TIMEOUT to set the timeout back to the initial GOpen value timeout Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp and x_gread_gwrite cpp for examples Definition at l
74. erved SL axis_a_variable A User defined variable ZA 8 5 1 Detailed Description Data record struct for DMC 30010 controllers Definition at line 663 of file gclib_record h The documentation for this struct was generated from the following file gclib_record h 8 6 GDataRecord4000 Struct Reference Data record struct for DMC 4000 controllers including 4000 4200 4103 and 500x0 include lt gclib_record h gt gclib 280 74 Data Structure Documentation Data Fields UB header_0 1st Byte of Header UB header_1 2nd Byte of Header UB header_2 3rd Byte of Header UB header_3 4th Byte of Header UW sample_number sample number UB input_bank_0 general input bank 0 inputs 1 8 UB input_bank_1 general input bank 1 inputs 9 16 UB input_bank_2 general input bank 2 inputs 17 24 UB input_bank_3 general input bank 3 inputs 25 32 UB input_bank_4 general input bank 4 inputs 33 40 UB input_bank_5 general input bank 5 inputs 41 48 UB input_bank_6 general input bank 6 inputs 49 56 UB input_bank_7 general input bank 7 inputs 57 64 UB input_bank_8 general input bank 8 inputs 65 72 UB input_bank_9 general input bank 9 inputs 73 80 UB output_bank_0 general output bank O outputs 1 8 UB output_bank_1 general output bank 1 outputs 9 16 UB output_bank_2 general output bank 2 outputs 17 24 UB output_bank_3 general output ban
75. ess to send on port 68 example of assigning an IP address GAssign 10 1 3 178 00 50 4c 40 10 58 Assign 10 1 3 178 to 00 50 4c 40 10 58 Definition at line 34 of file gclibo c References G_UTIL_ASSIGN and GuUtility gclib 280 9 5 gclibo c File Reference 107 9 5 2 3 GReturn GCALL GCmd GCon GCStringln command Wrapper around GCommand for use when the return value is not desired The returned data is still checked for error e g or timeout but is not brought out through the prototype Parameters g Connection s handle command Null terminated command string to send to the controller Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Definition at line 44 of file gclibo c References G_SMALL_BUFFER and GCommand Referenced by GRecordRate and H_DownloadArraysFromList 9 5 2 4 GReturn GCALL GCmdD GCon g GCStringln command double x value Wrapper around GCommand that provides the return value of a command parsed into a double Use this function to retrieve the full Galil 4 2 range e g for a variable value with fractional data or the value of an Analog input or Output Parameters g Connection s handle command Null terminated command string to send to the controller value Pointer to a double that will be filled with the return value Re
76. eturns or line feeds response_len The length of the trimmed_response buffer front If non null upon return front will point to the first non space character in trimmed_response This allows trimming the front of the string without modifying the user s buffer pointer which may be allocated on the heap Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Definition at line 51 of file gclibo c References G_NO_ERROR and GCommand Referenced by GArrayUploadFile and GRecordRate 9 6 2 9 GCLIB_DLL_EXPORTED void GCALL GError GReturn rc GCStringOut error GSize error_len Provides a human readable description string for return codes Parameters rc The return code to lookup error The buffer to fill with the error text Buffer will be null terminated even if the data must be truncated to do so gclib 280 9 6 gclibo h File Reference 119 error_len The length of the error buffer See x_examples cpp for an example Definition at line 251 of file gclibo c References G_ARRAY_NOT_DIMENSIONED G_BAD_ADDRESS G_BAD_FILE G_BAD_FULL_MEMORY G_ BAD_LOST_DATA G_BAD_RESPONSE_QUESTION_MARK G_BAD_VALUE_RANGE G_COMMAND_CALL gt ED_WITH_ILLEGAL_COMMAND G_DATA_RECORD_ERROR G_FIRMWARE_LOAD_NOT_SUPPORTED Ge _GCLIB_ERROR G_GCLIB_NON_BLOCKING_READ_EMPTY G_GCLIB_UTILITY_ERROR G_ILLEGAL_DA gt TA_IN_P
77. fer Returns The success status or error code of the function See gclib_errors h for possible values See x_programs cpp for an example Referenced by GProgramUploadFile 9 2 2 11 GCLIB_DLL_EXPORTED GReturn GCALL GRead GCon g GBufOut buffer GSize buffer_len GSize x bytes_read Performs a read on the connection Parameters g Connection s handle buffer The user s read buffer buffer_len The length of the user s read buffer bytes_read Pointer to a GSize which will be filled with the number of bytes read upon return Returns The success status or error code of the function See gclib_errors h for possible values Unsolicited messages may be returned in the read data The high bit of each message byte will be set unless the user changes the CW setting Interrupts and Data Records are always filtered from a read See x_gread_gwrite cpp for an example 9 2 2 12 GCLIB_DLL_EXPORTED GReturn GCALL GRecord GCon g union GDataRecord x record GOption method Provides a fresh copy of the controller s data record Data is cast into a union GDataRecord Parameters g Connection s handle gclib 280 9 2 gclib h File Reference 99 record A pointer to the user s DataRecord union to hold the copy method Determines the method for acquiring the data G_OR QR is used via command and response G_DR DR is used for asynchronous a
78. file specified by file_path Parameters g Connection s handle file_path Null terminated string containing the path to the array file file will be overwritten if it exists names Null terminated string containing the arrays to upload delimited with space or null uploads all arrays listed in LA Returns The success status or error code of the function See gclib_errors h for possible values See x_arrays cpp for an example Definition at line 326 of file arrays c References G_NO_ERROR GCmaT H_FreeArrays H_InitArrayNode H_UploadArrayToList and H_Write ArrayCsv 9 6 2 4 GCLIB_DLL_EXPORTED GReturn GCALL GAssign char x ip char x mac Assigns IP address over the Ethernet to a controller at a given MAC address Parameters ip The null terminated ip address to assign The hardware should not yet have an IP address mac The null terminated MAC address of the hardware Returns The success status or error code of the function See gclib_errors h for possible values The desired IP address will be pinged prior to the assigment If the ping is returned GAssign will return G_GCLIB_UTILI gt TY_IP_TAKEN Note Linux OS X users must be root to use GAssign and have UDP access to send on port 68 example of assigning an IP address GAssign 10 1 3 178 00 5034c 40 10 58 5 Assign 10 1 3 178 6 7158 gclib 280 9 6 gclibo h File Reference 117
79. for DMC 1802 controllers Same as 2103 except no analog in axis data Definition at line 536 of file gclib_record h The documentation for this struct was generated from the following file gclib_record h 8 3 GDataRecord1806 Struct Reference Data record struct for DMC 1806 controller include lt gclib_record h gt Data Fields UW sample_number sample number UB input_bank_0 general input bank 0 inputs 1 8 UB input_bank_1 general input bank 1 inputs 9 16 UB input_bank_2 general input bank 2 inputs 17 24 UB input_bank_3 gclib 280 8 3 GDataRecord1806 Struct Reference 61 general input bank 3 inputs 25 32 UB input_bank_4 general input bank 4 inputs 33 40 UB input_bank_5 general input bank 5 inputs 41 48 UB input_bank_6 general input bank 6 inputs 49 56 UB input_bank_7 general input bank 7 inputs 57 64 UB input_bank_8 general input bank 8 inputs 65 72 UB input_bank_9 general input bank 9 inputs 73 80 UB output_bank_0 general output bank 0 outputs 1 8 UB output_bank_1 general output bank 1 outputs 9 16 UB output_bank_2 general output bank 2 outputs 17 24 UB output_bank_3 general output bank 3 outputs 25 32 UB output_bank_4 general output bank 4 outputs 33 40 UB output_bank_5 general output bank 5 outputs 41 48 UB output_bank_6 general output bank 6 outputs 49 56 UB outpu
80. g GCC 4 9 2 20150212 Red Hat 4 9 2 6 Copy Files mkdir test cd test tar xzf usr share doc gclib src gclib_131_examples tar gz ls x_arrays cpp x_gcommand cpp x_gmotioncomplete cpp x_programs cpp x_examples cpp x_ginterrupt cpp x_gread_gwrite cpp x_simple c x_examples h x_gmessage cpp x_grecord cpp MMW Ur x_simple c In a text editor open x_simple c Find the GOpen call and update the address to match the desired hard ware See the documentation for GOpen for address formatting options Compile gcc Wall Werror x_simple c lgclib lgclibo o simple Run 5 simple rez 0 version 85 60 131 res W rez 0 info 10 1 3 17 DMC4020 Rev 1 2b 291 Fes 0 response 179340166 0000 x_examples cpp e In a text editor open x_examples cpp Find the GOpen call and update the address to match the desired hardware See the documentation for GOpen for address formatting options Don t forget s ALL if data records interrupts and messages are to be tested e Find the if 0 preprocessor block enclosing the example calls Change to if 1 to run the examples Comment out the function calls to be avoided Note some calls attempt to move motors and not all functions are compatible with all Galil products Compile g x_x cpp lgclib lgclibo o example gclib 280 5 1 C C Run example Library version 85 60 131 10 1 3 17 DMC4020 Rev 1 2b 291
81. g GBufln buffer GSize buffer_len Performs a write on the connection GCLIB_DLL_EXPORTED GReturn GCALL GCommand GCon g GCStringln command GBufOut buffer GSize buffer_len GSize bytes_returned Performs a command and response transaction on the connection 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 GProgramUpload GCon g GBufOut buffer GSize buffer_len Uploads a program from the controller s program buffer GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownload GCon g const GCStringIn array_name Ge Option first GOption last GCStringIn buffer gclib 280 9 2 gclib h File Reference 91 Downloads array data to a pre dimensioned array in the controller s array table 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 e 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 GMessage GCon 0 GCStringOut buffer GSize buffer_len Provides access to unsolicited messages from the controller GCLIB_DLL_EXPORTED GReturn GCALL Ginterrupt GCon g
82. g_torque G axis torque UW axis_g_analog_in G axis analog input UB axis_g_halls G Hall Input Status UB axis_g reserved Reserved SL axis_g variable G User defined variable ZA UW axis_h_status H axis status UB axis_h_switches H axis switches UB axis_h_stop_code H axis stop code SL axis_h_reference_position H axis reference position SL axis_h_motor_position H axis motor position SL axis_h_position_error H axis position error SL axis_h_aux_position H axis auxiliary position gclib 280 80 Data Structure Documentation SL axis_h velocity H axis velocity SL axis_h_torque H axis torque UW axis_h_analog_in H axis analog input UB axis_h_halls H Hall Input Status UB axis_h_reserved Reserved SL axis_h_variable H User defined variable ZA 8 6 1 Detailed Description Data record struct for DMC 4000 controllers including 4000 4200 4103 and 500x0 Definition at line 34 of file gclib_record h The documentation for this struct was generated from the following file gclib_record h 8 7 GDataRecord47000_ENC Struct Reference Data record struct for RIO 471xx and RIO 472xx PLCs Includes encoder fields include lt gclib_record h gt Data Fields UB header_0 1st Byte of Header UB header_1 2nd Byte of Header UB header_2 3rd Byte of Header UB header_3 4th Byte of Header UW sample_number Sample number
83. gclib 280 C API for Galil controllers and PLCs Galil Motion Control Mon Oct 26 2015 Contents 1 Getting Started 2 Rebuilding gclibo 3 Installation eal 011620581118156 63187 so naci eoa AA aE EM ES a be ee ae ee RR 6 Se POPOOSA 2646550684 eta bbb d de beat batadedbu dened ae A E AENA S4 Fedora LINUX cau ae A RA AA A 35 Red Hate CentOS LINUX o e iaeoe rodada a a a ee Saad 4 Legacy Compatibility dal CAOS 120 Bae ee dara Das A a A Ow owe SARS 32 DIEBE cn he a a a Ta e ee Aa G d Ea aie 5 Using gclib A A RN 5 1 1 Microsoft Visual Studio a cou Area beh bE wb eed awe D2 NURSE o Sh ers A ht Weed dh ee ee ae eh ee ee Bee SLS Bornand Gir coo a he eo a aE E G Sl A bd Ba DE he ee REDS SEE BOS SD CONC A ce v4 eee A we ne ee ee ae i DA PADO een wet E oe Bde ele amp ka ea ce Aa ear ge hy ERNE oe th eS lay EO Ge ity alts hs Ra ae RN are ee et 9 531 WEANET 20 4 kisah da EE ERP ER OOS Se ee Rew ESS Save GENET ons bh bbe ee baw ee ee add a o ete hed ba be had 34 200100818 a ee te ee ey Rh eth A PA Bd 6 Data Structure Index 6 1 Data Siructures ads on 7 File Index Gal PUB IEE lt a Go Be he a oS eo Ee a Re ee WA a ee we ss BS 12 14 16 19 23 23 25 27 27 27 29 32 36 38 41 44 44 46 48 51 51 53 iv CONTENTS 8 Data Structure Documentat
84. h rpm and install the rpm This step installs Galil s RPM repositories and only needs to be done once Install Package Install gclib package approve Installed size and Importing GPG key if prompted sudo yum install gclib Uninstall Package To uninstall gelib sudo yum remove gclib Installed files The gclib shared object files usr lib libgclibo so usr lib libgclib so The gclib header files usr include gclib_errors h usr include gclibo h usr include gclib h usr include gclib_record h gclib documentation tarball usr share doc gclib gclib_129_doc tar gz Example source tarball usr share doc gclib src gclib_129_examples tar gz e Source files to modify rebuild libgclibo so usr share doc gclib src gclibo_129_src tar gz GalilTools Communication Library gcl wrapper usr share doc gclib src gclib_129_gcl tar gz PCI driver files usr share doc gclib src gclib_129 pci tar gz gclib 280 18 Installation Serial Ports and USB If access to the serial ports or USB e g DMC 4103 is desired through gclib the following will provide steps to join the correct access group If using USB be sure the controller is powered and the usb is plugged in before beginning Determine group with access 5 ls 1 dev ttyUSBx dev ttySx erw rw 1 root dialout 4 64 Mar 16 39 dev ttyso crw rw 1 root dialout 4 65 Mar 16 39 dev ttysl erw rw
85. has wrappers for most of these utilities gclib 280 9 2 gclib h File Reference 101 Parameters g Connection s handle request Defines the request Input Output and type of memory are implicit in the value of request The following lists the supported request values G_UTIL_TIMEOUT Read initial timeout value as specified in GOpen via timeout switch memoryl is output and must be a pointer to an unsigned short memory2 is ignored use null e G_UTIL_TIMEOUT_OVERRIDE See GTimeout Write Read override timeout value memory is input If nonnull value must be a pointer to a short which overrides the timeout Write G_USE_INITIAL_TIMEOUT to use initial timeout If null no write occurs memory2 is output If nonnul value must be a pointer to a short which will be filled with the current override G_USE_INITIAL TIMEOUT indicates initial timeout used If null no read occurs memory2 is processed before memory1 G_UTIL_VERSION See GVersion Returns the library version A valid connection g is not necessary e g g may be null memory is output and must be a GCSt ringOut Data will be null terminated even if the data must be truncated to do so memory2 is input and must be a pointer to a GSize holding the length of the buffer in memory 1 e G_UTIL_INFO See Glnfo Returns information about the connection mem
86. he Applications alias or another installation location e If an earlier version is required see http www galil com sw pub apple osx 10 10 gclib for a list of builds Create Environment Variable Optional To provide maximum functionality e g usage of the Python wrapper add to the DYLD_LIBRARY_PATH by typing the following at a Terminal prompt echo export DYLD_LIBRARY_PATH Applications gclib dylib SDYLD_LIBRARY_PATH gt gt profile Log Out and back in to set the environment variable Make links for usb devices If using the DMC4103 or another Galil USB product symbolic links may be created so GAddresses can list the controllers Make a link from the Terminal user mac user plug in DMC4103 usb cable user mac user ls dev tty usbx dev tty usbserial A402L6KG user mac user make a symbolic link so gclib can list it user mac user sudo ln s dev tty usbserial A402L6KG dev tty usbserial0 user mac user gclib searches start at 0 user mac user GAddresses will now list this device Demonstrating with Python user mac user python Python 2 7 10 default Jul 14 2015 19 46 27 SCC 4 2 1 Compatible Apple LLVM 6 0 clang 600 0 39 on darwin Type help copyright credits or license for more information gt gt gt import gclib gt gt gt g gclib py gt gt gt g GAddresses dev tty usbserial0 gt gt gt g GOpen dev tty usbserial0 d
87. he controller e g baud 19200 Default baud is 115200 See GOpen Parameters addresses Buffer to hold the output string Buffer will be null terminated even if the data must be truncated to do so addresses_len Length of buffer Returns The success status or error code of the function See gclib_errors h for possible values Definition at line 24 of file gclibo c References G_UTIL_ADDRESSES and GuUtility gclib 280 9 6 gclibo h File Reference 115 9 6 2 2 GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownloadFile GCon GCStringin file_path Array download from file Downloads a csv file containing array data at file_path If the arrays don t exist they will be dimensioned gclib 280 116 File Documentation Parameters g Connection s handle file_path Null terminated string containing the path to the array file Returns The success status or error code of the function See gclib_errors h for possible values See x_arrays cpp for an example Definition at line 251 of file arrays c References G_BAD_FILE G_NO_ERROR H_ArrayAddElement H_CreateArrayNode H_DownloadArrays FromList H_FreeArrays and H_InitArrayNode 9 6 2 3 GCLIB_DLL_EXPORTED GReturn GCALL GaArrayUploadFile GCon GCStringin file_path GCStringIn names Array upload to file Uploads the entire controller array table or a subset and saves the data as a csv
88. ibo c References G_UTIL_TIMEOUT_OVERRIDE and GuUtility 9 5 2 16 GReturn GCALL GVersion GCStringOut ver GSize ver_len Uses GuUtility and G_UTIL_VERSION to provide the library version number Parameters ver Buffer to hold the output string Buffer will be null terminated even if the data must be truncated to do so gclib 280 9 6 gclibo h File Reference 113 ver_len Length of buffer Returns The success status or error code of the function See gclib_errors h for possible values See x_examples cpp for an example Definition at line 14 of file gclibo c References G_UTIL_VERSION and GuUtility 9 6 gcelibo h File Reference include gclib h include lt stdlib h gt include lt string h gt include lt stdio h gt include lt math h gt Macros define GCLIB_DLL_EXPORTED define _CRT_SECURE_NO_WARNINGS define GCALL _ stdcall define MALLOCBUF G_HUGE_BUFFER define MAXPROG MALLOCBUF define MAXARRAY MALLOCBUF define POLLINGINTERVAL 100 Functions GCLIB_DLL_EXPORTED void GCALL GSleep unsigned int timeout_ms Uses GuUtility and G_UTIL_SLEEP to provide a blocking sleep call which can be useful for timing based chores GCLIB_DLL_EXPORTED GReturn GCALL GVersion GCStringOut ver GSize ver_len Uses GuUtility and G_UTIL_VERSION to provide the library version number GCLIB_DLL_EXPORTED GReturn GCALL GAddresses GCStringOut addresses GS
89. igure itself e In the Solution Explorer right click on Solution gclib_example 1 project and choose Configuration Man ager In the gclib_example project row click in the Platform column and choose lt New gt Choose x86 from Type or select the new platform Choose Any CPU from Copy settings from Check Create new solutions platform Click OK If x64 support is also desired repeat the lt New gt procedure for x64 In the Active solution platform combobox at the top of the Configuration Manager dialog choose lt Edit gt Select Any CPU and click the Remove button Click Close Close the Configuration Manager dialog Inthe Solution Explorer right click on gclib_example and choose Add gt Existing Item Navigate to the installation location C Program Files x86 Galil gclib source wrappers vb Choose gclib vb e In the Solution Explorer double click on gclib vb Note that there is a preprocessor definition starting with if PLATFORM x86 Then and tte ElseIf PLATFORM x64 Then Note that these sections of code enable disable with the choice of the Solution Platform x86 x64 usually found in the Visual Studio toolbar If anon default gclib installation location is used the paths in these sections of code must be updated to reflect the dll locations Add some simple code In the Solution Explorer right click on Form1 vb and choose View Code Replace the text in Form 1 vb wi
90. ine 29 of file gclibo c References G_UTIL_TIMEOUT_OVERRIDE and GuUtility 9 6 2 18 GCLIB_DLL_EXPORTED GReturn GCALL GVersion GCStringOut ver GSize ver_len Uses GuUtility and G_UTIL_VERSION to provide the library version number Parameters ver Buffer to hold the output string Buffer will be null terminated even if the data must be truncated to do so ver_len Length of buffer Returns The success status or error code of the function See gclib_errors h for possible values See x_examples cpp for an example Definition at line 14 of file gclibo c References G_UTIL_VERSION and GuUtility gclib 280
91. ing to pre existing code In addition to the point and click configuration of the tools each tool has a set of public function calls and properties which allows the C or VB Net user the ability to integrate the Galil Widgets into a Net application with ease The power user The entire Galil Widgets source code is available in the installation package This allows users to tweak extend and add Widgets to the library with ease The GalilWidget interface defines a number of function calls that new Widgets should implement to function correctly The following widgets are currently available GWComs Communications to Galil hardware including event driven handling of asynchronous traffic GWTerm A terminal for direct user interaction with the hardware GWPo11 A polling tool to display important data on screen GWSettings A tool for displaying editing backing up and restoring controller parameters and mission critical variables Program backup and loading and firmware upgrades are also supported GWDatRec A data record visualization tool Used to display controller status through user configurable labels soft LEDs and analog sliders For more information get the free Galil Widgets package See the Galil Widgets release notes for changes Screen shots of an example motion controller configuration left and a similar RIO configuration right gclib 280 50 Using gclib gclib 280 Chapter 6
92. ion 55 8 1 GDataRecord Union Reference nn 55 38 1 Detailed Descriplhon lt a pa t ace eb Re a a nr AA 55 8 2 GDataRecord1802 Struct Reference o ee 56 gal Detaled DeScrplDIT lt s ro a icum A A A A ran RA G 60 8 3 GDataRecord1806 Struct Reference o ee 60 831 Detailed Description lt 2 wu bb be ae u nn he a ee 67 8 4 GDataRecord2103 Struct Reference ooo 67 64 1 Detailed 06581611619 lt a Bea e p o a Br ner 72 8 5 GDataRecord30000 Struct Reference o 0 eee ee 72 25 1 Detailed Description gt o 4 6 ke se wp ea a a ad 73 8 6 GDataRecord4000 Struct Reference ooo 73 86 1 Detailed Descriptio o c saoe 82 eee ee Re ER A ee 80 8 7 GDataRecord47000 ENC Struct Reference ee 80 81 Detailed Desecration 28 4 09 Bee See a EN ee eek ee Baa Eo 81 8 8 GDataRecord47300_24EX Struct Reference 2 En nm nn 82 98 1 Detailed Deschphom 2 2b aie ka a eee eh 83 8 9 GDataRecord47300 ENC Struct Reference o 83 291 Detailed Description 2 2 ea Gb ek Sw ed a Ra ae a a ae 85 8 10 H_ArrayData Struct Reference 2 02 ee 85 810 1 Detailed Description oror ms a A be 85 9 File Documentation 87 91 Aftays c FileRelefames gt fae aoe Mev a AA a e ee ee E 87 91 1 Detailed Description lt
93. is includes when a program closes A rule of thumb is that for every GOpen call on a given connection a GClose call should be found on every code path Failing to call GClose may cause controller resources to not be released or can hang the process if there are outstanding asynchronous operations The latter can occur for example if a call to GRead times out and the process exits without calling GClose In this case GRead still has an outstanding asynchronous read pending GClose will terminate this operation allowing the process to exit correctly Parameters g Connection s handle Returns The success status or error code of the function See gclib_errors h for possible values See x_examples cpp for an example 9 2 2 4 GCLIB_DLL_EXPORTED GReturn GCALL GCommand GCon g GCStringIn command GBufOut buffer GSize buffer_len GSize x bytes_returned Performs a command and response transaction on the connection Parameters g Connection s handle command Null terminated command string to send to the controller The library will append a carriage return to the command string gclib 280 9 2 gclib h File Reference 93 buffer Buffer for the response Will be filled with the response from the controller The data will be null terminated unless function returns G_BAD_LOST_DATA due to the buffer being too small to hold the data buffer_len The size of the response buffer
94. is_e variable E User defined variable ZA UW axis _f status F axis status UB axis_f switches F axis switches UB axis_f_stop_code F axis stop code SL axis_f_reference_position F axis reference position SL axis_f_motor_position F axis motor position SL axis_f_position_error F axis position error SL axis_f_aux_position F axis auxiliary position SL axis_f velocity F axis velocity SL axis_f_ torque F axis torque UW axis_f_analog_in F axis analog input UB axis _f_reserved_0 Reserved UB axis _f_reserved_1 Reserved SL axis_f variable F User defined variable ZA UW axis_g_ status G axis status UB axis_g_switches G axis switches UB axis_g_stop_code G axis stop code SL axis_g_reference_position G axis reference position gclib 280 66 Data Structure Documentation SL axis_g_motor_position G axis motor position SL axis_g_position_error G axis position error SL axis_g_aux_position G axis auxiliary position SL axis_g_ velocity G axis velocity SL axis_g_torque G axis torque UW axis_g_analog_in G axis analog input UB axis_g reserved_0 Reserved UB axis_g reserved_1 Reserved SL axis_g_variable G User defined variable ZA UW axis_h_status H axis status UB axis_h_switches H axis switches UB axis_h_stop_code H axis stop code SL axis_h_reference_position H axis reference position SL axis_h_motor_position H axis motor positi
95. ize addresses_len Uses GuUtility and G_UTIL_ADDRESSES to provide a listing of all available connection addresses GCLIB_DLL_EXPORTED GReturn GCALL Glnfo GCon g GCStringOut info GSize info_len Uses GuUtility and G_UTIL_ INFO to provide a useful connection string GCLIB_DLL_EXPORTED GReturn GCALL GTimeout GCon g short timeout_ms Uses GuUtility and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout GCLIB_DLL_EXPORTED GReturn GCALL GCmd GCon g GCStringln command Wrapper around GCommand for use when the return value is not desired GCLIB_DLL_EXPORTED GReturn GCALL GCmdT GCon g GCStringln command GCStringOut trimmed _response GSize response_len GCStringOut front Wrapper around GCommand that trims the response GCLIB_DLL_EXPORTED GReturn GCALL GCmdl GCon g GCStringln command int value Wrapper around GCommand that provides the return value of a command parsed into an int GCLIB_DLL_EXPORTED GReturn GCALL GCmdD GCon g GCStringIn command double x value Wrapper around GCommand that provides the return value of a command parsed into a double gclib 280 114 File Documentation 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 GRecordRate GCon g double period_ms Sets the asynchronous data record to a user specified period via DR e GCLIB_DLL_EXPORTED GReturn GCALL
96. k 3 outputs 25 32 UB output_bank_4 general output bank 4 outputs 33 40 UB output_bank_5 general output bank 5 outputs 41 48 UB output_bank_6 general output bank 6 outputs 49 56 UB output_bank_7 general output bank 7 outputs 57 64 UB output_bank_8 general output bank 8 outputs 65 72 UB output_bank_9 gclib 280 8 6 GDataRecord4000 Struct Reference 75 general output bank 9 outputs 73 80 SWreserved_0 Reserved SWreserved_2 Reserved SWreserved_4 Reserved SWreserved_6 Reserved SWreserved_8 Reserved SWreserved_10 Reserved SWreserved_12 Reserved SW reserved_14 Reserved UB ethernet_status_a Ethernet Handle A Status UB ethernet_status_b Ethernet Handle B Status UB ethernet_status_c Ethernet Handle C Status UB ethernet_status_d Ethernet Handle D Status UB ethernet_status_e Ethernet Handle E Status UB ethernet_status_f Ethernet Handle F Status UB ethernet_status_g Ethernet Handle G Status UB ethernet_status_h Ethernet Handle H Status UB error_code error code UB thread_status thread status UL amplifier_status Amplifier Status UL contour_segment_count Segment Count for Contour Mode UW contour_buffer_available Buffer space remaining Contour Mode UWs plane_segment_count segment count of coordinated move for S plane UWs plane_move_status coordinated move status for S plane e SLs distance
97. kkkkkxkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkxkxkkkkkkkkkkkkkxkxkkkkkkkkkxk Example GProgramDownload and GProgramUpload usage kkkxkxkxkkkkkkxkkkkkkkkkxkkkkxkkkkkkkkkkkkkkkkkkkkkkkxkxkkkkkkkkkkkkkxkxkxkkkkkkkkxk GProgramDownload correctly errored Can t fit with level 3 compression gclib 280 5 1 C C 35 Program Downloaded with compression level 4 Uploading program FA i 0 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 EN Program executed as expected kkkkxkxkxkxkxkxkxkxkxkxkxkxkkkxkkxkxkxkxkxkxkxkkxkkkkxkkxkxkxkkxkxkxkkkxkkkxkkkkxkkkxkxkkkxkxkxkxkxkkkxkkkxkkkkx Example GArrayDownload and GArrayUpload usage kkkkxkkxkxkxkxkxkxkxkxkxkkkkxkkxkxkxkxkxkxkxkkxkxkkkkkxkxkxkkxkxkxkkkkkxkxkxkkkxkkkxkxkkkxkkkxkkkxkxkxkkxkkkxkx 2 0000 4 0000 6 0000 8 0000 10 0000 12 0000 14 0000 16 0000 18 000 0000 2 0000 1 0000 3 0000 5 0000 10 0000 12 0000 14 0000 16 0000 18 000 0000 3 0000 5 0000 10 0000 kkkkxkxkxkxkxkxkxkxkxkxkxkxkkxkxkkxkxkxkxkxkxkxkkxkxkkkxkxkxkxkxkxkxkxkkkkkkkxkkxkkxkkkxkkkkkkxkxkxkxkkxkxkkxkkkxkx Example GRecord usage kkkkxkxkxkxkxkxkxkxkxkkxkxkkkxkkxkxkxkxkxkxkxkkxkxkkkxkkxkxkxkxkxkxkxkkkkkkxkxkkkxkkkxkkkkxkkxkxkkkkxkxkkxkkkkx OR based data record 38564 393216000 DR based data record 38670 38772 38874 38976 39078 39180 39282 39384 39486 39588 39690 OR based data record with offsets 39692 39692 OS Example
98. kxkxkxkkkkkkkxkkxkkxkkkxkxkkkxkkxkxkxkkkxkkkkkkkxx k Example GProgramDownload and GProgramUpload usage kkkkxkxkxkxkxkxk xkxkxkxkxkxkkxkkkxkxkxkxkxkxkxkkxkxkkkkkxkxkxkkxkxkkkkkkxkxkxkkkxkkkxkxkkkkkkkkkkxkxkkxkkkkx GProgramDownload correctly errored Can t fit with level 3 compression Program Downloaded with compression level 4 Uploading program A i 0 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 i i 1 EN Program executed as expected kkkkxkkxkxkxkxkxkxkxkxkxkxkkxkkxkxkxkxkkxkxkxkkxkxkkkkkxkxkxkkxkxkxkkkkkkxkxkkkxkkkxkxkkkkkkxkkkxkxkxkkxkkkkx Example GArrayDownload GArrayUploadFile GArrayDownloadFile and GArrayUpload usage kkkkxkxkxkxkxkxkxkxkxkxkxkxkkkxkkxkxkxkxkxkxkxkkxkkkkkkxkkxkkxkkxkkkkkxkxkxkkxkxkkkxkxkkkxkkxkkkkkxkxkkxkkkkx 2 0000 4 0000 6 0000 8 0000 10 0000 12 0000 14 0000 16 0000 18 0000 2 0000 1 0000 3 0000 5 0000 10 0000 12 0000 14 0000 16 0000 18 0000 w 0000 5 0000 10 0000 2 0000 1 0000 3 0000 5 0000 10 0000 12 0000 14 0000 16 0000 18 0000 kkkkxkxkxkxkxkxkxkxkxkxkxkxkkxkxkkxkxkxkxkxkxkxkxkxkxkkkxkxkxkxkxkkxkxkxkkkkkkxkkkxkxkkkkkkkkkkxkxkkkxkkkxkkkkxx Example GRecord usage kkkkxkxkxkxkxkxkxkxkxkxkxkxkkkxkkxkxkxkkxkxkxkkxkxkkkkkxkxkxkxkxkxkxkkkkkkxkxkkkxkkkxkxkkkkkkxkkkkxkkkxkkkkx OR based data record 36100 6000 DR based data record 36204 20 0000 20 0000 20 0000 gclib 280 38
99. l terminated program for download preprocessor Options string for preprocessing the program before sending it to the controller Null allows the library to use defaults for the download Maximum compression only if needed to fit the program Code downloads at start of buffer Compression options max n provides preprocessing up to and including level n Only the necessary preprocessing will be performed up to level n as listed below Level 0 mandatory 1 Remove lines starting with REM Error on Y in buffer Comment blank lines with Remove white space space tab in front of label declarations Remove white space after commands Remove trailing semicolons Line ends changed to carriage return YON Replace leading tabs with double space 9 Replace non leading tabs with single space Level 1 1 Remove unnecessary spaces Strings comments and no ops NO are not changed Level 2 1 Remove comments but not no ops NO Level 3 1 Remove no ops NO too Level 4 1 Break apart compound lines that are too long 2 Compact lines of code to maximize line usage 3 Use backtick to support long lines where applicable min n will preprocess at least up to and including n n defined as with max above Code insertion insert arg invokes the insert option of the firmware s DL command arg can be one of the following Line number
100. lation Browse in the Finder to Applications gclib doc Double click the tar gz file to extact it e Open the resultant directory e Open the html directory Double click index html to open the help 3 3 Ubuntu Linux Tested versions See the installation page for supported versions Installation Create a temporary variable for Ubuntu version uver lsb_release r cut f 2 echo Suver 14 04 Install Galil s public certificate wget http www galil com sw pub ubuntu uver GALIL PUB KEY sudo apt key add GALIL PUB KEY Get Galil s apt sources list Ssudo wget http www galil com sw pub ubuntu uver galil list O etc apt sources list d galil list sudo apt get update Install Package Ssudo apt get install gclib Uninstall Package To uninstall gelib Ssudo apt get remove gclib Installed files The gclib shared object files usr lib libgclibo so usr lib libgclib so The gclib header files gclib 280 3 3 Ubuntu Linux 15 usr include gclib_errors h usr include gclibo h usr include gclib h usr include gclib_record h gclib documentation tarball usr share doc gclib gclib_129_doc tar gz Example source tarball usr share doc gclib src gclib_129_examples tar gz e Source files to modify rebuild libgclibo so usr share doc gclib src gclibo_129_src tar gz GalilTools Communication Library gcl wrapper usr share doc gclib src gclib_129_gcl
101. le gclibo c References G_NO_ERROR G_SMALL_BUFFER GCommand and GSleep 9 5 2 11 GReturn GCALL GProgramDownloadFile GCon g GCStringin file_path GCStringIn preprocessor Program download from file Parameters g Connection s handle file_path Null terminated string containing the path to the program file preprocessor Options string for preprocessing the program before sending it to the controller See Ge ProgramDownload Returns The success status or error code of the function See gclib_errors h for possible values See x_programs cpp for an example Definition at line 179 of file gclibo c References G_BAD_FILE G_BAD_FULL_MEMORY G_NO_ERROR and GProgramDownload 9 5 2 12 GReturn GCALL GProgramUploadFile GCon GCStringin file_path Program upload to file Parameters g Connection s handle file_path Null terminated string containing the path to the program file file will be overwritten if it exists Returns The success status or error code of the function See gclib_errors h for possible values See x_programs cpp for an example Definition at line 222 of file gclibo c References G_BAD_FILE G_BAD_FULL_MEMORY G_NO_ERROR and GProgramUploaa 9 5 2 13 GReturn GCALL GRecordRate GCon g double period_ms Sets the asynchronous data record to a user specified period via DR Takes TM and product type into account and sets the D
102. libo c References G_NO_ERROR G_SMALL_BUFFER and GCommand Referenced by GRecordRate 9 6 2 7 GCLIB_DLL_EXPORTED GReturn GCALL GCmdl GCon g GCStringln command int x value Wrapper around GCommand that provides the return value of a command parsed into an int Use this function to get most values including TP RP TE Digital I O states etc gclib 280 118 File Documentation Parameters g Connection s handle command Null terminated command string to send to the controller value Pointer to an int that will be filled with the return value Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Definition at line 86 of file gclibo c References G_NO_ERROR G_SMALL_BUFFER and GCommand 9 6 2 8 GCLIB_DLL_EXPORTED GReturn GCALL GCmdT GCon g GCStringln command GCStringOut trimmed_response GSize response_len GCStringOut x front Wrapper around GCommand that trims the response For use when the return value is desired is ASCII not binary and the response should be trimmed of trailing colon whitespace and optionally leading space Parameters g Connection s handle command Null terminated command string to send to the controller trimmed_ The trimmed response from the controller Trailing space is trimmed by null terminating any response trailing spaces carriage r
103. ls Please contact softwaresupport galil com if the platform required is not listed Contents e List of all functions Installation and supported operating systems Using gclib e Rebuilding gclibo Legacy Compatibility Release Notes See the update history of gclib in the release notes Galil maintains an RSS page to notify users of updates Technical Support For help please email softwaresupport galil com or call Galil Applications Getting Started gclib 280 Chapter 2 Rebuilding gclibo gclib ships with a compiled version of the open source portion gclibo However if a source modification is desired the following instructions will help with recompiling this portion of the library Windows For brevity these instructions assume the default installation location of C Program Files x86 Galil gclib and a build type of x86 win32 The following instructions were performed on Visual Studio Professional 2013 and can be extended to other Visual Studio versions Open VS2013 x86 Native Tools Command Prompt Copy files Navigate to a convenient empty writable location e g C temp Set an environment variable for the base path C temp gt set base C Program Files x86 Galil gclib Copy the source files Note the quotes C temp gt copy Sbase source gclibo c Modify source Make any necessary changes For this example the Glnfo function was changed from GReturn GCALL GInfo GCon g
104. n The documentation is left as a tarball to minimize disk usage The latest release version of the user manual is available at the following link http www galil com sw pub all doc gclib html gclib 280 22 Installation Offline html The following allows viewing of the html docs from the installation 5 tar xzf usr share doc gclib gclib_132_doc tar gz html firefox html index html Offline pdf There may be a pdf shipped in the package The following allows viewing of the paf docs from the installation tar xzf usr share doc gclib gclib_132_doc tar gz gclib_132 pdf evince gclib_132 pdf gclib 280 Chapter 4 Legacy Compatibility GalilTools DMC32 OSU 4 1 GalilTools To provide maximum compatibility gclib ships with an open source wrapper implementation of the GCL GalilTools Communication Library Users wanting to upgrade to gclib that have source built on Galil h can use this wrapper to minimize source changes This wrapper is also indicated for users that want the same function calls as Galil h but don t want the usage of OT as in galil1 dll This wrapper is intended for existing applications already using the library distributed with GalilTools galil1 dll or the previous STL library galil2 dll New applications should be written with gclib Windows Compile galil2 dll with MSVC 2013 The following instructions were performed on Visual Studio Professional 2013 and can be extended to other
105. n error SL axis_e_aux_position E axis auxiliary position e SL axis_e velocity E axis velocity SWaxis_e torque E axis torque UW axis_f status F axis status UB axis_f switches F axis switches UB axis_f _stop_code F axis stop code SLaxis_f reference position F axis reference position SL axis_f motor_position F axis motor position SL axis_f position_error F axis position error e SL axis_f aux_position F axis auxiliary position SL axis_f velocity F axis velocity SWaxis_f torque F axis torque UW axis_g_status G axis status UB axis_g_switches G axis switches UB axis_g_stop_code G axis stop code SL axis_g reference _position G axis reference position SL axis_g_motor_position G axis motor position SL axis_g position_error G axis position error SL axis_g_aux_position gclib 280 60 Data Structure Documentation 8 2 1 G axis auxiliary position SL axis_g_ velocity G axis velocity SW axis_g_torque G axis torque UW axis_h_status H axis status UB axis_h_switches H axis switches UB axis_h_stop_code H axis stop code SL axis_h_reference_position H axis reference position SL axis_h_motor_position H axis motor position SL axis_h_position_error H axis position error SL axis_h_aux_position H axis auxiliary position SL axis_h_velocity H axis velocity SW axis_h_torque H axis torque Detailed Description Data record struct
106. nput bank 4 inputs 33 40 UB input_bank_5 general input bank 5 inputs 41 48 UB input_bank_6 general input bank 6 inputs 49 56 UB input_bank_7 general input bank 7 inputs 57 64 gclib 280 68 Data Structure Documentation UB input_bank_8 general input bank 8 inputs 65 72 UB input_bank_9 general input bank 9 inputs 73 80 UB output_bank_0 general output bank O outputs 1 8 UB output_bank_1 general output bank 1 outputs 9 16 UB output_bank_2 general output bank 2 outputs 17 24 UB output_bank_3 general output bank 3 outputs 25 32 UB output_bank_4 general output bank 4 outputs 33 40 UB output_bank_5 general output bank 5 outputs 41 48 UB output_bank_6 general output bank 6 outputs 49 56 UB output_bank_7 general output bank 7 outputs 57 64 UB output_bank_8 general output bank 8 outputs 65 72 UB output_bank_9 general output bank 9 outputs 73 80 UB error_code error code UB general_status general status UW s_plane_segment_count segment count of coordinated move for S plane UW s_plane_move_ status coordinated move status for S plane SL s_distance distance traveled in coordinated move for S plane UW t_plane_segment_count segment count of coordinated move for T plane UW t_plane_move_status Coordinated move status for T plane SL t_distance distance traveled in coordinated move for T plane UW axis_a_status A axis status UB axis_a_switches
107. ntation UB axis_d_ switches D axis switches UB axis_d_stop_code D axis stop code SL axis_d_reference_position D axis reference position SL axis_d_motor_position D axis motor position SL axis_d_position_error D axis position error SL axis_d_aux_position D axis auxiliary position SL axis_d_velocity D axis velocity SW axis_d_torque D axis torque UW axis_d_analog_in D axis analog input UW axis_e status E axis status UB axis_e_switches E axis switches UB axis_e_stop_code E axis stop code SL axis_e_reference_position E axis reference position SL axis_e_motor_position E axis motor position SL axis_e_position_error E axis position error SL axis_e_aux_position E axis auxiliary position SL axis_e_velocity E axis velocity SW axis_e torque E axis torque UW axis_e_analog_in E axis analog input UW axis_f_ status F axis status UB axis_f_switches F axis switches UB axis_f_stop_code F axis stop code SL axis_f reference position F axis reference position SL axis_f_motor_position F axis motor position SL axis_f position_error F axis position error SL axis_f_aux_position gclib 280 8 4 GDataRecord2103 Struct Reference 71 F axis auxiliary position SL axis_f velocity F axis velocity SWaxis_f torque F axis torque UW axis_f_analog_in F axis analog input UW axis_g_status G axis status UB axis_g_switches G axis switches UB axis_g_stop_code G axis stop code SL
108. ogramDownloadFile GCon g GCStringin file_path GCStringln preprocessor Program download from file Parameters g Connection s handle file_path Null terminated string containing the path to the program file preprocessor Options string for preprocessing the program before sending it to the controller See Ge ProgramDownload Returns The success status or error code of the function See gclib_errors h for possible values See x_programs cpp for an example Definition at line 179 of file gclibo c References G_BAD_FILE G_BAD_FULL_MEMORY G_NO_ERROR and GProgramDownload 9 6 2 14 GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile GCon g GCSiringIn file_path Program upload to file gclib 280 9 6 gclibo h File Reference 121 Parameters g Connection s handle file_path Null terminated string containing the path to the program file file will be overwritten if it exists Returns The success status or error code of the function See gclib_errors h for possible values See x_programs cpp for an example Definition at line 222 of file gclibo c References G_BAD_FILE G_BAD_FULL_MEMORY G_NO_ERROR and GProgramUploaa 9 6 2 15 GCLIB_DLL_EXPORTED GReturn GCALL GRecordRate GCon g double period_ms Sets the asynchronous data record to a user specified period via DR Takes TM and product type into account and sets the DR period to the period r
109. oller that are not in response to a command a data record or an interrupt Examples follow 1 Data generated by the MG command from embedded code MG sent from the host is solicited 2 Any command in an embedded program that returns data e g TP RP var 3 A run time error in an embedded program e g 255 i var Note Messages are unframed byte streams There is no guarantee that the user will get complete messages or single messages in a call to GMessage Parameters g Connection s handle buffer The buffer to write the message data The buffer will be null terminated buffer_len The length of the user s buffer Returns The success status or error code of the function See gclib_errors h for possible values GMessage will block until a message is received or the function times out Note If this function is called with a timeout of zero a non blocking read is performed If message data has been processed since the last time the function was called this data will be returned If there is no processed message data but there is data waiting in the socket or PCI FIFO one read will be performed to process the waiting data If new data is still not found after these two attempts G_GCLIB_NON_BLOCKING_READ_E MPTY will be returned See x_gmessage cpp for an example See x_nonblocking cpp for an example of non blocking usage 9 2 2 8 GCLIB_DLL_EXPORTED GReturn GCALL GOpen GCStringin addres
110. on SL axis_h_position_error H axis position error SL axis_h_aux_position H axis auxiliary position SL axis_h_velocity H axis velocity SL axis_h_torque H axis torque UW axis_h_analog_in H axis analog input UB axis_h_reserved_0 Reserved UB axis_h reserved_1 Reserved SL axis_h_variable H User defined variable ZA gclib 280 8 4 GDataRecord2103 Struct Reference 67 8 3 1 Detailed Description Data record struct for DMC 1806 controller The 18x6 Data record is the same as 4000 except the following 1 No header bytes Firmware strips itin DR Software removes it from QR 2 No Ethernet status bytes 42 49 No amplfifier status bytes 52 55 gt w No axis specific hall input status Definition at line 224 of file gclib_record h The documentation for this struct was generated from the following file gclib_record h 8 4 GDataRecord2103 Struct Reference Data record struct for DMC 2103 controllers include lt gclib_record h gt Data Fields UB header_0 1st Byte of Header UB header_1 2nd Byte of Header UB header_2 3rd Byte of Header UB header_3 4th Byte of Header UW sample_number sample number UB input_bank_0 general input bank 0 inputs 1 8 UB input_bank_1 general input bank 1 inputs 9 16 UB input_bank_2 general input bank 2 inputs 17 24 UB input_bank_3 general input bank 3 inputs 25 32 UB input_bank_4 general i
111. oryl is output and must be aGCStringOut Data will be null terminated even if the data must be truncated to do so memory2 is input and must be a pointer to a GSize holding the length of the buffer in memory 1 G_UTIL_SLEEP See GSleep Platform independent sleep A valid connection g is not necessary i e g may be null memoryl is input and must be a pointer to an unsigned int units are millisec onds memory2 is ignored use null G_UTIL_ADDRESSES Provides a n delimited listing of all available IP addresses PCI addresses and COM ports A valid connection g is not necessary i e g may be null memoryl is output and must be aGCStringOut Data will be null terminated even if the data must be truncated to do so memory2 is input and must be a pointer to a GSize holding the length of the buffer in memory 1 G_UTIL_IPREQUEST Listens and returns a n delimited listing of Galil MAC ad dresses sending BOOT P or DHCP requests The function will listen and block for roughly 5 seconds A valid connection g is not necessary i e g may be null memory 1 is output and must be a GCSt ringOut Data will be null terminated even if the data must be truncated to do so memory2 is input and must be a pointer to a GSize holding the length of the buffer inmemoryl e G_UTIL_ASSIGN Provides a method to assign an IP address given a Galil MAC bclib 280 address and optionally a host NIC IP address A valid connection g is
112. oup for access to PCI sudo groupadd f K GID_MIN 100 K GID_MAX 499 galil sudo cp 90 galilpci rules etc udev rules d sudo udevadm control reload rules sudo udevadm trigger sudo usermod a G galil username exchange username with actual user s name UN 117 MY Logout and back in The PCI hardware is now available for access 5 ls 1 dev galilx erw rw 1 root galil 10 56 Jun 9 1 07 0 echo e x12 x16 r gt dev galilpci0 cat 0 DMC1846 Rev 1l la Documentation The documentation is left as a tarball to minimize disk usage The latest release version of the user manual is available at the following link http ww galil com sw pub al1 doc gclib html Offline html The following allows viewing of the html docs from the installation tar xzf usr share doc gclib gclib_132_doc tar gz html 5 firefox html index html Offline pdf There may be a pdf shipped in the package The following allows viewing of the pdf docs from the installation tar xzf usr share doc gclib gclib_132_doc tar gz gclib_132 pdf evince gclib_132 pdf 3 4 Fedora Linux Tested versions See the installation page for supported versions gclib 280 3 4 Fedora Linux 17 Installation On Fedora gclib is distributed in an RPM repository The following steps can be performed to install gclib Download Galil s repository information e Point a browser at http www galil com sw pub fedora galilrpm 1 1 noarc
113. p code SL axis_e_reference_position E axis reference position SL axis_e_motor_position E axis motor position SL axis_e_position_error E axis position error SL axis_e_aux_position E axis auxiliary position SL axis_e_ velocity E axis velocity SL axis_e_torque E axis torque UW axis_e_analog_in E axis analog input UB axis_e_halls E Hall Input Status UB axis_e reserved Reserved SL axis_e_ variable E User defined variable ZA UW axis _f status F axis status UB axis_f switches F axis switches UB axis_f_stop_code F axis stop code SL axis_f reference_position F axis reference position SL axis_f_motor_position F axis motor position SL axis_f position_error F axis position error SL axis_f aux_position F axis auxiliary position SL axis_f_ velocity gclib 280 8 6 GDataRecord4000 Struct Reference 79 F axis velocity SL axis_f torque F axis torque UW axis_f_analog_in F axis analog input UB axis_f_halls F Hall Input Status UB axis_f reserved Reserved SL axis_f variable F User defined variable ZA UW axis_g_status G axis status UB axis_g_switches G axis switches UB axis_g_stop_code G axis stop code SL axis_g reference_position G axis reference position SL axis_g_motor_position G axis motor position SL axis_g_position_error G axis position error SL axis_g_aux_position G axis auxiliary position SL axis_g_velocity G axis velocity SL axis_
114. r see PC 8 SLzc variable ZC User defined variable see ZC SL zd variable ZD User defined variable see ZD UW output_bank_2 Digital outputs 24 39 Data only valid for parts with 24EXOUT UW output_back_3 Digital outputs 40 47 Data only valid for parts with 24EXOUT UW input_bank_2 Digital inputs 24 39 Data only valid for parts with 24EXIN UW input_bank_3 Digital inputs 40 47 Data only valid for parts with 24EXIN 8 8 1 Detailed Description Data record struct for RIO 47300 with 24EX I O daughter board Definition at line 813 of file gclib_record h The documentation for this struct was generated from the following file gclib_record h 8 9 GDataRecord47300_ENC Struct Reference Data record struct for RIO 47300 Includes encoder fields include lt gclib_record h gt Data Fields UB header_0 1st Byte of Header UB header_1 2nd Byte of Header UB header_2 3rd Byte of Header UB header_3 gclib 280 84 Data Structure Documentation 4th Byte of Header UW sample_number Sample number UB error_code Error code UB general_status General status UW output_analog_0 Analog output 0 UW output_analog_1 Analog output 1 UW output_analog_2 Analog output 2 UW output_analog_3 Analog output 3 UW output_analog_4 Analog output 4 UW output_analog_5 Analog output 5 UW output_analog_6 Analog output 6 UW output_analog_7 Analog output 7 UW input_analog
115. rtial class Forml Form gclib gclib new gclib public Forml InitializeComponent this Text gclib simple example TextBox tb new TextBox tb Multiline true tb Dock DockStyle Fill tb Parent this try calls to gclib should be in a try catch tb AppendText GVersion gclib GVersion n gclib GOpen 192 168 0 42 d Set an appropriate IP address here tb AppendText GInfo gclib GInfo n tb AppendText GCommand gclib GCommand MG TIME n catch Exception ex tb AppendText ERROR ex Message finally gclib GClose Don t forget to close Hit F5 to run the project 5 4 Galil Widgets Note gclib provides the communications foundation for the Galil Widgets project Galil Widgets are a collection of Net WinForms User Controls that provide quick development of custom graphical user interfaces GUIs that communicate with Galil Motion Controllers and PLCs Galil Widgets has been designed to support three general user needs gclib 280 5 4 Galil Widgets 49 The software novice or the hurried prototyper Within minutes a full Ul can be laid out All controls can be configured with menus and mouse clicks for an absolute minimum requirement for writing code The quick start guide and Microsoft Visual Studio Express is all that is needed to make a free application GUI with minimal effort The Net developer add
116. s GCon g Open a connection to a Galil Controller gclib 280 9 2 gclib h File Reference 95 Parameters address Null terminated address string See table below g Pointer to user s GCon variable On success the library will fill the user s variable with the handle to use for the rest of the connection A valid g value is nonzero Returns The success status or error code of the function See gclib_errors h for possible values address switch Meaning Arguments Examples default other options address Simple address to IP address PCI COM address 1 hardware port a shorthand for See Address Ranges a GALILPCI1 address below no switch address is implicit 192 168 0 42 for any lone token baud Baud rate 115200 valid baud COM2 baud 19200 b shorthand for baud COM3 b 38400 command Command and TCP UDP 192 168 0 42 response socket command TCP protocol C shorthand for 192 168 0 42 c command UDP direct Connect directly a GALILPCI2 REQUIRED for this direct version of gclib d shorthand for GALILPCI2 d direct handshake Serial Handshake mode HARDWARE NONE COM1 handshake NONE pl Primary port for 23 valid port number 192 168 0 42 command and pl 5000 response traffic p2 Secondary port for 60007 valid port 192 168 0 42 unsolicited traffic number p2 5000
117. s 1 8 UB input_bank_1 general input bank 1 inputs 9 16 UB output_bank_0 general output bank 0 outputs 1 8 UB output_bank_1 general output bank 1 outputs 9 16 UB error_code error code UB thread_status thread status UW input_analog_2 Analog input 2 1 is in axis data see axis_a_analog_in UW output_analog_1 Analog output 1 UW output_analog_2 Analog output 2 UL amplifier_status Amplifier Status UL contour_segment_count Segment Count for Contour Mode UW contour_buffer_available Buffer space remaining Contour Mode gclib 280 8 6 GDataRecord4000 Struct Reference 73 UWs plane_segment_count segment count of coordinated move for S plane UWs plane_move_status coordinated move status for S plane SLs distance distance traveled in coordinated move for S plane UWs plane_buffer_available Buffer space remaining S Plane UW axis_a_status A axis status UB axis_a_switches A axis switches UB axis_a_stop_code A axis stop code SL axis_a_reference_position A axis reference position SL axis_a_motor_position A axis motor position SL axis_a_position_error A axis position error SL axis_a_aux_position A axis auxiliary position SL axis_a_velocity A axis velocity SL axis_a_torque A axis torque UW axis_a_analog_in A axis analog input UB axis_a_halls A Hall Input Status UB axis_a_reserved Res
118. s needing IP addresses GIpRequests listen_buf sizeof listen _buf cout lt lt listen_buf lt lt An Each line of the returned data will be of the form model serial_number mac 1 DMC4000 291 00 50 4c 20 01 23 2 DMC30000 4184 00 50 4c 40 10 58 gclib 280 120 File Documentation Definition at line 39 of file gclibo c References G_UTIL_IPREQUEST and GuUtility 9 6 2 12 GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete GCon g GCStringin axes Blocking call that returns once all axes specified have completed their motion Note This function uses a profiled motion indicator not the position of the encoder E G see the difference between AM profiled and MC encoder based Although using the _BGm operand is the most generally compatible method there are higher performance ways to check for motion complete by using the data record or interrupts See examples x_dr_motioncomplete and x_ei_motioncomplete Parameters g Connection s handle axes A null terminated string containing a multiple axes mask Every character in the string should be a valid argument to MG_BGm e XYZWABCDEFGHST Returns The success status or error code of the function See gclib_errors h for possible values See x_gmotioncomplete cpp for an example Definition at line 108 of file gclibo c References G_NO_ERROR G_SMALL_BUFFER GCommand and GSleep 9 6 2 13 GCLIB_DLL_EXPORTED GReturn GCALL GPr
119. s or error code of the function See gclib_errors h for possible values See x_arrays cpp for an example Referenced by H_DownloadArraysFromList 9 2 2 2 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 gclib 280 92 File Documentation Parameters g Connection s handle array_name Null terminated string containing the name of the array to upload first The first element of the array for sub array uploads G_BOUNDS to omit last The last element of the array for sub array uploads G_BOUNDS to omit delim Sets the delimeter between array elements in the returned data G_CR specifies carriage return G_COMMA specifies comma buffer Buffer to receive the uploaded data The data will be null terminated unless function returns G_BAD_LOST_DATA due to the buffer being too small to hold the data buffer_len The length of the receive buffer Returns The success status or error code of the function See gclib_errors h for possible values See x_arrays cpp for an example Referenced by H_UploadArrayToList 9 2 2 3 GCLIB_DLL_EXPORTED GReturn GCALL GClose GCon g Closes a connection to a Galil Controller Attention gclib requires that GClose be called whenever a program is finished with a controller Th
120. subscribe Subscribe to NONE MG DR EI 192 168 0 42 messages data ALL subscribe MG records and or interrupts s shorthand for 192 168 0 42 s subscribe DR s EI timeout timeout in ms 5000 0 65535 192 168 0 42 timeout 5000 shorthand for GALILPCI2 t 500 timeout unsolicited Unsolicited socket UDP TCP NONE 192 168 0 42 protocol unsolicited TCP gclib 280 96 File Documentation u shorthand for 192 168 1 42 u unsolicited NONE Operating System Address Range Notes Windows 00111 COM256 RS232 and USB to serial Linux dev ttyS0 RS232 dev ttyS255 Linux dev ttyUSBO USB to serial e g DMC 4103 dev ttyUSB255 Windows GALILPCI1 GALILPCI8 PCI Linux dev galilpcio PCI dev galilpci7 See x_examples cpp for an example When connecting to a network device if the command and response socket is opened successfully but the unso licited socket fails GOpen will still complete successfully This allows connection to a Galil controller when only one Ethernet handle is available Unsolicited traffic will not be accessible in this case 9 2 2 9 GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload GCon g GCStringIn program GCStringIn preprocessor Downloads a program to the controller s program buffer gclib 280 9 2 gclib h File Reference 97 Parameters g Connection s handle program Nul
121. switches UB axis_b_stop_code B axis stop code SL axis_b reference _position B axis reference position SL axis_b_motor_position B axis motor position SL axis_b_position_error B axis position error SL axis_b_aux_position B axis auxiliary position SL axis_b_velocity B axis velocity SW axis_b_torque B axis torque UW axis_c_status C axis status UB axis_c_switches C axis switches UB axis_c_stop_code C axis stop code SL axis_c_reference_position C axis reference position SL axis_c_motor_position C axis motor position SL axis_c_position_error C axis position error SL axis_c_aux_position C axis auxiliary position SL axis_c_velocity C axis velocity SW axis_c_torque C axis torque UW axis_d_ status D axis status UB axis_d_switches D axis switches UB axis_d_stop_code D axis stop code SL axis_d_reference_position D axis reference position SL axis_d_motor_position D axis motor position SL axis_d_position_error D axis position error SL axis_d_aux_position D axis auxiliary position SL axis_d_velocity D axis velocity gclib 280 8 2 GDataRecord1802 Struct Reference 59 SW axis_d_torque D axis torque UW axis_e status E axis status UB axis_e switches E axis switches UB axis_e_stop_code E axis stop code SL axis_e_reference_position E axis reference position e SL axis_e_motor_position E axis motor position SL axis_e_position_error E axis positio
122. t H_ArrayData tail e int count 8 10 1 Detailed Description Structure to create a linked list for array data Definition at line 10 of file arrays c The documentation for this struct was generated from the following file e arrays c gclib 280 86 Data Structure Documentation gclib 280 Chapter 9 File Documentation 9 1 arrays c File Reference include gclibo h Data Structures struct H_ArrayData Structure to create a linked list for array data Typedefs typedef struct H_ArrayData ArrayNode Functions e void H_InitArrayNode ArrayNode x node Function to initialize the memory of a new node e GReturn H_AddArray ArrayNode xhead char xname char data Add an ArrayData node to the linked list void H_FreeArrays ArrayNode node Frees all memory downsteam of node After passing list head to this function all memory is freed and the head node is invalid GReturn H_UploadArray ToList GCon ArrayNode head char xname Uplaods a particular array and adas it to the linked list e GReturn H_CreateArrayNode ArrayNode head char xname Creates a buffer on the heap to write data and adas it to the linked list GReturn H_ArrayAddElement ArrayNode node GCStringIn element Adds an array element to an array node GReturn H_DownloadArraysFromList GCon g ArrayNode xhead Walks through the array linked list downloading each GReturn H_WriteArrayCsv ArrayNode head G
123. t data e g GCommana response buffer was too small for the controller s response define G_BAD_LOST_DATA_S data was lost due to buffer or fifo limitations define G_BAD_FILE 10005 Bad file path bad file contents or bad write define G_BAD_FILE_S file was not found contents are invalid or write failed define G_BAD_ADDRESS 10006 Bad address define G_BAD_ADDRESS_S a bad address was specified in open 9 3 1 Detailed Description Defines values for the Galil C Library return codes and error strings Definition in file gclib_errors h 9 4 gclib_record h File Reference Data Structures struct GDataRecord4000 Data record struct for DMC 4000 controllers including 4000 4200 4103 and 500x0 struct GDataRecord1806 Data record struct for DMC 1806 controller e struct GDataRecord2103 Data record struct for DMC 2103 controllers e struct GDataRecord1802 Data record struct for DMC 1802 controllers Same as 2103 except no analog in axis data struct GDataRecord30000 Data record struct for DMC 30010 controllers struct GDataRecord47000_ENC Data record struct for RIO 471xx and RIO 472xx PLCs Includes encoder fields struct GDataRecord47300_ENC Data record struct for RIO 47300 Includes encoder fields struct GDataRecord47300_24EX Data record struct for RIO 47300 with 24EX I O daughter board union GDataRecord Data record union containing all structs and a generic byte array
124. t_bank_7 general output bank 7 outputs 57 64 UB output_bank_8 general output bank 8 outputs 65 72 UB output_bank_9 general output bank 9 outputs 73 80 SWreserved_0 Reserved SWreserved_2 Reserved SWreserved_4 Reserved SW reserved_6 Reserved SW reserved_8 Reserved SW reserved_10 Reserved SW reserved_12 Reserved SW reserved_14 Reserved UB reserved_16 Reserved gclib 280 62 Data Structure Documentation UB reserved_17 Reserved UB reserved_18 Reserved UB reserved_19 Reserved UB reserved_20 Reserved UB reserved_21 Reserved UB reserved_22 Reserved UB reserved_23 Reserved UB error_code error code UB thread_status thread status UL reserved_24 Reserved UL contour_segment_count Segment Count for Contour Mode UW contour_buffer_available Buffer space remaining Contour Mode UW s_plane_segment_count segment count of coordinated move for S plane UW s_plane_move_status coordinated move status for S plane SLs distance distance traveled in coordinated move for S plane UW s_plane_buffer_available Buffer space remaining S Plane UW t_plane_segment_count segment count of coordinated move for T plane UW t_plane_move_status Coordinated move status for T plane SL t_distance distance traveled in coordinated move for T plane UW t_plane_buffer_available Buffer space remaining T Plane UW axis_a_status A axis status
125. tar gz PCI driver files usr share doc gclib src gclib_129 pci tar gz Serial Ports and USB If access to the serial ports or USB e g DMC 4103 is desired through gclib the following will provide steps to join the correct access group If using USB be sure the controller is powered and the usb is plugged in before beginning Determine group with access 5 ls 1 dev ttyUSBx dev ttySx erw rw 1 root dialout 4 64 Mar 3 16 39 dev ttyS0 erw rw 1 root dialout 4 65 Mar 3 16 39 dev ttySl erw rw 1 root dialout 4 66 Mar 3 16 39 dev ttyS2 erw rw 1 root dialout 4 67 Mar 3 16 39 dev ttyS3 crw rw 1 root dialout 188 0 Mar 6 11 08 dev ttyUSBO In the above listing dialout is the group that needs to be joined uucp is another common group that may be listed Add the desired username to the group sudo gpasswd a username dialout sudo password for username Adding user username to group dialout Log out and back in for change to take effect groups username wheel dialout gelib can now connect to serial and usb devices from user username PCI Controllers If using a Galil PCI controller the PCI driver must be installed gclib 280 16 Installation Extract source and build driver tar xf usr share doc gclib src gclib_202_pci tar gz make Copy module and add to kernel sudo cp galilpci ko lib modules uname r sudo depmod sudo modprobe galilpci Add galil gr
126. tectures Dynamically linked executables must have the correct dlls in their path at runtime doc The doc directory contains this documentation and a printable pdf version examples The examples directory contains example projects for various compilers The cpp directory contains x_examples h and the implementation of the example files documented in this manual Warning Before using the examples copy the files to a user location such as C Users user Documents Failing to do so may cause source files to be deleted upon gclib uninstallation include The include directory contains header files needed for compiling code The compiler will need to know where these files are at compile time See the compiler specific directions for more information e g gclib using MinGW lib The ib directory contains linker files gclib lib and gclibo lib for both x86 and x64 architectures The linker should include gclib lib and gclibo lib source The source directory contains source files such as gclibo c gclib 280 12 Installation 3 2 Apple OS X Tested versions See the installation page for supported versions Installation On OS X gclib is distributed in a dmg image The following steps can be performed to install gclib Download the gclib dmg e Point a browser at http www galil com sw pub apple osx 10 10 gclib gclib_ dmg html and download the dmg file Open the dmg file and drag the gclib directory to t
127. th the following code gclib 280 46 Using gclib Public Class Forml Dim gclib As New Gclib Private Sub Forml_Load sender As Object e As EventArgs Handles MyBase Load Me Text gclib simple example Dim tb As New TextBox with tb Multiline True Dock DockStyle Fill Parent Me Try calls to gclib should be in a try catch AppendText GVersion amp gclib GVersion amp vbCrLf gclib GOpen 192 168 0 42 d Set an appropriate IP address here AppendText GInfo amp gclib GInfo amp vbCrLf AppendText GCommand amp gclib GCommand MG TIME amp vbCrLf Catch ex As Exception AppendText ERROR ex Message Finally gclib GClose Don t forget to close End Try End With End Sub End Class Hit 25 to run the project 5 3 2 C NET gclib ships with gclib cs a C class which exposes the functionality of the gclib In addition a C forms example is included which demonstrates how to use gclib cs For brevity these instructions assume the default installation location of C Program Files x86 Galil gclib Running the C Example Copy files Navigate to a convenient empty writable location e g C ltemp Copy the contents of C Program Files x86 Galil gclib examples cs 2013_12 0 gclib_example to this loca tion Open in Microsoft Visual Studio 2013 Open gclib_example sin in Visual Studio This demo was tested on MSVS 2013 Add existing item gclib cs
128. to a controller at a given MAC address GReturn GCALL GlpRequests GCStringOut requests GSize requests_len Provides a list of all Galil controllers requesting IP addresses via BOOT P or DHCP GReturn GCALL GCmd GCon g GCStringln command Wrapper around GCommand for use when the return value is not desired GReturn GCALL GCmdT GCon g GCStringIn command GCStringOut trimmed_response GSize response_len GCStringOut front Wrapper around GCommand that trims the response GReturn GCALL GCmdl GCon g GCStringln command int value Wrapper around GCommand that provides the return value of a command parsed into an int GReturn GCALL GCmdD GCon g GCStringln command double value Wrapper around GCommand that provides the return value of a command parsed into a double GReturn GCALL GMotionComplete GCon g GCStringIn axes Blocking call that returns once all axes specified have completed their motion GReturn GCALL GRecordRate GCon g double period_ms Sets the asynchronous data record to a user specified period via DR GReturn GCALL GProgramDownloadFile GCon g GCStringin file_path GCStringIn preprocessor Program download from file gclib 280 106 File Documentation GReturn GCALL GProgramUploadFile GCon GCStringin file_path Program upload to file void GCALL GError GReturn rc GCStringOut error GSize error_len Provides a human readable description string for return codes
129. turns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Definition at line 97 of file gclibo c References G_NO_ERROR G_SMALL_BUFFER and GCommand Referenced by GRecordRate 9 5 2 5 GReturn GCALL GCmdl GCon GCStringIn command int value Wrapper around GCommand that provides the return value of a command parsed into an int Use this function to get most values including TP RP TE Digital I O states etc Parameters g Connection s handle command Null terminated command string to send to the controller value Pointer to an int that will be filled with the return value gclib 280 108 File Documentation Returns The success status or error code of the function See gclib_errors h for possible values See x_gcommand cpp for an example Definition at line 86 of file gclibo c References G_NO_ERROR G_SMALL_BUFFER and GCommand 9 5 2 6 GReturn GCALL GCmdT GCon g GCStringln command GCStringOut trimmed_response GSize response_len GCStringOut x front Wrapper around GCommand that trims the response For use when the return value is desired is ASCII not binary and the response should be trimmed of trailing colon whitespace and optionally leading space Parameters g Connection s handle command Null terminated command string to send to the controller trimm
130. x OS X users must be root to use GlpRequests and have UDP access to bind and listen on port 67 example of listening for controllers needing IP addresses GIpRequests listen_buf sizeof listen _buf cout lt lt listen_buf lt lt An Each line of the returned data will be of the form model serial_number mac 1 DMC4000 291 00 50 4c 20 01 23 2 DMC30000 4184 00 50 4c 40 10 58 Definition at line 39 of file gclibo c References G_UTIL_IPREQUEST and GUtility 9 5 2 10 GReturn GCALL GMotionComplete GCon g GCStringin axes Blocking call that returns once all axes specified have completed their motion Note This function uses a profiled motion indicator not the position of the encoder E G see the difference between AM profiled and MC encoder based Although using the _BGm operand is the most generally compatible method there are higher performance ways to check for motion complete by using the data record or interrupts See examples x_dr_motioncomplete and x_ei_motioncomplete gclib 280 9 5 gclibo c File Reference 111 Parameters g Connection s handle axes A null terminated string containing a multiple axes mask Every character in the string should be a valid argument to MG_BGm i e XYZWABCDEFGHST Returns The success status or error code of the function See gclib_errors h for possible values See x_gmotioncomplete cpp for an example Definition at line 108 of fi
131. x86 gclibo lib 2 file s copied Program Files x86 Galil gclib d11 x86 gclib dll Program Files x86 Galil gclib d11 x86 gclibo dil 2 file s copied tr C temp borland gt Modify Path Add Borland s compiler to the PATH variable C temp borland gt set PATH c Program Files x86 Embarcadero Studio 17 0 bin PATH Convert lib files C temp borland gt move gclib lib _gclib lib 1 file s moved C temp borland gt move gclibo lib _gclibo lib 1 file s moved C temp borland gt coff2omf exe _gclib lib gclib lib COFF to OMF Converter Version 1 2 0 Copyright c 1999 2009 Embarcadero Technologies Inc All rights reserved C temp borland gt coff2omf exe _gclibo lib gclibo lib COFF to OMF Converter Version 1 2 0 Copyright c 1999 2009 Embarcadero Technologies Inc All rights reserved x_simple c Edit GOpen call as necessary In a text editor open x_simple c Find the GOpen call and update the address to match the desired hardware See the documentation for GOpen for address formatting options Compile C temp borland gt bcc32 gclib lib gclibo lib x_simple c Embarcadero C 7 10 for Win32 Copyright c 1993 2015 Embarcadero Technologies Inc x_simple c Turbo Incremental Link 6 72 Copyright c 1997 2015 Embarcadero Technologies Inc Execute C temp borland gt x_simple exe version 130 115 279 info 192 168 0 43 DMC4143 Rev 1 2b 9998 response 61016 0000
132. xamples are provided to demonstrate how to use the library with various languages and on various platforms C C Python Net Galil Widgets Can t find what you need Please email softwaresupport galil com orcallGalil Applications 5 1 C C Microsoft Visual Studio MinGW Borland C gcc Linux clang OS X 5 1 1 Microsoft Visual Studio For brevity these instructions assume the default installation location of C Program Files x86 Galil gclib x_simple c from VS2013 x64 Native Tools Command Prompt Open VS2013 x64 Native Tools Command Prompt Copy files Navigate to a convenient empty writable location e g C temp Set an environment variable for the base path C temp gt set base C Program Files x86 Galil gclib 28 Using gclib Copy simple example C temp gt copy Sbase examples cpp x_simple c Edit GOpen call as necessary In a text editor open x_simple c Find the GOpen call and update the address to match the desired hardware See the documentation for GOpen for address formatting options Compile C temp gt cl x_simple c base lib dynamic x64 lib I base include Set Path to DLL C temp gt set PATH base d11 x64 155 Execute C temp gt x_simple exe roe 0 version 85 60 138 re 0 res 0 info 10 1 3 17 DMC4020 Rev 1 2b 291 rez 0 response 357247808 0000 Using the pre configured MSVC project x_examples cpp
133. ype the following commands into a Terminal prompt gclib 280 5 2 Python 43 mkdir python_temp cd python_temp tar xvf Applications gclib source gclib_253_python tar gz gclib py setup py tar xvf Applications gclib examples gclib_253_python_examples tar gz example py sudo python setup py install running install running build running build _py creating build creating build lib copying gclib py gt build lib running install_lib copying build lib gclib py gt Library Python 2 7 site packages byte compiling Library Python 2 7 site packages gclib py to gclib pyc running install_egg_info Writing Library Python 2 7 site packages gclib 1 0 py2 7 egg info NK Vx XxX un The gclib Python wrapper is now installed Go to the next section Using gclib from the Python Interpreter Using gclib from the Python Interpreter Invoke the Python Interpreter Type the following into the Python prompt gt gt gt import gclib gt gt gt g gclib py gt gt gt g GOpen 192 168 0 42 direct gt gt gt print g GInfo 192 168 0 42 DMC4080 Rev 1 2c 783 Running Python scripts Navigate the terminal to the location from Install the gclib Python module where example py was copied Open example py in a text editor Set the address in the g GOpen call to match an avaiable connection Execute the following command at the Terminal python example py gclib version py 1
Download Pdf Manuals
Related Search
Related Contents
DVB-T - Service Batteries - Rapid Electronics さまざまなワークスタイルへの想いに私たちがお応えします。 @—Cruise - OptionAuto.biz S10 User Manual - Stonex Positioning CMB-37D - Commell EDS-510A Series User's Manual v3 Copyright © All rights reserved.
Failed to retrieve file