MPIControl mpiControlCreate(MPIControlType     type,
                            MPIControlAddress  *address)

Required Header: stdmpi.h


mpiControlCreate creates a Control object of the specified type and type-specific address. ControlCreate is the equivalent of a C++ constructor.

The type parameter determines the form of the address parameter:

If the "type" parameter is
Then the form of the "address" parameter is
MPIControlTypeDEFAULT implementation-specific
MPIControlTypeMAPPED MPIControlAddress.mapped
MPIControlTypeDEVICE MPIControlAddress.device
MPIControlTypeCLIENT MPIControlAddress.client


This constructor does not reset or initialize the motion control device.

MPIControlType is

MPIControlAddress is
Then the
Board Number
And the
"address" parameter

to be used is

default address parameter
default address parameter


default device driver
address.type.device (if address.type.device is Null, then default device driver)
CLIENT address specified by server address.type.client
(NOTE: address.number should be set to zero)
  1. If the type is DEFAULT, then the address structure (if supplied) is referenced only for the board number. Note that even if the default type is DEVICE, the default device driver will be used and address.type.device will not be used.
  2. If the type is explicitly DEVICE, and the address is provided, then address.number will be used. If address.type.device is NULL, then the default device driver will be used. If address.type.device is not NULL, then the specified driver (DEVICE) will be used.
Return Values
handle to a Control object
MPIHandleVOID if the object could not be created

Sample Code

Example #1
In general, if the caller specifies an explicit type (i.e., not DEFAULT), then the caller must
completely fill out the address.type structure.

A simple case that will work for almost anyone who wants to use board #0:

mpiControlCreate(MPIControlTypeDEFAULT, NULL); Example #2 A simple case where board #1 is desired is:
MPIControl control;
MPIControlAddress address; address.number = 1; control = mpiControlCreate(MPIControlTypeDEFAULT, &address); }

Since the default MPIControlType = MPIControlTypeDEVICE, the address may be on the 
stack with garbage for the device driver name. This isn't a problem, however, because
the board number is the only field in address that will be used when the caller specifies
the DEFAULT MPIControlType. Example #3
/* To remotely connect via client / server, you need to run server.exe on your PC that has your XMP / ZMP in it.
If you are using an eXMP, run server on your eXMP. This code will connect to that instance of server.exe. */

MPIControl control;
MPIControlAddress address; /* Change this to the ip address of the computer that has your XMP in it. */
address.type.client.server = "";
/* Port 3300 is the default port for client / server */
address.type.client.port = 3300;
address.number = 0; control = mpiControlCreate(MPIControlTypeCLIENT, &address);

See Also

MPIControl | MPIControlAddress | MPIControlType | mpiControlValidate
mpiControlInit | mpiControlDelete



       Legal Notice  |  Tech Email  |  Feedback
Copyright ©
2001-2010 Motion Engineering