Not a member? Register Now
Sales & Support: 1.800.377.6329
Register for full access to Galil's on-line tutorials, product manuals, downloads, and more.
In the "Hello World" tradition, each project contains the bare minimum code to demonstrate communication to the controller and simply prints the controller's model and serial numbers to the screen:

Figure 1. Sample program output
Each HelloGalil project (contained in a .zip file) includes the following:
Only the controller is required to start programming (motors, encoders
are not necessary).
Sample projects for the following Windows programming languages and Galil communication libraries
are available:
Sample projects are available for the GalilTools
Communication Library as well as prior generation Galil driver packages. The
GalilTools Communication Library is recommended for all
new designs of supported controllers, and should be considered when updating existing projects.
| Manufacturer | Programming | Version |
GalilTools Library |
|||||
| Language | COM |
Native C++ |
||||||
| Microsoft | Visual Basic | VS 2008 |
Download | |||||
| Microsoft | Visual Basic | VS 2005 |
Download | |||||
| Microsoft | Visual Basic | VS 2003 |
Download | |||||
| Microsoft | Visual Basic | VS 6.0 |
Download | |||||
| Microsoft | Visual C# | VS 2008 |
Download | |||||
| Microsoft | Visual C# | VS 2005 |
Download | |||||
| Microsoft | Visual C# | VS 2003 |
Download | |||||
| Microsoft | Visual C++ | VS 2008 |
Download | Download | ||||
| Microsoft | Visual C++ | VS 2005 |
Download | |||||
| Microsoft | Visual C++ | VS 6.0 |
Download | |||||
| GNU (Linux) | C++ | 4.3.0 |
Download | |||||
| National Instruments | Labview | 8.6, 8.5, 8.2, 8.0 |
Download | |||||
| Microsoft | Excel | Office 2002 |
Download | |||||
| Microsoft | HTML (JScript) | Internet Explorer |
Download | |||||
| Microsoft | JScript | VS 5.7 |
Download | |||||
| Microsoft | VBScript | Vs 5.7 |
Download | |||||
| Manufacturer | Programming Language | Version |
DMCWin32 (DMC32.dll) |
ActiveX Toolkit (dmcshell.ocx) |
DMC.NET (DMCdNet.dll) |
|||
| Borland | Delphi |
5
|
Download | Download | ||||
| Entivity | Think & Do Live! |
5.4
|
Download | |||||
| Entivity | Think & Do Studio |
6.5
|
Download | |||||
| MathWorks | MATLAB |
6 Release 12
|
Download | |||||
| Microsoft | Visual Basic |
6.0
|
Download | Download | ||||
| Microsoft | Visual Basic |
.NET 2003
|
Download | Download | Download | |||
| Microsoft | Visual Basic |
2005 Express
|
Download | Download | Download | |||
| Microsoft | Visual C# |
.NET 2003
|
Download | Download | Download | |||
| Microsoft | Visual C# |
2005 Express
|
Download | Download | Download | |||
| Microsoft | Visual C++ |
6.0
|
Download | Download | ||||
| Microsoft | Visual C++ |
.NET 2003
|
Download | Download | Download | |||
| Microsoft | Visual C++ |
2005 Express
|
Download | Download | Download | |||
| Microsoft | Visual J# |
.NET 2003
|
Download | Download | Download | |||
| Microsoft | Visual J# |
2005 Express
|
Download | Download | Download | |||
| National Instruments | LabVIEW | 8.0
|
Download | Download | ||||
| National Instruments | LabVIEW | 8.5
|
Download | Download | ||||
| WonderWare | InTouch |
9.0
|
Download |
Local versus Host Programming
Commercial digital motion controllers are flexible and easy to use (when compared to analog or proprietary solutions) because of their ability to be programmed to perform a specific task. Each manufacturer has its own programming language, and Galil is no exception with it's two-letter "Galil language" (e.g. BG begins motion). Although the Galil controller directly understands one language, all modern Galil controllers can be programmed in two different ways:
A combination of methods 1 and 2 may also be used. This gives the option
of offloading specific tasks to the motion controller, leaving high-level
tasks to the PC. The HelloGalil library is useful for method (2) above
when the host is a PC running Windows.
Using HelloGalil - Example
Let's say you have been tasked with coordinating a Galil motion controller with a vision system, your favorite programming language is Visual Basic 6.0, and you like the features provided by Galil's ActiveX Toolkit. To get started, you would download the appropriate .zip file, glance at GalilInstructions.txt, double click on the .vbp (Visual Basic Project) file, and the source code below would pop up:

After hitting F5 (run program), the window in figure 1 would pop up and
voila! You have communicated to the controller from VB 6!
Communication Details
So what just happened? Figure 2 below shows a graphical representation of the communication activity caused by a HelloGalil program:

Figure 2. Communication for a HelloGalil program
First, the PC sends the special ASCII characters "Ctrl-R", "Ctrl-V", and "\r" (carriage return). The first two are the non-printable characters produced when pressing (and holding) the Ctrl key on your keyboard followed by the "R" and "V" keys. The carriage return is automatically appended by the Galil communication library. The controller responds to this special command with a string of characters indicating the controller model (e.g. DMC-18x2), the number of axes (4), and the firmware version (1.0o). Data coming from the controller is always followed with "\r" (carriage return), "\n" (new line), and ":" (colon). Table 2 summarizes these special characters:
| Character | Description | Decimal |
Hexadecimal |
|||
| Ctrl-R | Control R (note R is the 18th character of the alphabet) | 18 | 12 | |||
| Ctrl-V | Control V (note V is the 22nd character of the alphabet) | 22 | 16 | |||
| \r | Carriage Return | 13 | 0D | |||
| \n | New Line | 10 | 0A |
Next, the PC sends a more typical command string: it sends "MG _BN\r" and receives "2039.0000\r\n:" in response. MG is the controller's "print message" command and can be used to print just about anything (text strings, variables, array elements, I/O point states, motor positions ). _BN is an example of one of the controller's many internal state variables (known as "operands") and returns the controller's serial number (and should match the white sticker on the controller containing a bar code).
A simple terminal log of the same commands from SmartTerminal would look like this:
:^R^V
DMC1842 Rev 1.0o
:MG _BN
2039.0000
:
What Next?
You've downloaded the HelloGalil.zip file, run the program, and you see a window similar to figure 1 indicating that you can talk to the controller. So, what do you do now to start making headway on your motion control project? Well, you can copy the "MG _BN" line, paste it somewhere else in your program, and replace "MG _BN" with a command string like those shown in table 3 below:
| Command String | Description | |||
| PRX=1000 | Move the X axis 1000 counts | |||
| BGX | Begin motion | |||
| MG _BGY | Y axis still in motion? | |||
| MG _RPZ | Z axis commanded position? | |||
| MG @IN[1] | State of digital input 1? | |||
| SB1 | Set digital output 1 | |||
| MG _LFW | State of W axis forward limit switch? | |||
| MG MyArray[3] | Value of element 3 of MyArray? | |||
| MG MyVar | Value contained in the variable MyVar? |
Now, from your PC program, you can generate motion, query
whether motion is complete,
set and get I/O point states, query axis positions, variables, array elements,
and much more. See your controller's command reference and user manual
for more information:
http://www.galilmc.com/support/manuals.php
Avoid Trip Point Commands
Note that the following "trip point" commands are not normally sent from PC programs because they take a long time to execute and thus preclude further communication until they complete:
AD, AI, AM, AP, AR, AS, AV, MC, MF, MR, WT
You should usually find another way to do what you want (for example poll MG _BG instead of using AM); however, if you do decide to send any of these commands from a PC, be aware that: