gclib  528
Communications API for Galil controllers and PLCs
Commands.vb
1 Partial Public Module Examples
2  ''' <summary>
3  ''' Demonstrates various uses of GCommand() And basic controller queries.
4  ''' </summary>
5  ''' <param name="gclib">A gclib object with a valid connection.</param>
6  ''' <returns>The success status Or error code of the function.</returns>
7  ''' <remarks>See commands_example.cs for an example.</remarks>
8  Function Commands(gclib As Gclib) As Integer
9  Console.WriteLine("*****************************************************************************")
10  Console.WriteLine("*********************** GCommand Trimmed example ***********************")
11  Console.WriteLine("*****************************************************************************")
12 
13  Console.WriteLine("GCommand(""PR ?,? "", true) will return a trimmed response of GCommand()")
14  Console.WriteLine("The command 'PR ?,?' will return the relative " +
15  "position of the A and B axes")
16  Console.WriteLine("<<PR ?,? with no trim: " + gclib.GCommand("PR ?,?", False) + ">>")
17  Console.WriteLine("<<PR ?,? with trim: " + gclib.GCommand("PR ?,?", True) + ">>")
18 
19  Console.WriteLine("*****************************************************************************")
20  Console.WriteLine("************************* GCommand Int example *************************")
21  Console.WriteLine("*****************************************************************************")
22 
23  Console.WriteLine("Use GCmdI() to retrieve the value of GCommand as an int.")
24  Console.WriteLine("The command 'MG _LMS' will return the available " +
25  "space in the vector buffer of the S plane.")
26 
27  Console.WriteLine("MG _LMS with GCmdI(): " + gclib.GCmdI("MG _LMS").ToString())
28 
29  Console.WriteLine("*****************************************************************************")
30  Console.WriteLine("*********************** GCommand Double example ************************")
31  Console.WriteLine("*****************************************************************************")
32 
33  Console.WriteLine("Use GCmdD() to retrieve the value of GCommand as a double.")
34  Console.WriteLine("The command 'MG @AN[1]' will return the value of Analog Input 1")
35 
36  Console.WriteLine("MG @AN[1] with GCmdD(): " + gclib.GCmdD("MG @AN[1]").ToString())
37 
38  Return Examples.GALIL_EXAMPLE_OK
39  End Function
40 End Module