Chapter 5 Straight-Line Moves
NI-Motion User Manual 5-8 ni.com
// Configure a 2D vector space comprised of axes 1
and 2
err = flex_config_vect_spc(boardID, vectorSpace, 1,
2, 0);
CheckError;
// Set the velocity for the move (in counts/sec)
err = flex_load_velocity(boardID, vectorSpace,
10000, 0xFF);
CheckError;
// Set the acceleration for the move (in
counts/sec^2)
err = flex_load_acceleration(boardID, vectorSpace,
NIMC_ACCELERATION, 100000, 0xFF);
CheckError;
// Set the deceleration for the move (in
counts/sec^2)
err = flex_load_acceleration(boardID, vectorSpace,
NIMC_DECELERATION, 100000, 0xFF);
CheckError;
// Set the jerk - scurve time (in sample periods)
err = flex_load_scurve_time(boardID, vectorSpace,
1000, 0xFF);
CheckError;
// Set the operation mode
err = flex_set_op_mode (boardID, vectorSpace,
NIMC_ABSOLUTE_POSITION);
CheckError;
// Load vector space position
err = flex_load_vs_pos (boardID, vectorSpace,
5000/*x Position*/, 10000/*y Position*/, 0/* z
Position*/, 0xFF);
CheckError;
// Start the move
err = flex_start(boardID, vectorSpace, 0);
CheckError;
do
{
axisStatus = 0;
// Check the move complete status
err = flex_check_move_complete_status(boardID,
vectorSpace, 0, &moveComplete);