National Instruments NI-Motion User Manual page 247

Motion control
Table of Contents

Advertisement

Chapter 14
Onboard Programs
err = flex_load_rpsps(boardID, axis, NIMC_BOTH,
50.00, 0xFF);
CheckError;
// Start the move
err = flex_start(boardID, axis, 0);
CheckError;
// Wait for move to complete
err = flex_wait_on_event(boardID, 0, NIMC_WAIT,
NIMC_CONDITION_MOVE_COMPLETE, 2/*Indicates axis 1*/,
0, NIMC_MATCH_ALL, 1000 /*time out*/, 0);
CheckError;
// End Program Storage
err = flex_end_store(boardID, 2);
CheckError;
//------------------------------------------------
// Onboard program 3. This onboard program moves axis
one counter //clockwise 5000 counts (steps). This
onboard program is executed //by onboard program one.
//------------------------------------------------
// Begin onboard program storage - program number 3
err = flex_begin_store(boardID, 3);
CheckError;
// Set the operation mode to relative
err = flex_set_op_mode(boardID, axis,
NIMC_RELATIVE_POSITION);
CheckError;
// Load Target Position to move counter clockwise
5000 //counts(steps)
err = flex_load_target_pos(boardID, axis, -5000,
0xFF);
CheckError;
// Load Velocity in RPM
err = flex_load_rpm(boardID, axis, 100.00, 0xFF);
CheckError;
// Load Acceleration and Deceleration in RPS/sec
err = flex_load_rpsps(boardID, axis, NIMC_BOTH,
50.00, 0xFF);
CheckError;
// Start the move
err = flex_start(boardID, axis, 0);
© National Instruments Corporation
14-39
NI-Motion User Manual

Advertisement

Table of Contents
loading

Table of Contents