MPI 04.00 Reference >> mpiMotor
mpiMotorMemoryGet
Declaration
int32_t mpiMotorMemoryGet(MPIMotor motor, void *dst, const void *src, int32_t count)
Required Header: stdmpi.h
Change History: Modified in the 03.03.00
Description
mpiMotorMemoryGet copies count bytes of a Motor's (motor) memory (starting at address src) to application memory (starting at address dst).
Return Values | |
---|---|
MPIMessageOK |
Sample Code
/* motorDemandGet(...) demonstrates how to read the primary and auxiliary motor demand signals. mpiMotorMemory(...) obtains the motor control memory pointer. The pointer's address is then passed into mpiMotorMemoryGet(...) to obtain the demand values. Note: MPIXmpMotor *memory must be casted as (void *) in mpiMotorMemory. */ int32_t motorDemandGet(MPIMotor motor, float *primary, float *aux) { MPIXmpMotor *memory; int32_t returnValue; /* Get motor control memory pointer */ returnValue = mpiMotorMemory(motor, (void *)&memory); /* Get primary motor demand value */ if(returnValue == MPIMessageOK) { returnValue = mpiMotorMemoryGet(motor, primary, &memory->IO.Demand.Channel[0].Level, sizeof(memory->IO.Demand.Channel[0].Level)); } /* Get auxiliary motor demand value */ if(returnValue == MPIMessageOK) { returnValue = mpiMotorMemoryGet(motor, aux, &memory->IO.Demand.Channel[1].Level, sizeof(memory->IO.Demand.Channel[1].Level)); } return returnValue; }