.

mpiMotorMemorySet

Declaration

long mpiMotorMemorySet(MPIMotor    motor,
                       void        *dst,
                       const void  *src,
                       long        count)
  Required Header: stdmpi.h
Change History: Modified in the 03.03.00

Description

mpiMotorMemorySet copies count bytes of application memory (starting at address src) to a Motor's (motor) 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: 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 | mpiMotorMemory

 

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