National Instruments NI-Motion Home Safety Product User Manual


 
Chapter 5 Straight-Line Moves
NI-Motion User Manual 5-6 ni.com
err = flex_load_scurve_time(boardID, axis, 1000,
0xFF);
CheckError;
// Set the operation mode
err = flex_set_op_mode (boardID, axis,
NIMC_ABSOLUTE_POSITION);
CheckError;
// Load Position
err = flex_load_target_pos (boardID, axis, 5000,
0xFF);
CheckError;
// Start the move
err = flex_start(boardID, axis, 0);
CheckError;
do
{
axisStatus = 0;
// Check the move complete status
err = flex_check_move_complete_status(boardID,
axis, 0, &moveComplete);
CheckError;
// Check the following error/axis off status for
the axis
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;
}
}while (!moveComplete && !(axisStatus &
NIMC_FOLLOWING_ERROR_BIT) && !(axisStatus &
NIMC_AXIS_OFF_BIT));
//Exit on move complete/following error/axis off
return;// Exit the Application