Monday, August 20, 2012

First program to control a motor using Galil DMC-4133

In a previous blog, I discussed connecting to the Galil DMC-4133 using Gilal Tools. This blog now discusses a very simple set of commands to get the motor moving. I will list each command and discuss them as I type them.

:MT 2 'The MT is required for setting up communication with a stepper motor. The variable can be 2, -2, 2.5, or -2.5 depending on active low step or active high step and whether it is reverse direction.
:SH 'Turns motor on
:PRA = 13000
:MO A  'Turns motor A off

Thursday, August 16, 2012

Connecting to Gilal DMC-4133 using USB and VB 2010

I followed guild for connecting to a Gilal controller using VB. I downloaded the tutorial and I found the a readme in subfolders. The steps were as follows:

  1. Install GalilTools version or newer on Windows XP or newer.  Lite is free of charge, the full version required a purchased password.  Either is fine for this walkthrough.
  2. Connect to the controller using GalilTools
  3. Open Microsoft Visual Basic .Net 2010 Express, select File | New Project | Windows Forms Application and type "Hello_Galil" for the name.  Click OK. 
  4. Add a Label to the form by double clicking "Label" under "All Windows Forms" in the Toolbox.  
  5.  In the Solution Explorer window, right click "Hello_Galil" and choose "Add Reference".  The Reference dialog may take a few moments to populate.
  6. Click the COM tab.  Find "Galil" in the list.  Highlight it and click OK.
  7. Double click on the title bar of the form to enter the code section.
  8. Enter the following code in the public Class Form1:

        Dim WithEvents g As New Galil.Galil
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                Label1.Text = g.libraryVersion() + vbCrLf
                g.address = ""
                Label1.Text = Label1.Text + g.connection() + vbCrLf
                Label1.Text = Label1.Text + "MG TIME " + g.commandValue("MG TIME").ToString + vbCrLf
            Catch ex As Runtime.InteropServices.COMException
                Label1.Text = Label1.Text + ex.Message
            End Try
        End Sub
  9. Push F5 to compile and run the application.  The program will display the connections dialog, identical to GalilTools.  Choose the same controller you connected to in step (2).  The output should be similar to:
    Galil1.dll 1.4.0, RIO47100 Rev 1.0c1, 1155, IHA IHB
    MG TIME 4799941
When I run the program, I got an error: Network Failure, Address Not Available. After I click OK a few times, the following window shows up:

I click on COM3 115200, then clikc Connect.

The Form 1 output shows:

This indicates that the connection was successful.

On earlier times, the Windows Firewall screen also showed up. I gave it full privileges, then the next time, the screen did not appear when running the program.

Connecting to A Gilal Motion Controller

Gilal provides motion controllers that have small amplifiers built in. These motion controllers come equipped with a USP port, Serial Port, and Ethernet port. Gilal also provides software for connecting to the motion controller. I am working on a DMC-4133. It comes complete with a case.

I am connecting to it using GilalTools. When I first fire up GilalTools, it states that it is offline. I click on the Controller|Connect. Then the following window pops up.

At first, the addresses did not show. I keep clicking on the Available and Saved until the above list appears. Then I select COM3 115200.

After that, the terminal screen should look like this which means you are connected. 
The above lines mean it is using COM3 serial port (or a simulated serial port using the USB port), the Model of the Gilal Motion Controller is DMS4133 Rev 1.1a1, and the serial number is 603.