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 Convert. This step can be completed by running the functions ST_init and ST_setupPosConv that are declared in the spintac_velocity.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 Converter. This configuration of SpinTAC Position Converter represents the typical configuration that should work for most motors.
// init the ST PosConv object
stPosConvHandle = STPOSCONV_init(&stPosConv, sizeof(stPosConv));
// Setup the SpinTAC Position Converter
// Sample time [s], (0, 1]
STPOSCONV_setSampleTime_sec(stPosConvHandle, _IQ(ST_SPEED_SAMPLE_TIME));
// The upper [0, 16] and lower [-16, 0] bounds of the input position signal [ERev]
STPOSCONV_setERevMaximums_erev(stPosConvHandle, _IQ(1.0), 0);
// Sets the unit conversions used in the SpinTAC Position Converter
STPOSCONV_setUnitConversion(stPosConvHandle, USER_IQ_FULL_SCALE_FREQ_Hz,
ST_SAMPLE_TIME, USER_MOTOR_NUM_POLE_PAIRS);
// The Rollover bound of the output position signal [MRev]
STPOSCONV_setMRevMaximum_mrev(stPosConvHandle, _IQ(10.0));
// Low-pass time constant [tick]
STPOSCONV_setLowPassFilterTime_tick(stPosConvHandle, 3);
// ST_PosConv should start enabled
STPOSCONV_setEnable(stPosConvHandle, true);
// ST_PosConv should not be in reset
STPOSCONV_setReset(stPosConvHandle, false);