.

mpiMotorMemory

Declaration

long mpiMotorMemory(MPIMotor  motor,
                    void      **memory) 
  Required Header: stdmpi.h

Description

mpiMotorMemory sets (writes) an address (used to access a Control object's memory) to the contents of memory.

 
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: MEIXmpMotor *memory must be casted as (void *) in 
mpiMotorMemory.
*/

long motorDemandGet(MPIMotor  motor, 
                    float     *primary, 
                    float     *aux)
{


    MEIXmpMotor    *memory;
    long           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;
}

 

See Also

mpiMotorMemoryGet | mpiMotorMemorySet

 

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