Chapter 5 Straight-Line Moves
NI-Motion User Manual 5-22 ni.com
}while (!(axisStatus) && !(axisStatus &
NIMC_FOLLOWING_ERROR_BIT) && !(axisStatus &
NIMC_AXIS_OFF_BIT)); //Exit on move
//complete/following error/axis off
//-------------------------------------------------
// Second segment
//-------------------------------------------------
//Change the velocity to 80% of the initially loaded
value
err = flex_load_velocity_override(boardID, axis, 80,
0xFF);
CheckError;
// Wait for the time for second segment
initialTime = timeGetTime();
do
{
// Check the following error/axis off status
err = flex_read_axis_status_rtn(boardID, axis,
&axisStatus);
CheckError;
// Read the communication status register and
check the modal //errors
err = flex_read_csr_rtn(boardID, &csr);
CheckError;
// Check the modal errors
if (csr & NIMC_MODAL_ERROR_MSG)
{
err = csr & NIMC_MODAL_ERROR_MSG;
CheckError;
}
// Get the current time and check if time is over
for the second //segment
currentTime = timeGetTime();
if((currentTime - initialTime) >= moveTime2)
break;
Sleep (100); //Check every 100 ms
}while (!(axisStatus) && !(axisStatus &
NIMC_FOLLOWING_ERROR_BIT) && !(axisStatus &
NIMC_AXIS_OFF_BIT)); //Exit on move
complete/following error/axis off
// Decelerate the axis to a stop