General Definitions



The Motion Programming Interface (MPI) defines a set of object-oriented, C-language functions and data types that you can use to develop motion control applications. The MPI is designed to be independent of the motion controller hardware used, as well as the platform (operating system & compiler) on which the motion control application is built. To support the MPI, a platform must be 32-bit (e.g. Windows NT). Most 32-bit platforms are capable of multi-threading and multi-tasking, and the MPI has built-in features that simplify the design and development of these types of applications.

For XMP only Instructions for the implementation of MPI in Motion Engineering's XMP motion controller are flagged with the notice "For XMP only."

To add custom features, applications often make use of extensions to the MPI, which limits portability.



A platform is the combination of the host computer, operating system, and C compiler. A platform must be 32-bit, i.e., the operating system must be able to execute 32-bit programs.

For XMP only The MPI/XMP has been ported to the WindowsNT/Microsoft Visual C++ platform. This platform is referred to as XMP-WinNT. If you are interested in using the MPI/XMP with other operating systems and C compilers, please contact MEI.

MPI Installation Directory

The MPI installation directory is the location into which the MPI software has been installed. The installation procedure suggests a default location (C:\MEI), but you can choose to install it wherever you desire. It is highly recommended that you use the default location. The installation directory contains an MPI directory:

MPI Subdirectories
Directory \ MPI Contains
Documentation - User and Reference Guides
MPI header files

For XMP-WinNT only The default installation directory is C:\MEI, and it contains a release note named YYYYMMDD.pdf, where YYYY represents the year, MM the month, and DD the day of the release. The installation directory also contains an XMP directory, which has various subdirectories.

XMP Subdirectories
Directory: C:\MEI\XMP Contains


Sample applications


XMP firmware


Windows NT utilities (from util)


Documentation - XMP Harware and Software Reference


XMP header files


XMP libraries


XMP utility source



An object is an instance of a data structure. The data structure is typically not directly accessible by an application.

When an application calls a function (also called a method) to create an object, the function returns a handle to the object. The object handle is then passed as the first argument to all other functions (methods) that are associated with that object. These functions provide indirect access to the object's data structure. When it is finished using an object, an application simply calls another function to delete it.
Example The MPI defines an Axis object. An Axis object is created by the mpiAxisCreate(...) function, which returns a handle of type MPIAxis. The mpiAxisStatus(...) function takes an Axis handle as its first argument and returns the status of the hardware axis with which the Axis object is associated. An Axis object is deleted by calling the mpiAxisDelete(...) function.



A handle is returned by the function that creates an object, and the handle uniquely identifies that object. A handle is simply a pointer to a pointer to an object. The MPI defines the type MPIHandle to be a generic handle. The symbol MPIHandleVOID is used to represent an invalid handle. The MPI functions that create and delete objects typically allocate and free memory from a heap; in this case a handle is generally a pointer to the allocated object data structure. However, an MPI implementation could define a handle to be a pointer into a static array of data structures, or an index into such an array. Regardless, an application MUST NOT do anything with a handle other than to pass it as an argument to other functions. In cases where a handle is a pointer, the pointer cannot be dereferenced, because the object data structure to which the handle points is not directly available to the application.

Example The MPI defines an Axis handle to be of type MPIAxis. An axis handle named axisHandle can be declared as follows: MPIAxis axisHandle;




A function associated with an object is called a method. The first argument of a method is always the handle of the object with which it is associated. A function that is not associated with an object is called a function. Throughout the MPI documentation, the term function refers to methods and functions, whereas the term method only refers to methods.

Example The following functions are all considered to be methods: mpiAxisCreate(...), mpiAxisStatus(...), mpiAxisDelete(...). Except for mpiAxisCreate(...), these functions all take an MPIAxis handle as their first argument.
                      MPIAxis axis; 
                      axis = mpiAxisCreate(.); 
                      mpiAxisStatus(axis, .); 



A module is a source file (module.c) whose interface is declared in a header file (module.h). A module contains code symbols (methods, functions, macros) and data symbols (data, data types and constants) that together implement an object. However, a module may also contain functions that have a logical connection without being associated with an object.

MPI Module Header
Adc adc.h
Axis axis.h
Capture capture.h
Command command.h
Control control.h
Event event.h
EventMgr eventmgr.h
Filter filter.h
Idn idn.h
IdnList idnlist.h
Message message.h
Motion motion.h
Motor motor.h
MpiDef mpidef.h
Node node.h
Notify notify.h
Object object.h
Recorder recorder.h
Sequence sequence.h
Sercos sercos.h
StdMpi stdmpi.h
XMP Module Header
Client client.h
Element element.h
Firmware firmware.h
Flash flash.h
List list.h
Map map.h
MeiDef meidef.h
Packet packet.h
Platform platform.h
Remove remove.h
RipTide riptide.h
Server server.h
Trace trace.h
XMP xmp.h

Utility Module Header
msgCHECK msg.h
Service service.h
Log log.h
LogFunc logFunc.h


Example The axis module consists of a source file called axis.c and a header file called axis.h. The axis.c source file contains the definitions of all Axis code and data symbols, in particular the Axis object data structure. The axis.h header file contains the declarations for the code and data symbols in axis.c.