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
The following is a list of commonly used SpinTAC functions. This section is provided as a reference. Prior to the implementation of a component, the corresponding section of this document should be read.
void STVELCTL_run(ST_VELCTL_Handle)
Function: This function runs SpinTAC Velocity Control.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELCTL_Handle | handle | The handle to the ST_VelCtl_t datatype |
void STVELMOVE_run(ST_VELMOVE_Handle)
Function: This function runs SpinTAC Velocity Move.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELMOVE_Handle | handle | The handle to the ST_VelMove_t datatype |
void STVELID_run(ST_VELID_Handle)
Function: This function runs SpinTAC Velocity Identify.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELID_Handle | handle | The handle to the ST_VelId_t datatype |
void STVELPLAN_run(ST_VELPLAN_Handle)
Function: This function runs SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
void STVELPLAN_runTick(ST_VELPLAN_Handle)
Function: This function runs SpinTAC Velocity Plan Timer. Must run from an ISR.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
void STVELPLAN_addCfgAct(ST_VELPLAN_Handle, uint16_t, ST_PlanCond_e , uint16_t , uint16_t, uint16_t, ST_PlanActOptn_e, _iq24, ST_PlanActTrgr_e)
Function: This function adds an action to SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | uint16_t | StateIdx | The index of the state in which the action to be executed |
3 | ST_PlanCond_e | AndOr | ST_COND_NC: act without condition; ST_COND_FC: act when the first condition satisfied; ST_COND_AND: act when both conditions satisfied; ST_COND_OR: act when either condition satisfied; |
4 | uint16_t | CondIdx1 | The index of the first condition |
5 | uint16_t | CondIdx2 | The index of the second condition |
6 | uint16_t | VarIdx | The index of the variable to be operated |
7 | ST_PlanActOptn_e | Opt | ST_ACT_EQ: set the value to the variable ST_ACT_QDD: add the value to the variable |
8 | _iq24 | Value | The value to be set to the variable or added to the variable |
9 | ST_PlanActTrgr_e | EnterExit | ST_ACT_ENTR: execute the action when entering the state ST_ACT_EXIT: execute the action when exiting the state |
void STVELPLAN_setCfgArray(ST_VELPLAN_Handle, uint32_t *, const size_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)
Function: This function adds an action to SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | uint32_t * | cfgArray | Pointer to cfgArray used for Plan configuration. |
3 | const size_t | numBytes | The number of bytes allocated to the cfgArray array. Get number of bytes by calling sizeof(cfgArray) |
4 | uint16_t | MaxActNum | Number of Actions |
5 | uint16_t | MaxCondNum | Number of Conditions |
6 | uint16_t | MaxVarNum | Number if Variables |
7 | uint16_t | MaxTranNum | Number of Transitions |
8 | uint16_t | MaxStateNum | Number of States |
ST_VELPLAN_Handle STVELPLAN_init (void *, const size_t)
Function: This function initializes SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | void * | pMemory | The pointer to the memory for a ST_VelPlan_t object |
2 | const size_t | numBytes | The number of bytes allocated to the ST_VelPlan_t object |
Return: The ST_VelPlan_t object handle
void STVELPLAN_addCfgCond(ST_VELPLAN_Handle, uint16_t, ST_PlanComp_e, _iq24, _iq24)
Function: This function adds a condition to SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | uint16_t | VarIdx | The index of the variable to be compared |
3 | ST_PlanComp_e | Comp | ST _COMP_NA: Not defined; ST _COMP_EQ: equal to Value1; ST _COMP_NEQ: not equal to Value1; ST__COMP_GT: greater than Value1; ST_COMP_EGT: equal to or greater than Value1; ST_COMP_LW: lower than Value1; ST_COMP_ELW: equal to or lower than; ST_COMP_In: belong to the range of (Value1, Value2); ST_COMP_Ein: belong to the range of [Value1, Value2); ST_COMP_InE: belong to the range of (Value1, Value2]; ST_COMP_EinE: belong to the range of [Value1, Value2]; ST_COMP_Out: not belong to the range of [Value1, Value2]; ST_COMP_Eout: not belong to the range of (Value1, Value2]; ST_COMP_OutE: not belong to the range of [Value1, Value2); ST_COMP_EoutE: not belong to the range of (Value1, Value2) |
4 | _iq24 | Value1 | The first value |
5 | _iq24 | Value2 | The second value |
void STVELPLAN_addCfgVarCond ST_VELPLAN_Handle, uint16_t, uint16_t, ST_PlanComp_e)
Function: This function adds a condition that compares two variables to SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | uint16_t | VarIdx1 | The index of the first variable to be compared |
3 | uint16_t | VarIdx2 | The index of the second variable to be compared |
4 | ST_PlanComp_e | Comp | ST _COMP_NA: Not defined; ST _COMP_EQ: equal to Value1; ST _COMP_NEQ: not equal to Value1; ST__COMP_GT: greater than Value1; ST_COMP_EGT: equal to or greater than Value1; ST_COMP_LW: lower than Value1; ST_COMP_ELW: equal to or lower than; |
void STVELPLAN_setCfgHaltState(ST_VELPLAN_Handle, _iq24, _iq24, _iq20, int32_t)
Function: This function adds a state to SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | _iq24 | VelEnd | Velocity set point for the HALT state |
3 | _iq24 | AccLim | Acceleration limit for the HALT state |
4 | _iq20 | JrkLim | Jerk limit for the HALT state |
5 | int32_t | Timer | Timer in [Count] to indicate how long to stay in the HALT state before further operation |
void STVELPLAN_setCfg(ST_VELPLAN_Handle, _iq24, _iq24, _iq24, _iq20, bool)
Function: This function sets the SpinTAC Velocity Plan system configuration.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | _iq24 | T_sec | Sample time in [s] |
3 | _iq24 | VelMax | System maximum velocity limit |
4 | _iq24 | AccMax | System maximum acceleration limit |
5 | _iq20 | JrkMax | System maximum jerk limit |
6 | bool | LoopENB | false: plan operates only once and then goes back to IDLE
state true: plan operate again each time entering IDLES state |
void STVELPLAN_addCfgState(ST_VELPLAN_Handle, _iq24, int32_t)
Function: This function adds a state to SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | _iq24 | VelEnd | Velocity set point for the state |
3 | int32_t | Timer_tick | Timer in [Count] to indicate how long to state in the state |
void STVELPLAN_addCfgTran(ST_VELPLAN_Handle, uint16_t, uint16_t, ST_PlanCond_e, uint16_t, uint16_t, _iq24, _iq20)
Function: This function adds a transaction to SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | uint16_t | FromState | The index of the state in which the transition starts |
3 | uint16_t | ToState | The index of the state in which the transition to ends |
4 | ST_PlanCond_e | AndOr | ST_COND_NC: transit without condition; ST_COND_FC: transit with the first condition satisfied; ST_COND_AND: transit with both conditions satisfied; ST_COND_OR: transit with either condition satisfied; |
5 | uint16_t | CondIdx1 | The index of the first condition |
6 | uint16_t | CondIdx2 | The index of the second condition |
7 | _iq24 | AccLim | The acceleration limit used for this transition |
8 | _iq20 | JrkLim | The jerk limit used for this transition |
void STVELPLAN_addCfgVar(ST_VELPLAN_Handle, ST_PlanVar_e, _iq24)
Function: This function adds a variable to SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | ST_PlanVar_e | Type | ST_VAR_INOUT: timer type, can be used in condition ST_VAR_IN: sensor type, only receive value, can be used in condition ST_VAR_OUT: actuator type, only send value, cannot be used in condition |
3 | _iq24 | Value | Initial value of the variable |
void STVELPLAN_setUnitProfDone(ST_VELPLAN_Handle, bool)
Function: This function informs SpinTAC Velocity Plan if the currently running profile is done.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | bool | ProDON | false: not done; true: done |
void STVELPLAN_getVar(ST_VELPLAN_Handle, uint16_t, _iq24 *)
Function: This function returns the value of a variable from SpinTAC Velocity Plan. It is typically used to send data from SpinTAC Velocity Plan to an external component
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | uint16_t | VarIdx | The index of the variable to receive the value |
3 | _iq24 * | Value | The pointer to the external variable to receive the value |
void STVELPLAN_setVar(ST_VELPLAN_Handle, uint16_t, _iq24)
Function: This function sets the value of a variable in SpinTAC Velocity Plan. It is typically used to pass sensor data into SpinTAC Velocity Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | uint16_t | VarIdx | The index of the variable to receive the value |
3 | _iq24 | Value | The value to be set to the variable |
void STPOSCTL_run(ST_POSCTL_Handle)
Function: This function runs SpinTAC Position Control.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSCTL_Handle | handle | The handle to the ST_PosCtl_t datatype |
void STPOSMOVE_run(ST_POSMOVE_Handle)
Function: This function runs SpinTAC Position Move.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSMOVE_Handle | handle | The handle to the ST_PosMove_t datatype |
void STPOSCONV_run(ST_POSCONV_Handle)
Function: This function runs SpinTAC Position Convert.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSCONV_Handle | handle | The handle to the ST_PosConv_t datatype |
void STPOSPLAN_run(ST_POSPLAN_Handle)
Function: This function runs SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
void STPOSPLAN_runTick(ST_POSPLAN_Handle)
Function: This function runs SpinTAC Position Plan Timer. Must run from an ISR.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
void STPOSPLAN_addCfgAct(ST_POSPLAN_Handle, uint16_t, ST_PlanCond_e , uint16_t , uint16_t, uint16_t, ST_PlanActOptn_e, _iq24, ST_PlanActTrgr_e)
Function: This function adds an action to SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | uint16_t | StateIdx | The index of the state in which the action to be executed |
3 | uint16_t | VarIdx | The index of the variable to be operated |
4 | ST_PlanCond_e | AndOr | ST_COND_NC: act without condition; ST_COND_FC: act when the first condition satisfied; ST_COND_AND: act when both conditions satisfied; ST_COND_OR: act when either condition satisfied; |
5 | uint16_t | CondIdx1 | The index of the first condition |
6 | uint16_t | CondIdx2 | The index of the second condition |
7 | ST_PlanActOptn_e | Opt | ST_ACT_EQ: set the value to the variable ST_ACT_QDD: add the value to the variable |
8 | _iq24 | Value | The value to be set to the variable or added to the variable |
9 | ST_PlanActTrgr_e | EnterExit | ST_ACT_ENTR: execute the action when entering the state ST_ACT_EXIT: execute the action when exiting the state |
void STPOSPLAN_setCfgArray(ST_POSPLAN_Handle, uint32_t *, const size_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)
Function: This function adds an action to SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | uint32_t * | cfgArray | Pointer to cfgArray used for Plan configuration. |
3 | const size_t | numBytes | The number of bytes allocated to the cfgArray array. Get number of bytes by calling sizeof(cfgArray) |
4 | uint16_t | MaxActNum | Number of Actions |
5 | uint16_t | MaxCondNum | Number of Conditions |
6 | uint16_t | MaxVarNum | Number if Variables |
7 | uint16_t | MaxTranNum | Number of Transitions |
8 | uint16_t | MaxStateNum | Number of States |
ST_POSPLAN_Handle STPOSPLAN_init(void *, const size_t)
Function: This function initializes SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | void * | pMemory | The pointer to the memory for a ST_PosPlan_t object |
const size_t | numBytes | The number of bytes allocated to the ST_PosPlan_t object |
Return: The ST_PosPlan_t object handle
void STPOSPLAN_addCfgCond(ST_POSPLAN_Handle, uint16_t, ST_PlanComp_e, _iq24, _iq24)
Function: This function adds a condition to SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | uint16_t | VarIdx | The index of the variable to be compared |
3 | ST_PlanComp_e | Comp | ST _COMP_NA: Not defined; ST _COMP_EQ: equal to Value1; ST _COMP_NEQ: not equal to Value1; ST__COMP_GT: greater than Value1; ST_ COMP_EGT: equal to or greater than Value1; ST_ COMP_LW: lower than Value1; ST_ COMP_ELW: equal to or lower than; ST_ COMP_In: belong to the range of (Value1, Value2); ST_ COMP_Ein: belong to the range of [Value1, Value2); ST_ COMP_InE: belong to the range of (Value1, Value2]; ST_ COMP_EinE: belong to the range of [Value1, Value2]; ST_ COMP_Out: not belong to the range of [Value1, Value2]; ST_ COMP_Eout: not belong to the range of (Value1, Value2]; ST_ COMP_OutE: not belong to the range of [Value1, Value2); ST_ COMP_EoutE: not belong to the range of (Value1, Value2) |
4 | _iq24 | Value1 | The first value |
5 | _iq24 | Value2 | The second value |
void STPOSPLAN_addCfgVarCond(ST_POSPLAN_Handle, uint16_t, uint16_t, ST_PlanComp_e)
Function: This function adds a condition that compares two variables to SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | uint16_t | VarIdx1 | The index of the first variable to be compared |
3 | uint16_t | VarIdx2 | The index of the second variable to be compared |
4 | ST_PlanComp_e | Comp | ST _COMP_NA: Not defined; ST _COMP_EQ: equal to Value1; ST _COMP_NEQ: not equal to Value1; ST__COMP_GT: greater than Value1; ST_ COMP_EGT: equal to or greater than Value1; ST_ COMP_LW: lower than Value1; ST_ COMP_ELW: equal to or lower than; |
void STPOSPLAN_setCfgHaltState(ST_POSPLAN_Handle, int32_t, _iq24,_iq24, _iq24, , int32_t)
Function: This function adds a state to SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VELPLAN_Handle | handle | The handle to the ST_VelPlan_t datatype |
2 | int32_t | PosStepInt_mrev | Position step integer part for the HALT state |
3 | _iq24 | PosStepFrac_mrev | Position step fraction part for the HALT state |
4 | _iq24 | VelLim | Velocity limit for the HALT state |
5 | _iq24 | AccLim | Acceleration limit for the HALT state |
6 | _iq20 | JrkLim | Jerk limit for the HALT state |
7 | Int32_t | Timer | Timer in [Count] to indicate how long to stay in the HALT state before further operation |
void STPOSPLAN_setCfg(ST_POSPLAN_Handle, _iq24, _iq24, _iq24, _iq20, bool)
Function: This function sets the SpinTAC Position Plan system configuration.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | _iq24 | T_sec | Sample time in [s] |
3 | _iq24 | VelMax | System maximum velocity limit |
4 | _iq24 | AccMax | System maximum acceleration limit |
5 | _iq20 | JrkMax | System maximum jerk limit |
6 | bool | LoopENB | false: plan operates only once and then goes back to IDLE
state true: plan operate again each time entering IDLES state |
void STPOSPLAN_addCfgState(ST_POSPLAN_Handle, int32_t, _iq24, int32_t)
Function: This function adds a state to SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | int32_t | PosStepInt_mrev | Position step command integer part value |
3 | _iq24 | PosStepFrac_mrev | Position step command fraction part value |
4 | int32_t | Timer_tick | Timer in [Count] to indicate how long to state in the state |
void STPOSPLAN_addCfgTran(ST_POSPLAN_Handle, uint16_t, uint16_t, ST_PlanCond_e, uint16_t, uint16_t, _iq24, _iq24, _iq20)
Function: This function adds a transaction to SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | uint16_t | FromState | The index of the state in which the transition starts |
3 | uint16_t | ToState | The index of the state in which the transition to ends |
4 | ST_PlanCond_e | AndOr | ST_COND_NC: transition without condition; ST_COND_FC: transition when the first condition satisfied; ST_COND_AND: transition when both conditions satisfied; ST_COND_OR: transition when either condition satisfied; |
5 | uint16_t | CondIdx1 | The index of the first condition |
6 | uint16_t | CondIdx2 | The index of the second condition |
7 | _iq24 | VelLim | The velocity limit used for this transition |
8 | _iq24 | AccLim | The acceleration limit used for this transition |
9 | _iq24 | DecLim | The deceleration limit used for this transition |
10 | _iq20 | JrkLim | The jerk limit used for this transition |
void STPOSPLAN_addCfgVar(ST_POSPLAN_Handle, ST_PlanVar_e, _iq24)
Function: This function adds a variable to SpinTAC Position Plan.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | ST_PlanVar_e | Type | ST_VAR_INOUT: timer type, can be used in condition ST_VAR_IN: sensor type, only receive value, can be used in condition ST_VAR_OUT: actuator type, only send value, cannot be used in condition |
3 | _iq24 | Value | Initial value of the variable |
void STPOSPLAN_setUnitProfDone(ST_POSPLAN_Handle, bool)
Function: This function informs SpinTAC Position Plan if the currently running profile is done.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | bool | ProDON | false: not done; true: done |
void STPOSPLAN_getVar(ST_POSPLAN_Handle, uint16_t, _iq24 *)
Function: This function returns the value of a variable from SpinTAC Position Plan. It is typically used to send data from SpinTAC Position Plan to an external component.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | uint16_t | VarIdx | The index of the variable to receive the value |
3 | _iq24 * | Value | The pointer to the external variable to receive the value |
void STPOSPLAN_setVar(ST_POSPLAN_Handle, uint16_t, _iq24)
Function: This function returns the value of a variable from SpinTAC Position Plan. It is typically used to send data from SpinTAC Position Plan to an external component.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_POSPLAN_Handle | handle | The handle to the ST_PosPlan_t datatype |
2 | uint16_t | VarIdx | The index of the variable to receive the value |
3 | _iq24 | Value | The value to be set to the variable |
void ST_getVersionNumber(ST_VER_Handle, uint16_t *, uint16_t *, uint16_t *)
Function: This function returns the version number of the SpinTAC library.
Parameters:
No. | Type | Parameters | Description |
---|---|---|---|
1 | ST_VER_Handle | handle | The hanlde to the ST_Ver_t datatype |
2 | uint16_t * | major | Major version of library |
3 | uint16_t * | minor | Minor version of library |
4 | uint16_t * | revision | Revision version of library |