Chapter 9
Blending Moves
9-8
ni.com
err =
flex_set_op_mode
(boardID, vectorSpace,
NIMC_ABSOLUTE_POSITION);
CheckError;
//
Load the first straight-line segments to position
5000, 5000
err =
flex_load_vs_pos
(boardID, vectorSpace, 5000,
5000, 0, 0xFF);
CheckError;
//
Start the move
err =
flex_start
(boardID, vectorSpace, 0);
CheckError;
//
Load Circular Arc - making a counter
-
clockwise
semi-circle
err =
flex_load_circular_arc
(boardID, vectorSpace,
5000/*radius*/, 0.0/*startAngle*/,
180.0/*travelAngle*/, 0xFF);
CheckError;
//
Blend the move
err =
flex_blend
(boardID, vectorSpace, 0);
CheckError;
//
Wait for blend to complete before loading the next
segment
do
{
axisStatus = 0;
//
Check the blend complete status
err =
flex_check_blend_complete_status
(boardID,
vectorSpace, 0, &complete);
CheckError;
//
Check the following error/axis off status for axis
1
err =
flex_read_axis_status_rtn
(boardID,
NIMC_AXIS1, &status);
CheckError;
axisStatus |= status;
//
Check the following error/axis off status for axis
2
err =
flex_read_axis_status_rtn
(boardID,
NIMC_AXIS2, &status);
CheckError;
axisStatus |= status;
//
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)