ZHCU083I 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
这应该在死循环之前的项目主函数中完成。这样会将所有的默认值加载到 SpinTAC 速度移动中。该步骤可通过运行已在 spintac_velocity.h 头文件中声明的函数 ST_init 和 ST_setupVelMove 来完成。如果不希望使用这两个函数,可使用下方的代码示例配置 SpinTAC 速度移动组件。SpinTAC 速度移动配置是典型配置的代表,适用于大部分电机。
// Initialize the SpinTAC Velocity Move Component
stVelMoveHandle = STVELMOVE_init(&stVelMove, sizeof(ST_VelMove_t));
// Instance of SpinTAC Velocity Move
STVELMOVE_setAxis(stVelMoveHandle, ST_AXIS0);
// Sample time [s], (0, 1]
STVELMOVE_setSampleTime_sec(stVelMoveHandle, _IQ24(ST_SAMPLE_TIME));
// System maximum limit for:
// speed [pu/s] [IQ24(0.001), _IQ24(1)],
// acceleration [pu/s^2] [IQ24(0.002), _IQ24(120)],
// jerk references [pu/s^3] [_IQ20(0.0005), IQ20(2000)]
STVELMOVE_setProfileMaximums(stVelMoveHandle, _IQ24(1.0), _IQ24(10.0), _IQ20(62.5));
// Acceleration limit for the profile [pu/s^2] [IQ24(0.001), _IQ24(120)]
STVELMOVE_setAccelerationLimit(stVelMoveHandle, _IQ24(0.4));
// Jerk limit for the profile [pu/s^3] [_IQ20(0.0005), _IQ20(2000)]
STVELMOVE_setJerkLimit(stVelMoveHandle, _IQ20(1.0));
// Set profile curve type { ST_MOVE_CUR_TRAP, ST_MOVE_CUR_SCRV, ST_MOVE_CUR_STCRV }
STVELMOVE_setCurveType(stVelMoveHandle, ST_MOVE_CUR_STCRV);
// ST_VelMove is not in test mode
STVELMOVE_setTest(stVelMoveHandle, FALSE);
// Initially ST_VelMove is not enabled
STVELMOVE_setEnable(stVelMoveHandle, FALSE);
// Initially ST_VelMove is not in reset
STVELMOVE_setReset(stVelMoveHandle, FALSE);