Chapter 13 Torque Control
NI-Motion User Manual 13-6 ni.com
err = flex_load_acceleration(boardID, axis,
NIMC_DECELERATION, 100000, 0xFF);
CheckError;
// Set the jerk - s-curve time (in sample periods)
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 corresponding to the voltage which
you want the //motor to maintain (2047 ~ 5V in this
example)
err = flex_load_target_pos (boardID, axis, 2047,
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
axis 1
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;