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 ISR. This function needs to be called at the proper decimation rate for this component. The decimation rate is established by ISR_TICKS_PER_SPINTAC_TICK; for more information, see Section 5.7.1.4. Before calling SpinTAC Position Control function the position reference, speed reference, acceleration reference, and position feedback must be updated. This example uses SpinTAC Position Move to provide the references to the SpinTAC Position Control. For more information on SpinTAC Position Move, see Section 14.
CTRL_Obj *obj = (CTRL_Obj *)ctrlHandle; // Get pointer to CTRL object
// Get the mechanical speed in pu/s
_iq speedFeedback = EST_getFm_pu(obj->estHandle);
STPOSCTL_setPositionReference_mrev(stPosCtlHandle,
STPOSMOVE_getPositionReference_mrev(stPosMoveHandle));
// Update the Velocity Reference
STPOSCTL_setVelocityReference(stPosCtlHandle,
STPOSMOVE_getVelocityReference(stPosMoveHandle));
// Update the Acceleration Reference
STPOSCTL_setAccelerationReference(stPosCtlHandle,
STPOSMOVE_getAccelerationReference(stPosMoveHandle));
// Update the Position Feedback
STPOSCTL_setPositionFeedback_mrev(stObj->posCtlHandle,
STPOSCONV_getPosition_mrev(stPosConvHandle));
// Run SpinTAC Position Control
STPOSCTL_run(stPosCtlHandle);
// Get the Torque Reference from SpinTAC Position Control
iqReference = STPOSCTL_getTorqueReference(stPosCtlHandle);
// Set the Iq reference that came out of SpinTAC Position Control
CTRL_setIq_ref_pu(ctrlHandle, iqReference);