MPI 04.00 Reference >> mpiMotion

mpiMotionMemoryGet

Declaration

int32_t mpiMotionMemoryGet(MPIMotion   motion,
                        void        *dst,
                        const void  *src,
                        int32_t        count) 

Required Header: stdmpi.h
Change History: Modified in the 03.03.00

Description

mpiMotionMemoryGet copies count bytes of a Motion's (motion) memory (starting at address src) to application memory (starting at address dst).

Return Values
MPIMessageOK

Sample Code

/* motionFeedRateGet(...) demonstrates how to read the 
current feedrate on a motion object directly through memory. 
mpiMotionMemory(...) obtains the motion control memory pointer. 
The pointer's address is then passed into mpiMotionMemoryGet(...)
to obtain the rate. 
*/

int32_t motionFeedRateGet(MPIMotion    motion,
                       double       *feedRate)
{
   MFWMotionSupervisorData *dataMemory;
   int32_t                    returnValue;

   /* Get MS control memory pointer */
   returnValue =
      mpiMotionMemory(motion, 
                      NULL, 
                      &dataMemory);

   /* Get MS FeedRate value */
   if(returnValue == MPIMessageOK)
   {
      returnValue = 
         mpiMotionMemoryGet(motion,
                            Vel,
                            &dataMemory->FeedRate.Current,
                            sizeof(&dataMemory->FeedRate.Current));
   }
   return returnValue;
}

See Also

mpiMotionMemorySet | mpiMotionMemory