Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4COM)  1.26.2
Creating a new VBA project for Windows using Excel

Learn how to set up a simple VBA Excel project which runs on a standard windows platform and is able to connect to a MLC/MLP/XLC control using MLPI function calls. All MLPI function calls are tunneled through TCP/IP over an ethernet connection to the control. Please keep in mind that hard realtime from your application to the control is not possible using this setup.

Setting Up the Project

Start Excel and switch to Visual Basic Editor ( From Menu: Extras->Makro->Visual-Basic-Editor ).

vbaEditor.png

Add the MLPI-COM reference to VBA ( From Menu: Extras->Verweise)

Rexroth MotionLogicProgrammingInterface 1.x Type Library
reference.png

To see all MLPI-COM methods and types press F2 and open the object catalog.

mlcObjectCatalog.png

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.

'MLPI-COM VBA(Excel) demonstration
Sub Test()
' Connect to device
Dim x As MlpiConnection
Set x = New MlpiConnection
x.Connect "192.168.0.1 -user=mlpiTest -password=mlpiTest"
' Version Info
Cells(3, 2).value = x.System.GetVersionInfo("VERSION_FIRMWARE")
Cells(4, 2).value = x.System.GetVersionInfo("VERSION_HARDWARE")
' Network Settings
Cells(6, 2).value = x.System.GetIpAddress
Cells(7, 2).value = x.System.GetGateway
Cells(8, 2).value = x.System.GetSubnetMask
Cells(9, 2).value = x.System.GetMacAddress
' Hardware Info
Cells(11, 2).value = x.System.GetSerialNumber
Cells(12, 2).value = x.System.GetCpuLoad
Cells(13, 2).value = x.System.GetCpuLoadMax
Cells(14, 2).value = x.System.GetTemperature
Cells(15, 2).value = x.System.GetTemperatureMax
Cells(16, 2).value = x.System.GetOperationHours
Cells(17, 2).value = x.System.GetHardwareDetails
Cells(18, 2).value = x.System.GetSpecialPath(PATH_SYSTEM)
Cells(19, 2).value = x.System.GetSpecialPath(PATH_OEM)
Cells(20, 2).value = x.System.GetSpecialPath(PATH_USER)
' Diagnosis
Cells(22, 2).value = x.System.GetDisplayedDiagnosis.Number
Cells(23, 2).value = x.System.GetDisplayedDiagnosis.Text
' Other
Dim dt As DateAndTime
dt = x.System.GetDateAndTimeUtc
Cells(25, 2).value = dt.Month & "/" & dt.Day & "/" & dt.Year & " - " & dt.Hour & ":" & dt.Minute & ":" & dt.Second
Dim mem As MemoryInfo
mem = x.System.GetMemoryInfo
Cells(26, 2).value = "TotalRam: " & mem.FreeVolatileBytes & " FreeRam: " & mem.FreeVolatileBytes
Cells(27, 2).value = "TotalNvRam: " & mem.FreeNonvolatileBytes & " FreeNvRam: " & mem.FreeNonvolatileBytes
' Disconnect from device
x.Disconnect
End Sub

Starting the Project

To start your project press F5 or F8 to debug. Your application should start to run and you should see the firmware version of your control and other stuff.