- 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 - Connect to the controller using GalilTools
http://www.galilmc.com/support/manuals/galiltools/connections.html#available - Open Microsoft Visual Basic .Net 2010 Express, select File | New Project | Windows Forms Application and type "Hello_Galil" for the name. Click OK.
- Add a Label to the form by double clicking "Label" under "All Windows Forms" in the Toolbox.
- In the Solution Explorer window, right click "Hello_Galil" and choose "Add Reference". The Reference dialog may take a few moments to populate.
- Click the COM tab. Find "Galil" in the list. Highlight it and click OK.
- Double click on the title bar of the form to enter the code section.
- 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 - 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
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