![]() |
ApossC SDK
V01.15
|
This file provides all the function used for DS402 PPM and PVM. More...
Go to the source code of this file.
Macros | |
| #define | DS402_PPM_IMMEDIATELY 1 |
Functions | |
| long | sdkDS402_ReadStatusWord (long busId) |
| DS 402 State-Machine functions. More... | |
| long | sdkDS402_ReadControlWord (long busId) |
| Read control word. More... | |
| void | sdkDS402_WriteControlWord (long busId, long value) |
| Write control word. More... | |
| long | sdkDS402_GetActDriveState (long busId) |
| Get the actual drive state. More... | |
| void | sdkDS402_PrintState (long state) |
| Print the name of certain drive state. More... | |
| long | helperDS402_ExecuteTransition (long busId, long transition) |
| Execute a state transition. More... | |
| long | sdkDS402_TransitionToState (long busId, long newState) |
| Transition to another state. More... | |
| long | sdkDS402_WaitTransitionToState (long busId, long targetState, long timeout) |
| Wait transition to another state. More... | |
| void | sdkDS402_SetProfileAcceleration (long busId, long acc) |
| Profile Mode settings. More... | |
| void | sdkDS402_SetProfileDeceleration (long busId, long dec) |
| Set the profile deceleration DS402_PROFILE_DECELERATION(0x6084) More... | |
| void | sdkDS402_SetProfileVelocity (long busId, long vel) |
| Set the profile velocity DS402_PROFILE_VELOCITY(0x6081) More... | |
| void | sdkDS402_SetMotionProfileType (long busId, long type) |
| Set the motion profile type DS402_MOTION_PROFILE_TYPE(0x6086) More... | |
| void | sdkDS402_SetMaxProfileVelocity (long busId, long vel) |
| Set the max profile velocity DS402_MAX_PROFILE_VELOCITY(0x607F) More... | |
| void | sdkDS402_SetMaxMotorSpeed (long busId, long vel) |
| Set the max profile velocity DS402_MAX_MOTOR_SPEED(0x6080) More... | |
| void | sdkDS402_SetMaxAcceleration (long busId, long acc) |
| Set the max acceleration DS402_MAX_ACCELERATION(0x60C5) More... | |
| void | sdkDS402_SetQuickStopDeceleration (long busId, long dec) |
| Set quick stop deceleration DS402_QUICK_STOP_DECELERATION(0x6085) More... | |
| void | sdkDS402_SetProfileMovementParameter (long busId, long acc, long dec, long velocity) |
| Set quick stop deceleration DS402_QUICK_STOP_DECELERATION(0x6085) More... | |
| void | sdkDS402_SetOpartionMode (long busId, long operationMode) |
| Profile Mode functions. More... | |
| long | sdkDS402_GetOpartionMode (long busId) |
| Get the mode of operation DS402_MODES_OF_OPERATION(0x6060) More... | |
| void | sdkDS402_QuickStop (long busId) |
| Execute quick stop. More... | |
| void | sdkDS402_Halt (long busId) |
| Stop the motor. More... | |
| void | sdkDS402_ResetFault (long busId) |
| Reset fault. More... | |
| void | sdkDS402_Print_StatusWord (long busId) |
| Print the status word. More... | |
| void | sdkDS402_Print_ControlWord (long busId) |
| Print the control word. More... | |
| long | helperDS402_PPM_PosStart (long busId, long pos, long relative, long startImmediately) |
| Profile Position Mode functions. More... | |
| long | sdkDS402_PPM_PosAbsStart (long busId, long pos, long startImmediately) |
| Start absolute positioning. More... | |
| long | sdkDS402_PPM_PosRelStart (long busId, long pos, long startImmediately) |
| Start relative positioning. More... | |
| long | sdkDS402_PPM_TargetReached (long busId) |
| Checks whether the target was reached. More... | |
| long | sdkDS402_PPM_WaitTargetReached (long busId, long timeout) |
| Wait until target is reachd. More... | |
| void | sdkDS402_PVM_SetTargetVelocity (long busId, long targetVelocity) |
| Profile Velocity Mode functions. More... | |
| long | sdkDS402_PVM_CvelStart (long busId) |
| Start continuous velocity (PVM) More... | |
| long | sdkDS402_PVM_CvelStop (long busId) |
| Stop continuous velocity (PVM) More... | |
| long | sdkDS402_PVM_TargetReached (long busId) |
| Checks whether the target velocity has reached. More... | |
| long | sdkDS402_PVM_WaitTargetReached (long busId, long timeout) |
| Wait until target is reachd. More... | |
This file provides all the function used for DS402 PPM and PVM.
A DS402 slave can be operated in the different modes PPM and PVM The amplifiers can be controlled via EtherCAT or CAN bus.
Definition in file SDK_Amplifier_DS402_StateMachine.mc.
| #define DS402_PPM_IMMEDIATELY 1 |
Definition at line 192 of file SDK_Amplifier_DS402_StateMachine.mh.
| long helperDS402_ExecuteTransition | ( | long | busId, |
| long | transition | ||
| ) |
Execute a state transition.
This function executes a state transition within the DS402 state machine. DO NOT USE this function for state changes. It is just a helper function for the function sdkDS402_TransitionToState(). If you want to execute a state transition, use the function sdkDS402_TransitionToState().
The function writes value to the control word, to set the bits for state changes.
Bit 0: Switched on
Bit 1: Enable voltage
Bit 2: Quick stop
Bit 3: Enable operation
..
Bit 7: Fault reset
T
| busId | Bus ID of the connected slave |
| transition | Value of the transition to execute |
Definition at line 152 of file SDK_Amplifier_DS402_StateMachine.mc.
| long helperDS402_PPM_PosStart | ( | long | busId, |
| long | pos, | ||
| long | relative, | ||
| long | startImmediately | ||
| ) |
Profile Position Mode functions.
Start positioning relative or absolute
This function starts positioning of an axis relative or absolute. Do not use this funtion. Use sdkDS402_PPM_PosAbsStart() or sdkDS402_PPM_PosRelStart() instead. This funtion is blocking until the setpoint acknowledge is received (max 2ms)
| busId | Bus ID of the connected slave |
| pos | target position |
| relative | excute the positioning relative or absolute 0: absolute 1: relative |
| startImmediately | start the movement immediately 0: Finish actual positioning 1: Abort actual positioning and start next positioning |
Definition at line 721 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_GetActDriveState | ( | long | busId | ) |
Get the actual drive state.
This function gets the actual state in DS402 state machine The state is depending on the folloeing bits in the status word.
Bit0: Ready to switch on
Bit1: Switched on
Bit2: Operation enabled
Bit3: Fault
Bit4: *(don't care)
Bit5: Quick stop (low active)
Bit6: switch on disabled
| busId | Bus ID of the connected slave |
Definition at line 83 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_GetOpartionMode | ( | long | busId | ) |
Get the mode of operation DS402_MODES_OF_OPERATION(0x6060)
Get the mode of operation.
| busId | Bus ID of the connected slave |
Definition at line 531 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_Halt | ( | long | busId | ) |
Stop the motor.
This function stops the motor with the defined profile deceleration. The deceleration can be set with method sdkDS402_SetProfileDeceleration
| busId | Bus ID of the connected slave |
Definition at line 557 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_PPM_PosAbsStart | ( | long | busId, |
| long | pos, | ||
| long | startImmediately | ||
| ) |
Start absolute positioning.
This function starts absolute positioning This funtion is blocking until the setpoint acknowledge is received (max 2ms)
| busId | Bus ID of the connected slave |
| pos | target position |
| startImmediately | start the movement immediately 0: Finish actual positioning 1: Abort actual positioning and start next positioning |
Definition at line 797 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_PPM_PosRelStart | ( | long | busId, |
| long | pos, | ||
| long | startImmediately | ||
| ) |
Start relative positioning.
This function starts relative positioning This funtion is blocking until the setpoint acknowledge is received (max 2ms)
| busId | Bus ID of the connected slave |
| pos | relative movement value |
| startImmediately | start the movement immediately 0: Finish actual positioning 1: Abort actual positioning and start next positioning |
Definition at line 819 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_PPM_TargetReached | ( | long | busId | ) |
Checks whether the target was reached.
This function verifies whether the axis reached the target position This function is not blocking until the axis reaches the target.
| busId | Bus ID of the connected slave |
Definition at line 836 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_PPM_WaitTargetReached | ( | long | busId, |
| long | timeout | ||
| ) |
Wait until target is reachd.
This function waits (blocks) until the axis has reached the target position whthin the defined timeout.
| busId | Bus ID of the connected slave |
| timeout | Timeout until the function is aborted >=0: timeout in [ms] < 0: infinite timeout |
Definition at line 853 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_Print_ControlWord | ( | long | busId | ) |
Print the control word.
This function writes the control word split into individual bits with their description. It is depending on the actual modes of operation (PPM/PVM). This function can be used for debugging purposes.
| busId | Bus ID of the connected slave |
Definition at line 656 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_Print_StatusWord | ( | long | busId | ) |
Print the status word.
This function print the status word split into individual bits with their description. It is depending on the actual modes of operation (PPM/PVM). This function can be used for debugging purposes.
| busId | Bus ID of the connected slave |
Definition at line 588 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_PrintState | ( | long | state | ) |
Print the name of certain drive state.
This function prints the state name from a state vlaue. It can be used to create human readable print outputs for debugging reason.
| state | value of the state to print (value mapping: in SDK_Amplifier_DS402_StateMachine.mh) |
Definition at line 111 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_PVM_CvelStart | ( | long | busId | ) |
Start continuous velocity (PVM)
This function start to run the axis in continuous velocity The velocity can be defined with the method sdkDS402_PVM_SetTargetVelocity.
| busId | Bus ID of the connected slave |
Definition at line 904 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_PVM_CvelStop | ( | long | busId | ) |
Stop continuous velocity (PVM)
This function stops the axis.
| busId | Bus ID of the connected slave |
Definition at line 935 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_PVM_SetTargetVelocity | ( | long | busId, |
| long | targetVelocity | ||
| ) |
Profile Velocity Mode functions.
Set target velocity for PVM
This function sets the target velocity for the Profile Position Mode (PVM)
| busId | Bus ID of the connected slave |
| targetVelocity | Target velocity |
Definition at line 888 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_PVM_TargetReached | ( | long | busId | ) |
Checks whether the target velocity has reached.
This function verifies whether the axis reached the target velocity
| busId | Bus ID of the connected slave |
Definition at line 959 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_PVM_WaitTargetReached | ( | long | busId, |
| long | timeout | ||
| ) |
Wait until target is reachd.
This function waits (blocks) until the axis has reached the target velocity whthin the defined timeout.
| busId | Bus ID of the connected slave |
| timeout | Timeout until the funcition returns >=0: timeout in [ms] < 0: infinite timeout |
Definition at line 976 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_QuickStop | ( | long | busId | ) |
Execute quick stop.
This function executes a quick stop with the defined deceleration. The deceleration can be set with method sdkDS402_SetQuickStopDeceleration()
| busId | Bus ID of the connected slave |
Definition at line 544 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_ReadControlWord | ( | long | busId | ) |
Read control word.
This function reads the control word form index DS402_CONTROLWORD(0x6040) and subindex 0 The bits have different meaning for Profile Position Mode and Profile Velocity Mode
| busId | Bus ID of the connected slave |
Definition at line 46 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_ReadStatusWord | ( | long | busId | ) |
DS 402 State-Machine functions.
Declaration of functions.
Read status word
This function reads the status word form index DS402_STATUSWORD(0x6041) and subindex 0 The bits have different meaning for Profile Position Mode and Profile Velocity Mode
| busId | Bus ID of the connected slave |
Definition at line 33 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_ResetFault | ( | long | busId | ) |
Reset fault.
This function resets the fault execute a state transition to 'Switch On disabled'
| busId | Bus ID of the connected slave |
Definition at line 574 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetMaxAcceleration | ( | long | busId, |
| long | acc | ||
| ) |
Set the max acceleration DS402_MAX_ACCELERATION(0x60C5)
Set the maximum allowed acceleration to prevent mechanical damage.
| busId | Bus ID of the connected slave |
| acc | acceleration value |
Definition at line 464 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetMaxMotorSpeed | ( | long | busId, |
| long | vel | ||
| ) |
Set the max profile velocity DS402_MAX_MOTOR_SPEED(0x6080)
Set the maximum allowed speed for the motor. It serves as protection for the motor. The value is given in [rpm].
| busId | Bus ID of the connected slave |
| vel | speed value [velocity unit] |
Definition at line 452 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetMaxProfileVelocity | ( | long | busId, |
| long | vel | ||
| ) |
Set the max profile velocity DS402_MAX_PROFILE_VELOCITY(0x607F)
Set the velocity limit in a PPM or PVM move.
| busId | Bus ID of the connected slave |
| vel | velocity value [velocity unit] |
Definition at line 439 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetMotionProfileType | ( | long | busId, |
| long | type | ||
| ) |
Set the motion profile type DS402_MOTION_PROFILE_TYPE(0x6086)
Set the type of motion profile trajectory
| busId | Bus ID of the connected slave |
| type | motion profile type value 0: linear ramp (trapezoidal profile) |
Definition at line 427 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetOpartionMode | ( | long | busId, |
| long | operationMode | ||
| ) |
Profile Mode functions.
Set the mode of operation DS402_MODES_OF_OPERATION(0x6060)
Set the mode of operation.
| busId | Bus ID of the connected slave |
| operationMode | Definition of the operation mode DS402_OP_PPM (1): Profile Position Mode (PPM) DS402_OP_PVM (3): Profile Velocity Mode (PVM) |
Definition at line 508 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetProfileAcceleration | ( | long | busId, |
| long | acc | ||
| ) |
Profile Mode settings.
Set the profile acceleration DS402_PROFILE_ACCELERATION(0x6083)
Set the acceleration for PPM (Profile Position Mode) and PVM (Profile Velocity Mode)
| busId | Bus ID of the connected slave |
| acc | acceleration value [acceleration unit] |
Definition at line 389 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetProfileDeceleration | ( | long | busId, |
| long | dec | ||
| ) |
Set the profile deceleration DS402_PROFILE_DECELERATION(0x6084)
Set the deceleration for PPM (Profile Position Mode) and PVM (Profile Velocity Mode)
| busId | Bus ID of the connected slave |
| acc | deceleration value [acceleration unit] |
Definition at line 401 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetProfileMovementParameter | ( | long | busId, |
| long | acc, | ||
| long | dec, | ||
| long | velocity | ||
| ) |
Set quick stop deceleration DS402_QUICK_STOP_DECELERATION(0x6085)
Set the deceleration of the quick stop profile.
| busId | Bus ID of the connected slave |
| dec | deceleration value |
Definition at line 488 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetProfileVelocity | ( | long | busId, |
| long | vel | ||
| ) |
Set the profile velocity DS402_PROFILE_VELOCITY(0x6081)
Set the deceleration for PPM (Profile Position Mode) The target velocity for PVM has to be set with the function sdkDS402_PVM_TargetReached()
| busId | Bus ID of the connected slave |
| vel | velocity value [velocity unit] |
Definition at line 414 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_SetQuickStopDeceleration | ( | long | busId, |
| long | dec | ||
| ) |
Set quick stop deceleration DS402_QUICK_STOP_DECELERATION(0x6085)
Set the deceleration of the quick stop profile.
| busId | Bus ID of the connected slave |
| dec | deceleration value |
Definition at line 476 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_TransitionToState | ( | long | busId, |
| long | newState | ||
| ) |
Transition to another state.
This function executes a state transition within the DS402 state machine. It gets the actual state and performs a transition to a new state, if the transition between those two states is allowed. It is not checked whether the target state has been achieved.
| busId | Bus ID of the connected slave |
| newState | target state |
Definition at line 230 of file SDK_Amplifier_DS402_StateMachine.mc.
| long sdkDS402_WaitTransitionToState | ( | long | busId, |
| long | targetState, | ||
| long | timeout | ||
| ) |
Wait transition to another state.
This function waits (block) until a target state in DS402 state machine has been reached or the timeout expierd. It gets the actual state and performs a transition to a new state, if the transition between those two states is allowed. Because this function is blocking, just use it for a single axis. If you would like to change the state of several axis use sdkDS402_TransitionToState() funciton and verify the transition in the application.
| busId | Bus ID of the connected slave |
| newState | target state |
| Timeout | until the function is aborted >=0: timeout in [ms] < 0: infinite timeout |
Definition at line 347 of file SDK_Amplifier_DS402_StateMachine.mc.
| void sdkDS402_WriteControlWord | ( | long | busId, |
| long | value | ||
| ) |
Write control word.
This function writes the control word to index DS402_CONTROLWORD(0x6040) and subindex 0 The bits have different meaning for Profile Position Mode and Profile Velocity Mode
| busId | Bus ID of the connected slave |
| value | Value of the control word |
Definition at line 60 of file SDK_Amplifier_DS402_StateMachine.mc.