Chapter 16 Rotating Knife
NI-Motion User Manual 16-6 ni.com
// Set the axis number
slaveAxis = NIMC_AXIS1;
// Master is encoder 4
master = NIMC_ENCODER4;
////////////////////////////////
//-------------------------------------------------
// Set up the gearing configuration for the slave axis
//-------------------------------------------------
// Configure Gear Master
err = flex_config_gear_master(boardID, slaveAxis,
master);
CheckError;
//Load Gear Ratio 1:1
err = flex_load_gear_ratio(boardID, slaveAxis,
NIMC_ABSOLUTE_GEARING, 1/*ratioNumerator*/,
1/*ratioDenominator*/, 0xFF);
CheckError;
//-------------------------------------------------
// Set up the move parameters for the superimposed move
// to be done on registration
//------------------------------------------------
// Set the operation mode to relative
err = flex_set_op_mode(boardID, slaveAxis,
NIMC_RELATIVE_TO_CAPTURE);
CheckError;
// Load Velocity in RPM
err = flex_load_rpm(boardID, slaveAxis, 100.00, 0xFF);
CheckError;
// Load Acceleration and Deceleration in RPS/sec
err = flex_load_rpsps(boardID, slaveAxis, NIMC_BOTH,
50.00, 0xFF);
CheckError;
//-------------------------------------------------
// Enable Gearing on slave axis
//-------------------------------------------------
err = flex_enable_gearing_single_axis (boardID,
slaveAxis, NIMC_TRUE);
CheckError;
//-------------------------------------------------
// Wait for trigger to do the registration move
//-------------------------------------------------
for(;;){
// Enable high-speed capture for slave axis
err = flex_enable_hs_capture(boardID, slaveAxis,
NIMC_TRUE);
CheckError;
do