|
|
Description |
ControlCreate 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 |
MPIControlTypeIOPORT |
MPIControlAddress.ioPort |
MPIControlTypeDEVICE |
MPIControlAddress.device |
MPIControlTypeCLIENT |
MPIControlAddress.client |
|
Note: |
This constructor does not reset or initialize the
motion control device. |
|
About MPIControlTypes:
If MPIControlType is |
And MPIControlAddress is |
Then the
Board Number is |
And the
"address" parameter
to be used is |
DEFAULT1
|
Null
address |
0
address.number |
default address parameter
default address parameter |
DEVICE2
|
Null
address
|
0
address.number |
default device driver
address.type.device (if address.type.device is Null, then default
device driver) |
A valid type |
address |
address.number |
N/A
(if address parameter is not defined or Null, then an error is generated)
|
|
- 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.
- 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.
|
Sample Code
|
|
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);
A simple case where board #1 is desired is:
{
MPIControlAddress address;
address.number = 1;
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.
|
|
|
Return Values |
handle |
to a Control object |
MPIHandleVOID |
if the object could not
be created |
|
|