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 1.3.0.0 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.
    http://www.galilmc.com/support/software-downloads.php
  2. Connect to the controller using GalilTools
    http://www.galilmc.com/support/manuals/galiltools/connections.html#available
  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
            Try
                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:
    GalilClass0.dll 0.4.0.0
    Galil1.dll 1.4.0
    192.168.1.155, 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.




No comments:

Post a Comment

Solidworks macros eith ChatGPT

 Record a simple using thr Solidworks macro recorder, upload it to ChatGPT, and explain to ChatGPT how you want it changed:  https://youtu.b...