Chapter 5 Straight-Line Moves
© National Instruments Corporation 5-21 NI-Motion User Manual
// Set the deceleration for the move (in
counts/sec^2)
err = flex_load_acceleration(boardID, axis,
NIMC_DECELERATION, 100000, 0xFF);
CheckError;
// Set the jerk (s-curve value) for the move (in
sample periods)
err = flex_load_scurve_time(boardID, axis, 100,
0xFF);
CheckError;
// Set the operation mode to velocity
err = flex_set_op_mode(boardID, axis,
NIMC_VELOCITY);
CheckError;
// Start the move
err = flex_start(boardID, axis, 0);
CheckError;
// Wait for the time for first 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 first //segment
currentTime = timeGetTime();
if((currentTime - initialTime) >= moveTime1)
break;
Sleep (100); //Check every 100 ms