Chapter 10 Electronic Gearing and Camming
NI-Motion User Manual 10-6 ni.com
// Set the board ID
boardID = 1;
// Set the axis number
slaveAxis = NIMC_AXIS1;
// Master is encoder 4
master = NIMC_ENCODER4;
////////////////////////////////
// Set up the gearing configuration for the slave
axis
err = flex_config_gear_master(boardID, slaveAxis,
master);
CheckError;
//Load Gear Ratio 3:2
err = flex_load_gear_ratio(boardID, slaveAxis,
NIMC_RELATIVE_GEARING, 3/* ratioNumerator*/, 2/*
ratioDenominator*/, 0xFF);
CheckError;
//-------------------------------------------------
// Enable gearing on slave axis
//-------------------------------------------------
err = flex_enable_gearing_single_axis (boardID,
slaveAxis, NIMC_TRUE);
CheckError;
// Wait for 5,000 ms (5 seconds)
Sleep(5000);
//-------------------------------------------------
// Set up the move parameters for the superimposed
move
//-------------------------------------------------
// Set the operation mode to relative
err = flex_set_op_mode(boardID, slaveAxis,
NIMC_RELATIVE_POSITION);
CheckError;
// Load velocity in counts/s
err = flex_load_velocity(boardID, slaveAxis, 10000,
0xFF);
CheckError;
// Load acceleration and deceleration in counts/s^2
err = flex_load_acceleration(boardID, slaveAxis,
NIMC_BOTH, 100000, 0xFF);
CheckError;