meiCanCreate
Declaration
|
MEICan meiCanCreate(MPIControl control,
long number); |
|
Required Header: stdmei.h
Change History: Modified in the 03.02.00 |
Description
meiCanCreate creates a CAN object handle that is used subsequently to address
the CAN network on this controller. You will need a valid
CAN handle to use the MPI's CANOpen functionality.
|
control |
a handle to the controller object that contains the CAN object. |
number |
the number of the CAN network on the specified controller. For most controllers with a single CAN network interface this will be zero. Network numbers are zero based. |
|
|
|
|
Return Values |
|
handle |
Handle to the CAN object created or MPIHandleVOID. |
MPIHandleVOID |
if the object could not be created |
|
Sample Code
The following sample code shows the creation and
destruction of a valid CAN handle.
|
MPIControl ControlHandle;
MEICan CANHandle;
long Result;
/* Create, validate and initalise a handle to the controller. */
ControlHandle = mpiControlCreate( MPIControlTypeDEFAULT, NULL );
Result = mpiControlValidate( ControlHandle );
assert( Result == MPIMessageOK );
Result = mpiControlInit( ControlHandle );
assert( Result == MPIMessageOK );
/* Create and validate a handle to the CAN object. */
CANHandle = meiCanCreate( ControlHandle, 0 );
Result = meiCanValidate( CANHandle );
assert( Result == MPIMessageOK );
/* Use the CAN object here */
/* Delete the CAN and Controller objects */
Result = meiCanDelete( CANHandle );
assert( Result == MPIMessageOK );
Result = mpiControlDelete( ControlHandle );
assert( Result == MPIMessageOK ); |
See Also
mpiCanDelete | mpiCanValidate
|