SPRUHJ1I January 2013 – October 2021 TMS320F2802-Q1 , TMS320F28026-Q1 , TMS320F28026F , TMS320F28027-Q1 , TMS320F28027F , TMS320F28027F-Q1 , TMS320F28052-Q1 , TMS320F28052F , TMS320F28052F-Q1 , TMS320F28052M , TMS320F28052M-Q1 , TMS320F28054-Q1 , TMS320F28054F , TMS320F28054F-Q1 , TMS320F28054M , TMS320F28054M-Q1 , TMS320F2806-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28068F , TMS320F28068M , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M-Q1
This should be done in the main function of the project ahead of the forever loop. This will load all of the default values into SpinTAC Position Move. This step can be completed by running the functions ST_init and ST_setupPosMove that are declared in the spintac_position.h header file. If you do not wish to use these two functions, the code example below can be used to configure the SpinTAC Position Move component. This configuration of SpinTAC Position Move represents the typical configuration that should work for most motors.
// Initialize the SpinTAC Speed Controller Component
stPosMoveHandle = STPOSMOVE_init(&stPosMove, sizeof(stPosMove));
// Instance of SpinTAC Move
STPOSMOVE_setAxis(stPosMoveHandle, ST_AXIS0);
// Sample time [s], (0, 1]
STPOSMOVE_setSampleTime_sec(stPosMoveHandle, _IQ24(ST_SAMPLE_TIME));
// Set the type of profile to generate {ST_POS_MOVE_VEL_TYPE , ST_POS_MOVE_POS_TYPE}
STPOSMOVE_setProfileType(stPosMoveHandle, ST_POS_MOVE_POS_TYPE);
// Set the maximum value for mechanical revolutions before rollover [MRev]
STPOSMOVE_setMRevMaximum_mrev(stPosMoveHandle, _IQ24(10.0));
// Set the unit conversion values, this will convert between Mrev and pu
STPOSMOVE_setUnitConversion(stPosMoveHandle, USER_IQ_FULL_SCALE_FREQ_Hz,
USER_MOTOR_NUM_POLE_PAIRS);
// System maximum limit for:
// speed [pu/s] [IQ24(0.002), _IQ24(1)]
// acceleration [pu/s^2] [IQ24(0.001), _IQ24(120)]
// deceleration [pu/s^2] [IQ24(0.001), _IQ24(120)]
// jerk references [pu/s^3] [_IQ20(0.0005), _IQ20(2000)]
STPOSMOVE_setProfileMaximums(obj->posMoveHandle,
_IQ24(USER_MOTOR_MAX_SPEED_KRPM * ST_SPEED_PU_PER_KRPM),
_IQ24(10), _IQ24(10), _IQ20(62.5));
// Velocity limit for the profile [pu/s] [IQ24(0.002), _IQ24(1)]
STPOSMOVE_setVelocityLimit(obj->posMoveHandle,
_IQ24(USER_MOTOR_MAX_SPEED_KRPM * ST_SPEED_PU_PER_KRPM));
// Acceleration limit for the profile [pu/s^2] [IQ24(0.001), _IQ24(120)]
STPOSMOVE_setAccelerationLimit(stPosMoveHandle, _IQ24(0.4));
// Deceleration limit for the profile [pu/s^2] [IQ24(0.001), _IQ24(120)]
STPOSMOVE_setDecelerationLimit(obj->posMoveHandle, _IQ24(0.4));
// Jerk limit for the profile [pu/s^3] [_IQ20(0.0005), _IQ20(2000)]
STPOSMOVE_setJerkLimit(stPosMoveHandle, _IQ20(1.0));
// Set profile curve type { ST_MOVE_CUR_TRAP, ST_MOVE_CUR_SCRV, ST_MOVE_CUR_STCRV }
STPOSMOVE_setCurveType(stPosMoveHandle, ST_MOVE_CUR_STCRV);
// ST_PosMove is not in test mode
STPOSMOVE_setTest(stPosMoveHandle, false);
// Initially ST_PosMove is not enabled
STPOSMOVE_setEnable(stPosMoveHandle, false);
// Initially ST_PosMove is not in reset
STPOSMOVE_setReset(stPosMoveHandle, false);