.

mpiMotionStatus

Declaration

 
long mpiMotionStatus(MPIMotion  motion,
                     MPIStatus  *status,
                     void       *external) 
 

Required Header: stdmpi.h

Description

mpiMotionStatus gets a Motion's (motion) status and writes it to the structure pointed to by status, and also writes it into the implementation-specific structure pointed to by external (if external is not NULL).

Remarks

external should always be set to NULL.

 
motion a handle to a Motion object
*status a pointer to MPIStatus structure
*external a pointer to an implementation-specific structure
   
 
Return Values
MPIMessageOK  
MPIMessageARG_INVALID  

Sample Code


/* Poll for amp fault, motion done, at velocity on a particular motion supervisor */
while(meiPlatformKey(MPIWaitPOLL) <= 0)
{
    returnValue = mpiMotionStatus(motion, &status, NULL);
    msgCHECK(returnValue);

    /*
    The ...maskBitGET will return a 0 or the mask. It is simpler to look
    for a not false than the mask.
    */

    if(mpiEventMaskBitGET(status.eventMask, MPIEventTypeMOTION_DONE) != FALSE)
    {
        printf("\rMotion Done TRUE ");
    }
    else
    {
        printf("\rMotion Done FALSE");
    }
    if(mpiEventMaskBitGET(status.eventMask, MPIEventTypeMOTION_AT_VELOCITY) != FALSE)
    {
        printf(" At Velocity TRUE ");
    }
    else
    {
        printf(" At Velocity FALSE");
    }
    if(mpiEventMaskBitGET(status.eventMask, MPIEventTypeAMP_FAULT) != FALSE)
    {
        printf(" Amp Fault TRUE ");
    }
    else
    {
        printf(" Amp Fault FALSE");
    }
        meiPlatformSleep(100); /* Wait to keep low CPU usage */
    }

See Also

MPIStatus | MPIEventType

 

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