Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4COM)  1.26.2
Creating a new C# project for Windows using Visual Studio 2005

Learn how to set up a simple VS2005 project which runs on the BoschRexroth VEP WinCE6.0 platform and how to access the MLP firmware using MLPI function calls.

Setting Up the Project

Start Visual Studio 2005 and create a new project: ( From Menu: File->New->Project ).

vsVCProject.png

Select 'Console Application' and finish the project wizard by clicking 'Finish'. You now have an empty WinCE project and may want to start developing with the MLPI-API library.

Add the MLPI-COM reference to the C# Project ( From Menu: Project->Add Reference...)

Rexroth MotionLogicProgrammingInterface 1.x Type Library
vsComDllRef.png

Setting Build Configuration for x86 platform ( From Menu: Build->Configuration Manager->Active Solution Platform )

vsVCPlatform.png

You have to include the MLPI library as well as the necessary MLPI headers.

using commlpiLib;

You are now able to use MLPI functions. Here is some example code showing how to connect to a MLC/MLP/XLC control and to read the current control firmware version. Don't forget to replace the IP address of your control in the example code.

using System;
using System.Collections.Generic;
using System.Text;
using commlpiLib;
namespace ConsoleApplication
{
class commlpi
{
static void Main(string[] args)
{
//
// create MotionLogicControl and Axes object
//
MlpiConnection connection = new MlpiConnection();
//
// connect to control
//
connection.Connect("192.168.0.17 -user=mlpiTest -password=mlpiTest");
//
// clearError on MLC
//
connection.System.ClearError();
//
// read and display some control information
//
Console.WriteLine("\nDiagnosis Text: " + connection.System.GetDisplayedDiagnosis().text);
//
// read the control name
//
Console.WriteLine("control name: " + connection.System.GetName());
//
// set a new control name
//
Console.Write("\nSet new control name: ");
connection.System.SetName(Console.ReadLine());
//
// read the new control name
//
Console.WriteLine("New control name: " + connection.System.GetName() + "\n");
//
// another possibility to get the AxesInformation
//
AxisInformation[] myAxesInfo = (AxisInformation[])connection.Motion.GetConfiguredAxes();
foreach (AxisInformation axInfo in myAxesInfo)
{
Console.WriteLine("Axis name: \t" + axInfo.name + "\taxisType: " + axInfo.AxisType);
}
//
// disconnect from control
//
connection.Disconnect();
Console.WriteLine("press enter to quit");
Console.ReadLine();
}
}
}

Starting the Project

Build your project by selecting Build->Build Solution from the Visual Studio menu.