MPIEventMotorData

Declaration

typedef struct MPIEventMotorData {
   unsigned int32_t    dedicatedIn;
   unsigned int32_t    generalIn;
   unsigned int32_t    generalOut;
   MPIInt64         feedback[MPIMotorFeedbackInputCOUNT];
   double           demand[MPIMotorDemandChannelCOUNT];
} MPIEventMotorData;

Required Header: stdmpi.h

Change History: Added in 04.00.

Description

MPIEventMotorData holds information about a motor event generated on the controller.

dedicatedIn The bit-mask holding the i/o values of the motor dedicated digital inputs when the event occurred.
generalIn The bit-mask holding the i/o values of the motor general-purpose digital inputs when the event occurred.
generalOut The bit-mask holding the i/o values of the motor general-purpose digital outputs when the event occurred.
encoderPosition The encoder positions of the motor when the event occurred.
demand The demand channels of the motor object when the event occurred.

Sample Code

MPI_RESULT MPI_DECL2
    myMotorEventCallback(MPIControl control, const MPIEventData* status, void* userData)
{
    /* print event information to the screen. */

    printf("%s event occurred at controller sample %d.\n"
           "  Dedicated Inputs        = 0x%x\n"
           "  General-Purpose Inputs  = 0x%x\n"
           "  General-Purpose Outputs = 0x%x\n"
           "  Primary Encoder         = %f\n"
           "  Auxiliary Encoder       = %f\n",
        mpiEventTypeName(status->eventType),
        status->data.sampleCounter,
        status->data.motor.dedicatedIn,
        status->data.motor.generalIn,
        status->data.motor.generalOut,
        (double) status->data.motor.encoderPosition[0],
        (double) status->data.motor.encoderPosition[1]);
}

See Also

MPIEventData