![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For programmers developing Windows applications that communicate with a Galil controller, the HelloGalil library of quick start projects immediately gets you communicating with the controller from the programming language of your choice. 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:
Each HelloGalil project (contained in a .zip file) includes the following:
Only the controller is required to start programming (motors, encoders
aren't necessary). Sample projects for the following Windows programming
languages and Galil communication libraries are available:
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:
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: Table 2. Description of special characters used in
Figure 2
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
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:
Now, from your PC program, you can generate motion, query
whether motion is complete, http://www.galilmc.com/literature/manuals.html
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:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||