/// <summary> /// Initialize Controller object and perfor tests /// </summary> /// <param name="args">N/A</param> static void Main(string[] args) { //Create an instance of the _Controller //The same instance should be used throughout the app _Controller = new KMotion_dotNet.KM_Controller(); //Add all various callbacks AddHandlers(); Console.WriteLine(String.Format("Board Type = [{0}]", _Controller.BoardType)); //Load a C program // // Figure out what directory we are installed into string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uri.Path); path = Path.GetDirectoryName(path); path = Path.GetDirectoryName(path); path = Path.GetDirectoryName(path); // pick one of the examples String TheCFile = path + @"\C Programs\KSTEP\InitKStep3Axis.c"; //************NEW program execution model*********** String result = _Controller.ExecuteProgram(1, TheCFile, false); if (result != "") MessageBox.Show(result); //Also have a look at these:: //_Controller.ExecuteProgram(1); //_Controller.WaitForThreadComplete(1, 400); //_Controller.KillProgramThreads(1); //_Controller.KillProgramThreads(3, 5, 6); // Put a 64 bit float value into KFLOP UserData // vars 26&27 and read it back. // in KFLOP read it with: // printf("UserData %f\n", *(double*)&persist.UserData[13 * 2]); _Controller.SetUserDataDouble(13, 123.456789); double d = _Controller.GetUserDataDouble(13); //Get Firmware version Console.WriteLine(_Controller.GetCommandValue<string>("Version", false)); RunMain_StatusExample(); //RunHomingRoutineExample(); RunIOExample(); //RunAxisExample(); RunCoordinatedMotionExample(); //RunInterpreterExample(); _Controller.Dispose(); Console.ReadLine(); }
/// <summary> /// Initialize Controller object and perfor tests /// </summary> /// <param name="args">N/A</param> static void Main(string[] args) { //Create an instance of the _Controller //The same instance should be used throughout the app _Controller = new KMotion_dotNet.KM_Controller(); //Add all various callbacks AddHandlers(); Console.WriteLine(String.Format("Board Type = [{0}]", _Controller.BoardType)); //Load a C program // // Figure out what directory we are installed into string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uri.Path); path = Path.GetDirectoryName(path); path = Path.GetDirectoryName(path); path = Path.GetDirectoryName(path); // pick one of the examples String TheCFile = path + @"\C Programs\KSTEP\InitKStep3Axis.c"; //************NEW program execution model*********** String result = _Controller.ExecuteProgram(1, TheCFile, false); if (result != "") { MessageBox.Show(result); } //Also have a look at these:: //_Controller.ExecuteProgram(1); //_Controller.WaitForThreadComplete(1, 400); //_Controller.KillProgramThreads(1); //_Controller.KillProgramThreads(3, 5, 6); // Put a 64 bit float value into KFLOP UserData // vars 26&27 and read it back. // in KFLOP read it with: // printf("UserData %f\n", *(double*)&persist.UserData[13 * 2]); _Controller.SetUserDataDouble(13, 123.456789); double d = _Controller.GetUserDataDouble(13); //Get Firmware version Console.WriteLine(_Controller.GetCommandValue <string>("Version", false)); RunMain_StatusExample(); //RunHomingRoutineExample(); RunIOExample(); //RunAxisExample(); RunCoordinatedMotionExample(); //RunInterpreterExample(); _Controller.Dispose(); Console.ReadLine(); }
private void Window_Closed(object sender, EventArgs e) { KM.Dispose(); }