| ApossC SDK V01.15

Macros | Functions
SDK_Amplifier_DS402_StateMachine.mh File Reference

Declaration of the DS402 StateMachineFunction. More...

Go to the source code of this file.

## Macros
#define | DS402_DRIVE_STATE_NOT_READY_TO_SWITCH_ON 1
| Drive States and Transitions - CiA 402 State Machine. More...
#define | DS402_DRIVE_STATE_SWITCH_ON_DISABLED 2
#define | DS402_DRIVE_STATE_READY_TO_SWITCH_ON 3
#define | DS402_DRIVE_STATE_SWITCHED_ON 4
#define | DS402_DRIVE_STATE_OPERATION_ENABLED 5
#define | DS402_DRIVE_STATE_QUICK_STOP_ACTIVE 6
#define | DS402_DRIVE_STATE_FAULT_REACTION_ACTIVE 7
#define | DS402_DRIVE_STATE_FAULT 8
#define | DS402_TRANSITION_SHUTDOWN 1
#define | DS402_TRANSITION_SWITCH_ON 2
#define | DS402_TRANSITION_ENABLE_OPERATION 3
#define | DS402_TRANSITION_DISABLE_VOLTAGE 4
#define | DS402_TRANSITION_DISABLE_OPERATION 5
#define | DS402_TRANSITION_QUICK_STOP 6
#define | DS402_TRANSITION_FAULT_RESET 7
#define | DS402_ABORT_CONNECTION_OPTION_CODE 0x6007
| OBJECT DICTIONARY - CiA 402. More...
#define | DS402_ERROR_CODE 0x603F
#define | DS402_CONTROLWORD 0x6040
#define | DS402_CW_BIT_SWITCH_ON 0
#define | DS402_CW_BIT_ENABLE_VOLTAGE 1
#define | DS402_CW_BIT_QUICK_STOP 2
#define | DS402_CW_BIT_ENABLE_OPERATION 3
#define | DS402_CW_BIT_HALT 8
#define | DS402_CW_PPM_BIT_NEW_SETPOINT 4
#define | DS402_CW_PPM_BIT_CHANGE_IMMEDIATELY 5
#define | DS402_CW_PPM_BIT_RELATIVE_MOVEMENT 6
#define | DS402_CW_PPM_BIT_ENDLESS_MOVEMENT 15
#define | DS402_STATUSWORD 0x6041
#define | DS402_SW_BIT_READY_TO_SWITCH_ON 0
#define | DS402_SW_BIT_SWITCHED_ON 1
#define | DS402_SW_BIT_OPERATION_ENABLED 2
#define | DS402_SW_BIT_FAULT 3
#define | DS402_SW_BIT_VOLTAGE_ENABLED 4
#define | DS402_SW_BIT_QUICK_STOP 5
#define | DS402_SW_BIT_SWITCH_ON_DISABLED 6
#define | DS402_SW_BIT_WARNING 7
#define | DS402_SW_BIT_REMOTE 9
#define | DS402_SW_BIT_TARGET_REACHED 10
#define | DS402_SW_BIT_INTERNAL_LIMIT 11
#define | DS402_SW_PPM_BIT_SETPOINT_ACK 12
#define | DS402_SW_PPM_BIT_FOLLWING_ERROR 13
#define | DS402_SW_PVM_BIT_SPEED 12
#define | DS402_QUICK_STOP_OPTION_CODE 0x605A
#define | DS402_SHUTDOWN_OPTION_CODE 0x605B
#define | DS402_DISABLE_OPERATION_OPTION_CODE 0x605C
#define | DS402_FAULT_REACTION_OPTION_CODE 0x605E
#define | DS402_MODES_OF_OPERATION 0x6060
#define | DS402_OP_PPM 0x01
#define | DS402_OP_PVM 0x03
#define | DS402_MODES_OF_OPERATION_DISPLAY 0x6061
#define | DS402_POSITION_DEMAND_VALUE 0x6062
#define | DS402_POSITION_ACTUAL_VALUE 0x6064
#define | DS402_FOLLOWING_ERROR_WINDOW 0x6065
#define | DS402_FOLLOWING_ERROR_TIMEOUT 0x6066
#define | DS402_VELOCITY_DEMAND_VALUE 0x606B
#define | DS402_VELOCITY_ACTUAL_VALUE 0x606C
#define | DS402_TARGET_TORQUE 0x6071
#define | DS402_MOTOR_RATED_TORQUE 0x6076
#define | DS402_TORQUE_ACTUAL_VALUE 0x6077
#define | DS402_TARGET_POSITION 0x607A
#define | DS402_POSITION_RANGE_LIMIT 0x607B
#define | DS402_SOFTWARE_POSITION_LIMIT 0x607D
#define | DS402_MAX_PROFILE_VELOCITY 0x607F
#define | DS402_MAX_MOTOR_SPEED 0x6080
#define | DS402_PROFILE_VELOCITY 0x6081
#define | DS402_PROFILE_ACCELERATION 0x6083
#define | DS402_PROFILE_DECELERATION 0x6084
#define | DS402_QUICK_STOP_DECELERATION 0x6085
#define | DS402_MOTION_PROFILE_TYPE 0x6086
#define | DS402_HOMING_METHOD 0x6098
#define | DS402_HOMING_ACT_POSITION 37
#define | DS402_HOMING_IDX_P_SPEED 34
#define | DS402_HOMING_IDX_N_SPEED 33
#define | DS402_HOMING_SWITCH_P_SPEED 23
#define | DS402_HOMING_SWITCH_N_SPEED 27
#define | DS402_HOMING_LIMIT_P_SPEED 18
#define | DS402_HOMING_LIMIT_N_SPEED 17
#define | DS402_HOMING_SWITCH_IDX_P_SPEED 7
#define | DS402_HOMING_SWITCH_IDX_N_SPEED 11
#define | DS402_HOMING_LIMIT_IDX_P_SPEED 2
#define | DS402_HOMING_LIMIT_IDX_N_SPEED 1
#define | DS402_HOMING_CURRENT_IDX_P_SPEED -1
#define | DS402_HOMING_CURRENT_IDX_N_SPEED -2
#define | DS402_HOMING_CURRENT_P_SPEED -3
#define | DS402_HOMING_CURRENT_N_SPEED -4
#define | DS402_HOMING_SPEEDS 0x6099
#define | DS402_HOMING_ACCELERATION 0x609A
#define | DS402_SI_UNIT_POSITION 0x60A8
#define | DS402_SI_UNIT_VELOCITY 0x60A9
#define | DS402_SI_UNIT_ACCELERATION 0x60AA
#define | DS402_POSITION_OFFSET 0x60B0
#define | DS402_VELOCITY_OFFSET 0x60B1
#define | DS402_TORQUE_OFFSET 0x60B2
#define | DS402_TOUCH_PROBE_FUNCTION 0x60B8
#define | DS402_TOUCH_PROBE_STATUS 0x60B9
#define | DS402_TOUCH_PROBE_POSITION_1_POSITIVE_VALUE 0x60BA
#define | DS402_TOUCH_PROBE_POSITION_1_NEGATIVE_VALUE 0x60BB
#define | DS402_INTERPOLATION_TIME_PERIOD 0x60C2
#define | DS402_MAX_ACCELERATION 0x60C5
#define | DS402_TOUCH_PROBE_SOURCE 0x60D0
#define | DS402_TOUCH_PROBE_1_POSITIVE_EDGE_COUNTER 0x60D5
#define | DS402_TOUCH_PROBE_1_NEGATIVE_EDGE_COUNTER 0x60D6
#define | DS402_ADDITIONAL_POSITION_ACTUAL_VALUES 0x60E4
#define | DS402_ADDITIONAL_VELOCITY_ACTUAL_VALUES 0x60E5
#define | DS402_FOLLOWING_ERROR_ACTUAL_VALUE 0x60F4
#define | DS402_DIGITAL_INPUTS 0x60FD
#define | DS402_DIGITAL_OUTPUTS 0x60FE
#define | DS402_TARGET_VELOCITY 0x60FF
#define | DS402_MOTOR_TYPE 0x6402
#define | DS402_SUPPORTED_DRIVE_MODES 0x6502
#define | DS402_PPM_ABSOLUTE 0
#define | DS402_PPM_RELATIVE 1
#define | DS402_PPM_AFTER_ACTUAL_POSITIONING 0

## Functions
long | sdkDS402_ReadStatusWord (long busId)
| Declaration of 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...

## Detailed Description

Declaration of the DS402 StateMachineFunction.

Definition in file SDK_Amplifier_DS402_StateMachine.mh.

## Macro Definition Documentation

## ◆ DS402_ABORT_CONNECTION_OPTION_CODE

#define DS402_ABORT_CONNECTION_OPTION_CODE 0x6007

OBJECT DICTIONARY - CiA 402.

Definition at line 81 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_ADDITIONAL_POSITION_ACTUAL_VALUES

#define DS402_ADDITIONAL_POSITION_ACTUAL_VALUES 0x60E4

Definition at line 179 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_ADDITIONAL_VELOCITY_ACTUAL_VALUES

#define DS402_ADDITIONAL_VELOCITY_ACTUAL_VALUES 0x60E5

Definition at line 180 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CONTROLWORD

#define DS402_CONTROLWORD 0x6040

Definition at line 83 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_BIT_ENABLE_OPERATION

#define DS402_CW_BIT_ENABLE_OPERATION 3

Definition at line 87 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_BIT_ENABLE_VOLTAGE

#define DS402_CW_BIT_ENABLE_VOLTAGE 1

Definition at line 85 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_BIT_HALT

#define DS402_CW_BIT_HALT 8

Definition at line 88 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_BIT_QUICK_STOP

#define DS402_CW_BIT_QUICK_STOP 2

Definition at line 86 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_BIT_SWITCH_ON

#define DS402_CW_BIT_SWITCH_ON 0

Definition at line 84 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_PPM_BIT_CHANGE_IMMEDIATELY

#define DS402_CW_PPM_BIT_CHANGE_IMMEDIATELY 5

Definition at line 92 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_PPM_BIT_ENDLESS_MOVEMENT

#define DS402_CW_PPM_BIT_ENDLESS_MOVEMENT 15

Definition at line 94 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_PPM_BIT_NEW_SETPOINT

#define DS402_CW_PPM_BIT_NEW_SETPOINT 4

Definition at line 91 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_CW_PPM_BIT_RELATIVE_MOVEMENT

#define DS402_CW_PPM_BIT_RELATIVE_MOVEMENT 6

Definition at line 93 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DIGITAL_INPUTS

#define DS402_DIGITAL_INPUTS 0x60FD

Definition at line 182 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DIGITAL_OUTPUTS

#define DS402_DIGITAL_OUTPUTS 0x60FE

Definition at line 183 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DISABLE_OPERATION_OPTION_CODE

#define DS402_DISABLE_OPERATION_OPTION_CODE 0x605C

Definition at line 117 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DRIVE_STATE_FAULT

#define DS402_DRIVE_STATE_FAULT 8

Definition at line 67 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DRIVE_STATE_FAULT_REACTION_ACTIVE

#define DS402_DRIVE_STATE_FAULT_REACTION_ACTIVE 7

Definition at line 66 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DRIVE_STATE_NOT_READY_TO_SWITCH_ON

#define DS402_DRIVE_STATE_NOT_READY_TO_SWITCH_ON 1

Drive States and Transitions - CiA 402 State Machine.

Definition at line 60 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DRIVE_STATE_OPERATION_ENABLED

#define DS402_DRIVE_STATE_OPERATION_ENABLED 5

Examples
  CAN_1Ax_DS402_ProfilePositionMode-ppm-Test.mc, CAN_1Ax_DS402_ProfileVelocityMode-pvm-Test.mc, and CAN_MultipleAx_DS402_ProfilePositionMode-ppm-Test.mc.

Definition at line 64 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DRIVE_STATE_QUICK_STOP_ACTIVE

#define DS402_DRIVE_STATE_QUICK_STOP_ACTIVE 6

Definition at line 65 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DRIVE_STATE_READY_TO_SWITCH_ON

#define DS402_DRIVE_STATE_READY_TO_SWITCH_ON 3

Examples
  CAN_1Ax_DS402_ProfilePositionMode-ppm-Test.mc, CAN_1Ax_DS402_ProfileVelocityMode-pvm-Test.mc, and CAN_MultipleAx_DS402_ProfilePositionMode-ppm-Test.mc.

Definition at line 62 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DRIVE_STATE_SWITCH_ON_DISABLED

#define DS402_DRIVE_STATE_SWITCH_ON_DISABLED 2

Examples
  CAN_1Ax_DS402_ProfilePositionMode-ppm-Test.mc, CAN_1Ax_DS402_ProfileVelocityMode-pvm-Test.mc, and CAN_MultipleAx_DS402_ProfilePositionMode-ppm-Test.mc.

Definition at line 61 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_DRIVE_STATE_SWITCHED_ON

#define DS402_DRIVE_STATE_SWITCHED_ON 4

Definition at line 63 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_ERROR_CODE

#define DS402_ERROR_CODE 0x603F

Definition at line 82 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_FAULT_REACTION_OPTION_CODE

#define DS402_FAULT_REACTION_OPTION_CODE 0x605E

Definition at line 118 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_FOLLOWING_ERROR_ACTUAL_VALUE

#define DS402_FOLLOWING_ERROR_ACTUAL_VALUE 0x60F4

Definition at line 181 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_FOLLOWING_ERROR_TIMEOUT

#define DS402_FOLLOWING_ERROR_TIMEOUT 0x6066

Definition at line 130 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_FOLLOWING_ERROR_WINDOW

#define DS402_FOLLOWING_ERROR_WINDOW 0x6065

Definition at line 129 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_ACCELERATION

#define DS402_HOMING_ACCELERATION 0x609A

Definition at line 163 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_ACT_POSITION

#define DS402_HOMING_ACT_POSITION 37

Definition at line 147 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_CURRENT_IDX_N_SPEED

#define DS402_HOMING_CURRENT_IDX_N_SPEED -2

Definition at line 159 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_CURRENT_IDX_P_SPEED

#define DS402_HOMING_CURRENT_IDX_P_SPEED -1

Definition at line 158 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_CURRENT_N_SPEED

#define DS402_HOMING_CURRENT_N_SPEED -4

Definition at line 161 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_CURRENT_P_SPEED

#define DS402_HOMING_CURRENT_P_SPEED -3

Definition at line 160 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_IDX_N_SPEED

#define DS402_HOMING_IDX_N_SPEED 33

Definition at line 149 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_IDX_P_SPEED

#define DS402_HOMING_IDX_P_SPEED 34

Definition at line 148 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_LIMIT_IDX_N_SPEED

#define DS402_HOMING_LIMIT_IDX_N_SPEED 1

Definition at line 157 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_LIMIT_IDX_P_SPEED

#define DS402_HOMING_LIMIT_IDX_P_SPEED 2

Definition at line 156 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_LIMIT_N_SPEED

#define DS402_HOMING_LIMIT_N_SPEED 17

Definition at line 153 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_LIMIT_P_SPEED

#define DS402_HOMING_LIMIT_P_SPEED 18

Definition at line 152 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_METHOD

#define DS402_HOMING_METHOD 0x6098

Definition at line 146 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_SPEEDS

#define DS402_HOMING_SPEEDS 0x6099

Definition at line 162 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_SWITCH_IDX_N_SPEED

#define DS402_HOMING_SWITCH_IDX_N_SPEED 11

Definition at line 155 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_SWITCH_IDX_P_SPEED

#define DS402_HOMING_SWITCH_IDX_P_SPEED 7

Definition at line 154 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_SWITCH_N_SPEED

#define DS402_HOMING_SWITCH_N_SPEED 27

Definition at line 151 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_HOMING_SWITCH_P_SPEED

#define DS402_HOMING_SWITCH_P_SPEED 23

Definition at line 150 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_INTERPOLATION_TIME_PERIOD

#define DS402_INTERPOLATION_TIME_PERIOD 0x60C2

Definition at line 174 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_MAX_ACCELERATION

#define DS402_MAX_ACCELERATION 0x60C5

Definition at line 175 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_MAX_MOTOR_SPEED

#define DS402_MAX_MOTOR_SPEED 0x6080

Definition at line 140 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_MAX_PROFILE_VELOCITY

#define DS402_MAX_PROFILE_VELOCITY 0x607F

Definition at line 139 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_MODES_OF_OPERATION

#define DS402_MODES_OF_OPERATION 0x6060

Definition at line 119 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_MODES_OF_OPERATION_DISPLAY

#define DS402_MODES_OF_OPERATION_DISPLAY 0x6061

Definition at line 126 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_MOTION_PROFILE_TYPE

#define DS402_MOTION_PROFILE_TYPE 0x6086

Definition at line 145 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_MOTOR_RATED_TORQUE

#define DS402_MOTOR_RATED_TORQUE 0x6076

Definition at line 134 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_MOTOR_TYPE

#define DS402_MOTOR_TYPE 0x6402

Definition at line 185 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_OP_PPM

#define DS402_OP_PPM 0x01

Examples
  CAN_1Ax_DS402_ProfilePositionMode-ppm-Test.mc, and CAN_MultipleAx_DS402_ProfilePositionMode-ppm-Test.mc.

Definition at line 120 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_OP_PVM

#define DS402_OP_PVM 0x03

Examples
  CAN_1Ax_DS402_ProfileVelocityMode-pvm-Test.mc.

Definition at line 121 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_POSITION_ACTUAL_VALUE

#define DS402_POSITION_ACTUAL_VALUE 0x6064

Definition at line 128 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_POSITION_DEMAND_VALUE

#define DS402_POSITION_DEMAND_VALUE 0x6062

Definition at line 127 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_POSITION_OFFSET

#define DS402_POSITION_OFFSET 0x60B0

Definition at line 167 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_POSITION_RANGE_LIMIT

#define DS402_POSITION_RANGE_LIMIT 0x607B

Definition at line 137 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_PPM_ABSOLUTE

#define DS402_PPM_ABSOLUTE 0

Definition at line 189 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_PPM_AFTER_ACTUAL_POSITIONING

#define DS402_PPM_AFTER_ACTUAL_POSITIONING 0

Definition at line 191 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_PPM_RELATIVE

#define DS402_PPM_RELATIVE 1

Definition at line 190 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_PROFILE_ACCELERATION

#define DS402_PROFILE_ACCELERATION 0x6083

Definition at line 142 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_PROFILE_DECELERATION

#define DS402_PROFILE_DECELERATION 0x6084

Definition at line 143 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_PROFILE_VELOCITY

#define DS402_PROFILE_VELOCITY 0x6081

Definition at line 141 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_QUICK_STOP_DECELERATION

#define DS402_QUICK_STOP_DECELERATION 0x6085

Definition at line 144 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_QUICK_STOP_OPTION_CODE

#define DS402_QUICK_STOP_OPTION_CODE 0x605A

Definition at line 115 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SHUTDOWN_OPTION_CODE

#define DS402_SHUTDOWN_OPTION_CODE 0x605B

Definition at line 116 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SI_UNIT_ACCELERATION

#define DS402_SI_UNIT_ACCELERATION 0x60AA

Definition at line 166 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SI_UNIT_POSITION

#define DS402_SI_UNIT_POSITION 0x60A8

Definition at line 164 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SI_UNIT_VELOCITY

#define DS402_SI_UNIT_VELOCITY 0x60A9

Definition at line 165 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SOFTWARE_POSITION_LIMIT

#define DS402_SOFTWARE_POSITION_LIMIT 0x607D

Definition at line 138 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_STATUSWORD

#define DS402_STATUSWORD 0x6041

Definition at line 96 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SUPPORTED_DRIVE_MODES

#define DS402_SUPPORTED_DRIVE_MODES 0x6502

Definition at line 186 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_FAULT

#define DS402_SW_BIT_FAULT 3

Examples
  CAN_1Ax_DS402_ProfilePositionMode-ppm-Test.mc, CAN_1Ax_DS402_ProfileVelocityMode-pvm-Test.mc, and CAN_MultipleAx_DS402_ProfilePositionMode-ppm-Test.mc.

Definition at line 100 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_INTERNAL_LIMIT

#define DS402_SW_BIT_INTERNAL_LIMIT 11

Definition at line 107 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_OPERATION_ENABLED

#define DS402_SW_BIT_OPERATION_ENABLED 2

Definition at line 99 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_QUICK_STOP

#define DS402_SW_BIT_QUICK_STOP 5

Definition at line 102 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_READY_TO_SWITCH_ON

#define DS402_SW_BIT_READY_TO_SWITCH_ON 0

Definition at line 97 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_REMOTE

#define DS402_SW_BIT_REMOTE 9

Definition at line 105 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_SWITCH_ON_DISABLED

#define DS402_SW_BIT_SWITCH_ON_DISABLED 6

Definition at line 103 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_SWITCHED_ON

#define DS402_SW_BIT_SWITCHED_ON 1

Definition at line 98 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_TARGET_REACHED

#define DS402_SW_BIT_TARGET_REACHED 10

Definition at line 106 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_VOLTAGE_ENABLED

#define DS402_SW_BIT_VOLTAGE_ENABLED 4

Definition at line 101 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_BIT_WARNING

#define DS402_SW_BIT_WARNING 7

Definition at line 104 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_PPM_BIT_FOLLWING_ERROR

#define DS402_SW_PPM_BIT_FOLLWING_ERROR 13

Examples
  CAN_1Ax_DS402_ProfilePositionMode-ppm-Test.mc, CAN_1Ax_DS402_ProfileVelocityMode-pvm-Test.mc, and CAN_MultipleAx_DS402_ProfilePositionMode-ppm-Test.mc.

Definition at line 111 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_PPM_BIT_SETPOINT_ACK

#define DS402_SW_PPM_BIT_SETPOINT_ACK 12

Definition at line 110 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_SW_PVM_BIT_SPEED

#define DS402_SW_PVM_BIT_SPEED 12

Definition at line 114 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TARGET_POSITION

#define DS402_TARGET_POSITION 0x607A

Definition at line 136 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TARGET_TORQUE

#define DS402_TARGET_TORQUE 0x6071

Definition at line 133 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TARGET_VELOCITY

#define DS402_TARGET_VELOCITY 0x60FF

Definition at line 184 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TORQUE_ACTUAL_VALUE

#define DS402_TORQUE_ACTUAL_VALUE 0x6077

Definition at line 135 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TORQUE_OFFSET

#define DS402_TORQUE_OFFSET 0x60B2

Definition at line 169 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TOUCH_PROBE_1_NEGATIVE_EDGE_COUNTER

#define DS402_TOUCH_PROBE_1_NEGATIVE_EDGE_COUNTER 0x60D6

Definition at line 178 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TOUCH_PROBE_1_POSITIVE_EDGE_COUNTER

#define DS402_TOUCH_PROBE_1_POSITIVE_EDGE_COUNTER 0x60D5

Definition at line 177 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TOUCH_PROBE_FUNCTION

#define DS402_TOUCH_PROBE_FUNCTION 0x60B8

Definition at line 170 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TOUCH_PROBE_POSITION_1_NEGATIVE_VALUE

#define DS402_TOUCH_PROBE_POSITION_1_NEGATIVE_VALUE 0x60BB

Definition at line 173 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TOUCH_PROBE_POSITION_1_POSITIVE_VALUE

#define DS402_TOUCH_PROBE_POSITION_1_POSITIVE_VALUE 0x60BA

Definition at line 172 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TOUCH_PROBE_SOURCE

#define DS402_TOUCH_PROBE_SOURCE 0x60D0

Definition at line 176 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TOUCH_PROBE_STATUS

#define DS402_TOUCH_PROBE_STATUS 0x60B9

Definition at line 171 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TRANSITION_DISABLE_OPERATION

#define DS402_TRANSITION_DISABLE_OPERATION 5

Definition at line 74 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TRANSITION_DISABLE_VOLTAGE

#define DS402_TRANSITION_DISABLE_VOLTAGE 4

Definition at line 73 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TRANSITION_ENABLE_OPERATION

#define DS402_TRANSITION_ENABLE_OPERATION 3

Definition at line 72 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TRANSITION_FAULT_RESET

#define DS402_TRANSITION_FAULT_RESET 7

Definition at line 76 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TRANSITION_QUICK_STOP

#define DS402_TRANSITION_QUICK_STOP 6

Definition at line 75 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TRANSITION_SHUTDOWN

#define DS402_TRANSITION_SHUTDOWN 1

Definition at line 70 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_TRANSITION_SWITCH_ON

#define DS402_TRANSITION_SWITCH_ON 2

Definition at line 71 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_VELOCITY_ACTUAL_VALUE

#define DS402_VELOCITY_ACTUAL_VALUE 0x606C

Definition at line 132 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_VELOCITY_DEMAND_VALUE

#define DS402_VELOCITY_DEMAND_VALUE 0x606B

Definition at line 131 of file SDK_Amplifier_DS402_StateMachine.mh.

## ◆ DS402_VELOCITY_OFFSET

#define DS402_VELOCITY_OFFSET 0x60B1

Definition at line 168 of file SDK_Amplifier_DS402_StateMachine.mh.

## Function Documentation

## ◆ helperDS402_ExecuteTransition()

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

sdkDS402_TransitionToState()

Parameters

  busId | Bus ID of the connected slave
  transition | Value of the transition to execute

Returns
  value: Process value
  value > 0 Transition successful
  value < 0 Invalid transition

Definition at line 152 of file SDK_Amplifier_DS402_StateMachine.mc.

153 {
154 long controlWord = sdkDS402_ReadControlWord(busId);
155 long retVal = 1;
156
157 switch(transition) {
158 case DS402_TRANSITION_SHUTDOWN:
159 //Transition Shutdown: CW 0xxx x110
160 printf("...: execute Transition: DS402_TRANSITION_SHUTDOWN\n", busId);
161 controlWord = (controlWord & 0xFF78) | 0x06;
162 sdkDS402_WriteControlWord(busId, controlWord);
163 break;
164 case DS402_TRANSITION_SWITCH_ON:
165 printf("...: execute Transition: DS402_TRANSITION_SWITCH_ON\n", busId);
166 //Transition Switch On: CW 0xxx x111
167 controlWord = (controlWord & 0xFF78) | 0x07;
168 sdkDS402_WriteControlWord(busId, controlWord);
169 break;
170 case DS402_TRANSITION_ENABLE_OPERATION:
171 printf("...: execute Transition: DS402_TRANSITION_ENABLE_OPERATION\n", busId);
172 //Transition Enable Operation: CW 0xxx 1111
173 controlWord = (controlWord & 0xFF70) | 0x0F;
174 sdkDS402_WriteControlWord(busId, controlWord);
175 break;
176 case DS402_TRANSITION_DISABLE_VOLTAGE:
177 printf("...: execute Transition: DS402_TRANSITION_DISABLE_VOLTAGE\n", busId);
178 //Transition Disable Voltage: CW 0xxx xx0x
179 controlWord = (controlWord & 0xFF7D);
180 sdkDS402_WriteControlWord(busId, controlWord);
181 break;
182 case DS402_TRANSITION_QUICK_STOP:
183 printf("...: execute Transition: DS402_TRANSITION_QUICK_STOP\n", busId);
184 //Transition Quick Stop: CW 0xxx x01x
185 controlWord = (controlWord & 0xFF79) | 0x02;
186 sdkDS402_WriteControlWord(busId, controlWord);
187 break;
188 case DS402_TRANSITION_DISABLE_OPERATION:
189 printf("...: execute Transition: DS402_TRANSITION_DISABLE_OPERATION\n", busId);
190 //Transition Disable Voltage: CW 0xxx 0111
191 controlWord = (controlWord & 0xFF70) | 0x07;
192 sdkDS402_WriteControlWord(busId, controlWord);
193 break;
194 case DS402_TRANSITION_FAULT_RESET:
195 printf("...: execute Transition: DS402_TRANSITION_FAULT_RESET\n", busId);
196 //Transition Fault Resest: CW 0xxx xxxx -> 1xxx xxxx
197 controlWord = (controlWord & 0xFF7F);
198 sdkDS402_WriteControlWord(busId, controlWord);
199 //Delay(1);
200 controlWord = controlWord | 0x80;
201 sdkDS402_WriteControlWord(busId, controlWord);
202 //Transition switch on disable
203 controlWord = controlWord & 0xFF7F;
204 sdkDS402_WriteControlWord(busId, controlWord);
205 break;
206 default:
207 printf("Invalid state transition\n");
208 retVal = -1;
209 break;
210 }
211
212 return(retVal);
213 }

## ◆ helperDS402_PPM_PosStart()

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)

Parameters

  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

Returns
  value: Process value
  value = 1 successful, new setpoint acknowlegded
  value = -1 failed, new setpoint not acknowlegded
  value = -2 failed, previous setpoint has been assumed and no additional setpoint may be accepted

Definition at line 721 of file SDK_Amplifier_DS402_StateMachine.mc.

722 {
723 long retVal = 1;
724 long controlWord = 0;
725 long setpointAcknowlege=1;
726 long time = 0;
727 long actState = -1;
728
729 printf("...: new setpoint: %d\n", pos);
730
731 if(sdkDS402_ReadStatusWord(busId).i[DS402_SW_PPM_BIT_SETPOINT_ACK]==1)
732 {
733 print("...: the previous setpoint has been assumed and no additional setpoint may be accepted");
734 return(-2);
735 }
736
737 actState = sdkDS402_GetActDriveState(busId);
738 if(actState != DS402_DRIVE_STATE_OPERATION_ENABLED)
739 {
740 print("...: drive state is not in operation enabled");
741 return(-1);
742 }
743
744 SdoWrite(busId, DS402_TARGET_POSITION, 0 ,pos);
745
746 controlWord = sdkDS402_ReadControlWord(busId);
747 controlWord.i[DS402_CW_PPM_BIT_NEW_SETPOINT] = 1;
748 controlWord.i[DS402_CW_PPM_BIT_CHANGE_IMMEDIATELY] = startImmediately;
749 controlWord.i[DS402_CW_PPM_BIT_RELATIVE_MOVEMENT] = relative;
750 controlWord.i[DS402_CW_PPM_BIT_ENDLESS_MOVEMENT] = 0;
751
752 sdkDS402_WriteControlWord(busId, controlWord);
753
754 time = Time();
755 while(sdkDS402_ReadStatusWord(busId).i[DS402_SW_PPM_BIT_SETPOINT_ACK]!=1)
756 {
757 if((Time()-time) > 2) //is blocking until the new setpoint has been acknowledged
758 {
759 print("...: no setpoint acknowledge received");
760 setpointAcknowlege = 0;
761 retVal = -1;
762 break;
763 }
764 }
765 controlWord = sdkDS402_ReadControlWord(busId);
766 controlWord.i[DS402_CW_PPM_BIT_NEW_SETPOINT] = 0;
767 controlWord.i[DS402_CW_PPM_BIT_CHANGE_IMMEDIATELY] = 0;
768 controlWord.i[DS402_CW_PPM_BIT_RELATIVE_MOVEMENT] = 0;
769 controlWord.i[DS402_CW_PPM_BIT_ENDLESS_MOVEMENT] = 0;
770
771 sdkDS402_WriteControlWord(busId, controlWord);
772
773 if(setpointAcknowlege)
774 {
775 print("...: setpoint acknowleged");
776 }
777
778 return(retVal);
779 }

## ◆ sdkDS402_GetActDriveState()

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

Parameters

  busId | Bus ID of the connected slave

Returns
  value: drive state (value mapping: in SDK_Amplifier_DS402_StateMachine.mh)

Definition at line 83 of file SDK_Amplifier_DS402_StateMachine.mc.

84 {
85 long status = sdkDS402_ReadStatusWord(busId);
86
87 switch(status & 0x006F) //mask bits xxxx xxxx x11x 1111
88 {
89
90 case 0x0000: return(DS402_DRIVE_STATE_NOT_READY_TO_SWITCH_ON); //xxxx xxxx x00x 0000
91 case 0x0040: return(DS402_DRIVE_STATE_SWITCH_ON_DISABLED); //xxxx xxxx x10x 0000
92 case 0x0021: return(DS402_DRIVE_STATE_READY_TO_SWITCH_ON); //xxxx xxxx x01x 0001
93 case 0x0023: return(DS402_DRIVE_STATE_SWITCHED_ON); //xxxx xxxx x01x 0011
94 case 0x0027: return(DS402_DRIVE_STATE_OPERATION_ENABLED); //xxxx xxxx x01x 0111
95 case 0x0007: return(DS402_DRIVE_STATE_QUICK_STOP_ACTIVE); //xxxx xxxx x01x 0001
96 case 0x000F: return(DS402_DRIVE_STATE_FAULT_REACTION_ACTIVE); //xxxx xxxx x00x 1111
97 case 0x0008: return(DS402_DRIVE_STATE_FAULT); //xxxx xxxx x00x 1000
98 default: return(-1);;
99 }
100 }

## ◆ sdkDS402_GetOpartionMode()

long sdkDS402_GetOpartionMode | ( | long | busId | ) |

Get the mode of operation DS402_MODES_OF_OPERATION(0x6060)

Get the mode of operation.

Parameters

  busId | Bus ID of the connected slave

Returns
  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 531 of file SDK_Amplifier_DS402_StateMachine.mc.

532 {
533 long operationMode = SdoRead( busId, DS402_MODES_OF_OPERATION, 0);
534 return(operationMode);
535 }

## ◆ sdkDS402_Halt()

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

Parameters

  busId | Bus ID of the connected slave

Definition at line 557 of file SDK_Amplifier_DS402_StateMachine.mc.

558 {
559 long controlWord;
560 printf("Bus Id %d, Halt\n", busId);
561
562 controlWord = sdkDS402_ReadControlWord(busId);
563 controlWord.i[DS402_CW_BIT_HALT] = 1;
564
565 sdkDS402_WriteControlWord(busId, controlWord);
566 }

## ◆ sdkDS402_PPM_PosAbsStart()

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)

Parameters

  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

Returns
  value: Process value
  value = 1 successful, new setpoint acknowlegded
  value = -1 failed, new setpoint not acknowlegded
  value = -2 failed, previous setpoint has been assumed and no additional setpoint may be accepted

Definition at line 797 of file SDK_Amplifier_DS402_StateMachine.mc.

798 {
799
800 printf("Bus Id %d, sdkDS402_PPM_PosAbsStart:\n", busId);
801 return helperDS402_PPM_PosStart(busId, pos, DS402_PPM_ABSOLUTE, startImmediately);
802 }

## ◆ sdkDS402_PPM_PosRelStart()

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)

Parameters

  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

Returns
  value: Process value
  value = 1 successful, new setpoint acknowlegded
  value = -1 failed, new setpoint not acknowlegded
  value = -2 failed, previous setpoint has been assumed and no additional setpoint may be accepted

Definition at line 819 of file SDK_Amplifier_DS402_StateMachine.mc.

820 {
821 printf("Bus Id %d, sdkDS402_PPM_PosRelStart:\n", busId);
822 return helperDS402_PPM_PosStart(busId, pos, DS402_PPM_RELATIVE, startImmediately);
823 }

## ◆ sdkDS402_PPM_TargetReached()

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.

Parameters

  busId | Bus ID of the connected slave

Returns
  value: Process value
  value = 1 Target reached
  value = 0 Target NOT reached

Definition at line 836 of file SDK_Amplifier_DS402_StateMachine.mc.

837 {
838 return(sdkDS402_ReadStatusWord(busId).i[DS402_SW_BIT_TARGET_REACHED]);
839 }

## ◆ sdkDS402_PPM_WaitTargetReached()

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.

Parameters

  busId | Bus ID of the connected slave
  timeout | Timeout until the function is aborted >=0: timeout in [ms] < 0: infinite timeout

Returns
  value: Process value
  value > 0 Target reached
  value < 0 Timeout expired

Definition at line 853 of file SDK_Amplifier_DS402_StateMachine.mc.

854 {
855 long time = Time();
856 long targetReached = 1;
857
858 printf("Bus Id %d, sdkDS402_PPM_WaitTargetReached:\n", busId);
859
860 while(sdkDS402_PPM_TargetReached(busId) == 0 && targetReached)
861 {
862 if(timeout >= 0 && (Time() - time) > timeout)
863 {
864 targetReached = -1;
865 printf("...: target position not reached within timeout (%d ms)\n", timeout);
866 }
867 }
868 if(targetReached)
869 {
870 print("...: target position reached");
871 }
872
873 return(targetReached);
874 }

## ◆ sdkDS402_Print_ControlWord()

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.

Parameters

  busId | Bus ID of the connected slave

Definition at line 656 of file SDK_Amplifier_DS402_StateMachine.mc.

657 {
658 long value;
659 long controlWord;
660 long operationMode;
661
662 operationMode = SdoRead(busId, DS402_MODES_OF_OPERATION, 0);
663 controlWord = sdkDS402_ReadControlWord(busId);
664
665 print("CONTROL WORD");
666 value = controlWord.i[DS402_CW_BIT_SWITCH_ON];
667 printf("\tSWITCH_ON:\t\t%d\n", value);
668
669 value = controlWord.i[DS402_CW_BIT_ENABLE_VOLTAGE];
670 printf("\tENABLE_VOLTAGE:\t\t%d\n", value);
671
672 value = controlWord.i[DS402_CW_BIT_QUICK_STOP];
673 printf("\tQUICK_STOP:\t\t%d\n", value);
674
675 value = controlWord.i[DS402_CW_BIT_ENABLE_OPERATION];
676 printf("\tENABLE_OPERATION:\t%d\n", value);
677
678 value = controlWord.i[DS402_CW_BIT_HALT];
679 printf("\tHALT:\t\t\t%d\n", value);
680
681 if(operationMode == DS402_OP_PPM)
682 {
683 value = controlWord.i[DS402_CW_PPM_BIT_NEW_SETPOINT];
684 printf("\tNEW_SETPOINT:\t%d\n", value);
685
686 value = controlWord.i[DS402_CW_PPM_BIT_CHANGE_IMMEDIATELY];
687 printf("\tCHANGE_IMMEDIATELY:\t%d\n", value);
688
689 value = controlWord.i[DS402_CW_PPM_BIT_RELATIVE_MOVEMENT];
690 printf("\tRELATIVE_MOVEMENT:\t%d\n", value);
691
692 value = controlWord.i[DS402_CW_PPM_BIT_ENDLESS_MOVEMENT];
693 printf("\tENDLESS_MOVEMENT:\t%d\n", value);
694 }
695 }

## ◆ sdkDS402_Print_StatusWord()

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.

Parameters

  busId | Bus ID of the connected slave

Definition at line 588 of file SDK_Amplifier_DS402_StateMachine.mc.

589 {
590 long value;
591 long status;
592 long operationMode;
593 operationMode = SdoRead(busId, DS402_MODES_OF_OPERATION, 0);
594 status = sdkDS402_ReadStatusWord(busId);
595
596
597 print("STATUS WORD");
598
599 value = status.i[DS402_SW_BIT_READY_TO_SWITCH_ON];
600 printf("\tREADY_TO_SWITCH_ON:\t%d\n", value);
601
602 value = status.i[DS402_SW_BIT_SWITCHED_ON];
603 printf("\tSWITCHED_ON:\t\t%d\n", value);
604
605 value = status.i[DS402_SW_BIT_OPERATION_ENABLED];
606 printf("\tOPERATION_ENABLED:\t%d\n", value);
607
608 value = status.i[DS402_SW_BIT_FAULT];
609 printf("\tFAULT:\t\t\t%d\n", value);
610
611 value = status.i[DS402_SW_BIT_VOLTAGE_ENABLED];
612 printf("\tVOLTAGE_ENABLED:\t%d\n", value);
613
614 value = status.i[DS402_SW_BIT_QUICK_STOP];
615 printf("\tQUICK_STOP:\t\t%d\n", value);
616
617 value = status.i[DS402_SW_BIT_SWITCH_ON_DISABLED];
618 printf("\tSWITCH_ON_DISABLED:\t%d\n", value);
619
620 value = status.i[DS402_SW_BIT_WARNING];
621 printf("\tWARNING:\t\t%d\n", value);
622
623 value = status.i[DS402_SW_BIT_REMOTE];
624 printf("\tREMOTE:\t\t\t%d\n", value);
625
626 value = status.i[DS402_SW_BIT_TARGET_REACHED];
627 printf("\tTARGET_REACHED:\t\t%d\n", value);
628
629 value = status.i[DS402_SW_BIT_INTERNAL_LIMIT];
630 printf("\tINTERNAL_LIMIT:\t\t%d\n", value);
631
632 if(operationMode == DS402_OP_PPM)
633 {
634 value = status.i[DS402_SW_PPM_BIT_SETPOINT_ACK];
635 printf("\tSETPOINT_ACK:\t\t%d\n", value);
636
637 value = status.i[DS402_SW_PPM_BIT_FOLLWING_ERROR];
638 printf("\tFOLLWING_ERROR:\t\t%d\n", value);
639 }
640
641 if(operationMode == DS402_OP_PVM)
642 {
643 value = status.i[DS402_SW_PVM_BIT_SPEED];
644 printf("\tSPEED:\t\t\t%d\n", value);
645 }
646 }

## ◆ sdkDS402_PrintState()

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.

Parameters

  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.

112 {
113 switch(state)
114 {
115 case DS402_DRIVE_STATE_NOT_READY_TO_SWITCH_ON: printf("DRIVE_STATE_NOT_READY_TO_SWITCH_ON"); break;
116 case DS402_DRIVE_STATE_SWITCH_ON_DISABLED: printf("DRIVE_STATE_SWITCH_ON_DISABLED"); break;
117 case DS402_DRIVE_STATE_READY_TO_SWITCH_ON: printf("DRIVE_STATE_READY_TO_SWITCH_ON"); break;
118 case DS402_DRIVE_STATE_SWITCHED_ON: printf("DRIVE_STATE_SWITCHED_ON"); break;
119 case DS402_DRIVE_STATE_OPERATION_ENABLED: printf("DRIVE_STATE_OPERATION_ENABLED"); break;
120 case DS402_DRIVE_STATE_QUICK_STOP_ACTIVE: printf("DRIVE_STATE_QUICK_STOP_ACTIVE"); break;
121 case DS402_DRIVE_STATE_FAULT_REACTION_ACTIVE: printf("DRIVE_STATE_FAULT_REACTION_ACTIVE"); break;
122 case DS402_DRIVE_STATE_FAULT: printf("DRIVE_STATE_FAULT"); break;
123 default: printf("%d", state);
124 }
125 }

## ◆ sdkDS402_PVM_CvelStart()

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.

Parameters

  busId | Bus ID of the connected slave

Returns
  value: Process value
  value 1 Successful
  value -1 Failed, drive is not in 'Operation enabled' state

Definition at line 904 of file SDK_Amplifier_DS402_StateMachine.mc.

905 {
906 long actState;
907 long controlWord;
908
909 printf("Bus Id %d, sdkDS402_PPM_CvelStart: \n", busId);
910
911 actState = sdkDS402_GetActDriveState(busId);
912 if(actState != DS402_DRIVE_STATE_OPERATION_ENABLED)
913 {
914 printf("...: drive state is not in operation enabled\n");
915 return(-1);
916 }
917
918 //Reset the Halt bit to start the execution
919 controlWord = sdkDS402_ReadControlWord(busId);
920 controlWord.i[DS402_CW_BIT_HALT] = 0;
921 sdkDS402_WriteControlWord(busId, controlWord);
922
923 printf("...: started\n");
924
925 return(1);
926 }

## ◆ sdkDS402_PVM_CvelStop()

long sdkDS402_PVM_CvelStop | ( | long | busId | ) |

Stop continuous velocity (PVM)

This function stops the axis.

Parameters

  busId | Bus ID of the connected slave

Returns
  value: Process value
  value 1 Successful

Definition at line 935 of file SDK_Amplifier_DS402_StateMachine.mc.

936 {
937 long controlWord;
938 printf("Bus Id %d, sdkDS402_PPM_CvelStop:\n", busId);
939
940 //Set the Halt bit, to stop the execution
941 controlWord = sdkDS402_ReadControlWord(busId);
942 controlWord.i[DS402_CW_BIT_HALT] = 1;
943
944 sdkDS402_WriteControlWord(busId, controlWord);
945 printf("...: stopped\n");
946
947 return(1);
948 }

## ◆ sdkDS402_PVM_SetTargetVelocity()

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)

Parameters

  busId | Bus ID of the connected slave
  targetVelocity | Target velocity

Definition at line 888 of file SDK_Amplifier_DS402_StateMachine.mc.

889 {
890 printf("Bus Id %d, PVM: Set target velocity to %d\n", busId, targetVelocity);
891 SdoWrite(busId, DS402_TARGET_VELOCITY, 0, targetVelocity);
892 }

## ◆ sdkDS402_PVM_TargetReached()

long sdkDS402_PVM_TargetReached | ( | long | busId | ) |

Checks whether the target velocity has reached.

This function verifies whether the axis reached the target velocity

Parameters

  busId | Bus ID of the connected slave

Returns
  value: Process value
  value = 1 Target reached
  value = 0 Target NOT reached

Definition at line 959 of file SDK_Amplifier_DS402_StateMachine.mc.

960 {
961 return sdkDS402_ReadStatusWord(busId).i[DS402_SW_BIT_TARGET_REACHED];
962 }

## ◆ sdkDS402_PVM_WaitTargetReached()

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.

Parameters

  busId | Bus ID of the connected slave
  timeout | Timeout until the funcition returns >=0: timeout in [ms] < 0: infinite timeout

Returns
  value: Process value
  value > 0 Target reached
  value < 0 Timeout expired

Definition at line 976 of file SDK_Amplifier_DS402_StateMachine.mc.

977 {
978 long time = Time();
979 long targetReached = 1;
980
981 printf("Bus Id %d, sdkDS402_PVM_WaitTargetReached:\n", busId);
982
983 while(sdkDS402_PPM_TargetReached(busId) == 0 && targetReached)
984 {
985 if(timeout >= 0 && (Time() - time) > timeout)
986 {
987 targetReached = -1;
988 printf("...: target velocity not reached within timeout (%d ms)\n", timeout);
989 }
990 }
991 if(targetReached)
992 {
993 print("...: target velocity reached");
994 }
995
996 return(targetReached);
997 }

## ◆ sdkDS402_QuickStop()

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()

Parameters

  busId | Bus ID of the connected slave

Definition at line 544 of file SDK_Amplifier_DS402_StateMachine.mc.

545 {
546 printf("Bus Id %d, Quick Stop\n", busId);
547 sdkDS402_TransitionToState(busId, DS402_DRIVE_STATE_QUICK_STOP_ACTIVE);
548 }

## ◆ sdkDS402_ReadControlWord()

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

Parameters

  busId | Bus ID of the connected slave

Returns
  value: control word

Definition at line 46 of file SDK_Amplifier_DS402_StateMachine.mc.

47 {
48 return SdoRead(busId, DS402_CONTROLWORD, 0);
49 }

## ◆ sdkDS402_ReadStatusWord()

long sdkDS402_ReadStatusWord | ( | long | busId | ) |

Declaration of 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

Parameters

  busId | Bus ID of the connected slave

Returns
  value: status word

Definition at line 33 of file SDK_Amplifier_DS402_StateMachine.mc.

34 {
35 return SdoRead(busId, DS402_STATUSWORD, 0);
36 }

## ◆ sdkDS402_ResetFault()

void sdkDS402_ResetFault | ( | long | busId | ) |

Reset fault.

This function resets the fault execute a state transition to 'Switch On disabled'

Parameters

  busId | Bus ID of the connected slave

Definition at line 574 of file SDK_Amplifier_DS402_StateMachine.mc.

575 {
576 printf("Bus Id %d, Reset Fault\n", busId);
577 sdkDS402_TransitionToState(busId, DS402_DRIVE_STATE_SWITCH_ON_DISABLED);
578 }

## ◆ sdkDS402_SetMaxAcceleration()

void sdkDS402_SetMaxAcceleration | ( | long | busId,
|  | long | acc
| ) |  |

Set the max acceleration DS402_MAX_ACCELERATION(0x60C5)

Set the maximum allowed acceleration to prevent mechanical damage.

Parameters

  busId | Bus ID of the connected slave
  acc | acceleration value

Definition at line 464 of file SDK_Amplifier_DS402_StateMachine.mc.

465 {
466 SdoWrite(busId, DS402_MAX_ACCELERATION, 0, acc);
467 }

## ◆ sdkDS402_SetMaxMotorSpeed()

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].

Parameters

  busId | Bus ID of the connected slave
  vel | speed value [velocity unit]

Definition at line 452 of file SDK_Amplifier_DS402_StateMachine.mc.

453 {
454 SdoWrite(busId, DS402_MAX_MOTOR_SPEED, 0, vel);
455 }

## ◆ sdkDS402_SetMaxProfileVelocity()

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.

Parameters

  busId | Bus ID of the connected slave
  vel | velocity value [velocity unit]

Definition at line 439 of file SDK_Amplifier_DS402_StateMachine.mc.

440 {
441 SdoWrite(busId, DS402_MAX_PROFILE_VELOCITY, 0, vel);
442 }

## ◆ sdkDS402_SetMotionProfileType()

void sdkDS402_SetMotionProfileType | ( | long | busId,
|  | long | type
| ) |  |

Set the motion profile type DS402_MOTION_PROFILE_TYPE(0x6086)

Set the type of motion profile trajectory

Parameters

  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.

428 {
429 SdoWrite(busId, DS402_MOTION_PROFILE_TYPE, 0, type);
430 }

## ◆ sdkDS402_SetOpartionMode()

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.

Parameters

  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.

509 {
510 if( operationMode == DS402_OP_PPM)
511 {
512 printf("Bus Id %d, setup profile position mode\n" ,busId);
513 SdoWrite( busId, DS402_MODES_OF_OPERATION, 0, DS402_OP_PPM);
514 }
515 else if(operationMode == DS402_OP_PVM)
516 {
517 printf("Bus Id %d, setup profile velocity mode\n" ,busId);
518 SdoWrite( busId, DS402_MODES_OF_OPERATION, 0, DS402_OP_PVM);
519 }
520 }

## ◆ sdkDS402_SetProfileAcceleration()

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)

Parameters

  busId | Bus ID of the connected slave
  acc | acceleration value [acceleration unit]

Definition at line 389 of file SDK_Amplifier_DS402_StateMachine.mc.

390 {
391 SdoWrite(busId, DS402_PROFILE_ACCELERATION, 0, acc);
392 }

## ◆ sdkDS402_SetProfileDeceleration()

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)

Parameters

  busId | Bus ID of the connected slave
  acc | deceleration value [acceleration unit]

Definition at line 401 of file SDK_Amplifier_DS402_StateMachine.mc.

402 {
403 SdoWrite(busId, DS402_PROFILE_DECELERATION, 0, dec);
404 }

## ◆ sdkDS402_SetProfileMovementParameter()

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.

Parameters

  busId | Bus ID of the connected slave
  dec | deceleration value

Definition at line 488 of file SDK_Amplifier_DS402_StateMachine.mc.

489 {
490 sdkDS402_SetProfileAcceleration(busId, acc);
491 sdkDS402_SetProfileDeceleration(busId, dec);
492 sdkDS402_SetProfileVelocity(busId, velocity);
493 }

## ◆ sdkDS402_SetProfileVelocity()

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()

Parameters

  busId | Bus ID of the connected slave
  vel | velocity value [velocity unit]

Definition at line 414 of file SDK_Amplifier_DS402_StateMachine.mc.

415 {
416 SdoWrite(busId, DS402_PROFILE_VELOCITY, 0, vel);
417 }

## ◆ sdkDS402_SetQuickStopDeceleration()

void sdkDS402_SetQuickStopDeceleration | ( | long | busId,
|  | long | dec
| ) |  |

Set quick stop deceleration DS402_QUICK_STOP_DECELERATION(0x6085)

Set the deceleration of the quick stop profile.

Parameters

  busId | Bus ID of the connected slave
  dec | deceleration value

Definition at line 476 of file SDK_Amplifier_DS402_StateMachine.mc.

477 {
478 SdoWrite(busId, DS402_QUICK_STOP_DECELERATION, 0, dec);
479 }

## ◆ sdkDS402_TransitionToState()

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.

Parameters

  busId | Bus ID of the connected slave
  newState | target state

Returns
  value: Process value
  value > 0 Transition executed
  value < 0 Invalid transition

Definition at line 230 of file SDK_Amplifier_DS402_StateMachine.mc.

230 {
231
232 long transition = -1;
233 long actState = sdkDS402_GetActDriveState(busId);
234
235 printf("Bus Id %d, Transition from ", busId);
236 sdkDS402_PrintState(actState);
237 printf(" to ");
238 sdkDS402_PrintState(newState);
239 print();
240
241 switch(actState) {
242 case DS402_DRIVE_STATE_NOT_READY_TO_SWITCH_ON:
243 if (newState == DS402_DRIVE_STATE_SWITCH_ON_DISABLED) {
244 // Automatic transition
245 }
246 break;
247 case DS402_DRIVE_STATE_SWITCH_ON_DISABLED:
248 if (newState == DS402_DRIVE_STATE_READY_TO_SWITCH_ON) {
249 transition = DS402_TRANSITION_SHUTDOWN;
250 }
251 break;
252 case DS402_DRIVE_STATE_READY_TO_SWITCH_ON:
253 if (newState == DS402_DRIVE_STATE_SWITCH_ON_DISABLED) {
254 transition = DS402_TRANSITION_DISABLE_VOLTAGE;
255 }
256 else if (newState == DS402_DRIVE_STATE_SWITCHED_ON) {
257 transition = DS402_TRANSITION_SWITCH_ON;
258 }
259 else if (newState == DS402_DRIVE_STATE_OPERATION_ENABLED) {
260 transition = DS402_TRANSITION_ENABLE_OPERATION;
261 }
262 break;
263 case DS402_DRIVE_STATE_SWITCHED_ON:
264 if (newState == DS402_DRIVE_STATE_SWITCH_ON_DISABLED) {
265 transition = DS402_TRANSITION_DISABLE_VOLTAGE;
266 }
267 else if (newState == DS402_DRIVE_STATE_READY_TO_SWITCH_ON) {
268 transition = DS402_TRANSITION_SHUTDOWN;
269 }
270 else if (newState == DS402_DRIVE_STATE_OPERATION_ENABLED) {
271 transition = DS402_TRANSITION_ENABLE_OPERATION;
272 }
273 break;
274 case DS402_DRIVE_STATE_OPERATION_ENABLED:
275 if (newState == DS402_DRIVE_STATE_SWITCH_ON_DISABLED) {
276 transition = DS402_TRANSITION_DISABLE_VOLTAGE;
277 }
278 else if (newState == DS402_DRIVE_STATE_READY_TO_SWITCH_ON) {
279 transition = DS402_TRANSITION_SHUTDOWN;
280 }
281 else if (newState == DS402_DRIVE_STATE_SWITCHED_ON) {
282 transition = DS402_TRANSITION_DISABLE_OPERATION;
283 }
284 else if (newState == DS402_DRIVE_STATE_QUICK_STOP_ACTIVE) {
285 transition = DS402_TRANSITION_QUICK_STOP;
286 }
287 break;
288 case DS402_DRIVE_STATE_QUICK_STOP_ACTIVE:
289 if (newState == DS402_DRIVE_STATE_SWITCH_ON_DISABLED) {
290 transition = DS402_TRANSITION_SHUTDOWN;
291 }
292 else if (newState == DS402_DRIVE_STATE_OPERATION_ENABLED) {
293 transition = DS402_TRANSITION_ENABLE_OPERATION;
294 }
295 break;
296 case DS402_DRIVE_STATE_FAULT_REACTION_ACTIVE:
297 if (newState == DS402_DRIVE_STATE_FAULT) {
298 // Automatic transition
299 }
300 else if (newState == DS402_DRIVE_STATE_SWITCH_ON_DISABLED) {
301 transition = DS402_TRANSITION_FAULT_RESET;
302 }
303 break;
304 case DS402_DRIVE_STATE_FAULT:
305 if (newState == DS402_DRIVE_STATE_SWITCH_ON_DISABLED) {
306 transition = DS402_TRANSITION_FAULT_RESET;
307 }
308 break;
309 default:
310 printf("...: invalid actual drive state: %d\n", busId, actState);
311 break;
312 }
313
314 if(transition != -1)
315 {
316 helperDS402_ExecuteTransition(busId, transition);
317 }
318 else
319 {
320 printf("...: invalid state transition\n", busId);
321 }
322
323 return(transition);
324 }

## ◆ sdkDS402_WaitTransitionToState()

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.

sdkDS402_TransitionToState

Parameters

  busId | Bus ID of the connected slave
  newState | target state
  Timeout | until the function is aborted >=0: timeout in [ms] < 0: infinite timeout

Returns
  value: Process value
  value > 0 Transition executed (number of transition)
  value -1 Invalid transition
  value -2 Timeout expired
  value -3 Invalid actual state

Definition at line 347 of file SDK_Amplifier_DS402_StateMachine.mc.

348 {
349 long actState, transition;
350 long time = Time();
351
352 printf("Bus Id %d, sdkDS402_WaitTransitionToState\n" ,busId);
353
354 transition = sdkDS402_TransitionToState(busId, targetState);
355 if(transition < 0)
356 {
357 //Invalid transition
358 return(-1);
359 }
360
361 actState = sdkDS402_GetActDriveState(busId);
362 while(actState != targetState)
363 {
364 if(timeout >= 0 && (Time() - time) > timeout)
365 {
366 //Timeout elapsed
367 printf("...: target state not reached within timeout (%d ms)\n", timeout);
368 return(-2);
369 }
370 actState = sdkDS402_GetActDriveState(busId);
371 }
372
373 return(transition);
374 }

## ◆ sdkDS402_WriteControlWord()

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

Parameters

  busId | Bus ID of the connected slave
  value | Value of the control word

Returns
  value: control word

Definition at line 60 of file SDK_Amplifier_DS402_StateMachine.mc.

61 {
62 SdoWrite(busId, DS402_CONTROLWORD, 0, value);
63 }
DS402_SW_BIT_SWITCH_ON_DISABLED
#define DS402_SW_BIT_SWITCH_ON_DISABLED
Definition: SDK_Amplifier_DS402_StateMachine.mh:103
sdkDS402_ReadStatusWord
long sdkDS402_ReadStatusWord(long busId)
DS 402 State-Machine functions.
Definition: SDK_Amplifier_DS402_StateMachine.mc:33
DS402_SW_BIT_OPERATION_ENABLED
#define DS402_SW_BIT_OPERATION_ENABLED
Definition: SDK_Amplifier_DS402_StateMachine.mh:99
DS402_SW_BIT_TARGET_REACHED
#define DS402_SW_BIT_TARGET_REACHED
Definition: SDK_Amplifier_DS402_StateMachine.mh:106
DS402_DRIVE_STATE_SWITCH_ON_DISABLED
#define DS402_DRIVE_STATE_SWITCH_ON_DISABLED
Definition: SDK_Amplifier_DS402_StateMachine.mh:61
DS402_STATUSWORD
#define DS402_STATUSWORD
Definition: SDK_Amplifier_DS402_StateMachine.mh:96
DS402_MAX_PROFILE_VELOCITY
#define DS402_MAX_PROFILE_VELOCITY
Definition: SDK_Amplifier_DS402_StateMachine.mh:139
DS402_DRIVE_STATE_FAULT_REACTION_ACTIVE
#define DS402_DRIVE_STATE_FAULT_REACTION_ACTIVE
Definition: SDK_Amplifier_DS402_StateMachine.mh:66
sdkDS402_SetProfileVelocity
void sdkDS402_SetProfileVelocity(long busId, long vel)
Set the profile velocity DS402_PROFILE_VELOCITY(0x6081)
Definition: SDK_Amplifier_DS402_StateMachine.mc:414
DS402_TARGET_VELOCITY
#define DS402_TARGET_VELOCITY
Definition: SDK_Amplifier_DS402_StateMachine.mh:184
DS402_DRIVE_STATE_QUICK_STOP_ACTIVE
#define DS402_DRIVE_STATE_QUICK_STOP_ACTIVE
Definition: SDK_Amplifier_DS402_StateMachine.mh:65
DS402_SW_BIT_QUICK_STOP
#define DS402_SW_BIT_QUICK_STOP
Definition: SDK_Amplifier_DS402_StateMachine.mh:102
sdkDS402_GetActDriveState
long sdkDS402_GetActDriveState(long busId)
Get the actual drive state.
Definition: SDK_Amplifier_DS402_StateMachine.mc:83
DS402_TRANSITION_SWITCH_ON
#define DS402_TRANSITION_SWITCH_ON
Definition: SDK_Amplifier_DS402_StateMachine.mh:71
DS402_TARGET_POSITION
#define DS402_TARGET_POSITION
Definition: SDK_Amplifier_DS402_StateMachine.mh:136
DS402_PROFILE_ACCELERATION
#define DS402_PROFILE_ACCELERATION
Definition: SDK_Amplifier_DS402_StateMachine.mh:142
DS402_MAX_ACCELERATION
#define DS402_MAX_ACCELERATION
Definition: SDK_Amplifier_DS402_StateMachine.mh:175
DS402_CW_BIT_HALT
#define DS402_CW_BIT_HALT
Definition: SDK_Amplifier_DS402_StateMachine.mh:88
DS402_TRANSITION_DISABLE_VOLTAGE
#define DS402_TRANSITION_DISABLE_VOLTAGE
Definition: SDK_Amplifier_DS402_StateMachine.mh:73
DS402_MOTION_PROFILE_TYPE
#define DS402_MOTION_PROFILE_TYPE
Definition: SDK_Amplifier_DS402_StateMachine.mh:145
sdkDS402_TransitionToState
long sdkDS402_TransitionToState(long busId, long newState)
Transition to another state.
Definition: SDK_Amplifier_DS402_StateMachine.mc:230
DS402_SW_BIT_VOLTAGE_ENABLED
#define DS402_SW_BIT_VOLTAGE_ENABLED
Definition: SDK_Amplifier_DS402_StateMachine.mh:101
DS402_TRANSITION_FAULT_RESET
#define DS402_TRANSITION_FAULT_RESET
Definition: SDK_Amplifier_DS402_StateMachine.mh:76
DS402_SW_BIT_REMOTE
#define DS402_SW_BIT_REMOTE
Definition: SDK_Amplifier_DS402_StateMachine.mh:105
DS402_CW_PPM_BIT_RELATIVE_MOVEMENT
#define DS402_CW_PPM_BIT_RELATIVE_MOVEMENT
Definition: SDK_Amplifier_DS402_StateMachine.mh:93
DS402_CW_BIT_QUICK_STOP
#define DS402_CW_BIT_QUICK_STOP
Definition: SDK_Amplifier_DS402_StateMachine.mh:86
DS402_SW_BIT_WARNING
#define DS402_SW_BIT_WARNING
Definition: SDK_Amplifier_DS402_StateMachine.mh:104
DS402_MAX_MOTOR_SPEED
#define DS402_MAX_MOTOR_SPEED
Definition: SDK_Amplifier_DS402_StateMachine.mh:140
DS402_TRANSITION_ENABLE_OPERATION
#define DS402_TRANSITION_ENABLE_OPERATION
Definition: SDK_Amplifier_DS402_StateMachine.mh:72
helperDS402_PPM_PosStart
long helperDS402_PPM_PosStart(long busId, long pos, long relative, long startImmediately)
Profile Position Mode functions.
Definition: SDK_Amplifier_DS402_StateMachine.mc:721
DS402_PROFILE_VELOCITY
#define DS402_PROFILE_VELOCITY
Definition: SDK_Amplifier_DS402_StateMachine.mh:141
DS402_DRIVE_STATE_FAULT
#define DS402_DRIVE_STATE_FAULT
Definition: SDK_Amplifier_DS402_StateMachine.mh:67
DS402_SW_BIT_SWITCHED_ON
#define DS402_SW_BIT_SWITCHED_ON
Definition: SDK_Amplifier_DS402_StateMachine.mh:98
DS402_CW_BIT_ENABLE_OPERATION
#define DS402_CW_BIT_ENABLE_OPERATION
Definition: SDK_Amplifier_DS402_StateMachine.mh:87
sdkDS402_ReadControlWord
long sdkDS402_ReadControlWord(long busId)
Read control word.
Definition: SDK_Amplifier_DS402_StateMachine.mc:46
DS402_SW_PVM_BIT_SPEED
#define DS402_SW_PVM_BIT_SPEED
Definition: SDK_Amplifier_DS402_StateMachine.mh:114
DS402_SW_BIT_FAULT
#define DS402_SW_BIT_FAULT
Definition: SDK_Amplifier_DS402_StateMachine.mh:100
DS402_CW_PPM_BIT_ENDLESS_MOVEMENT
#define DS402_CW_PPM_BIT_ENDLESS_MOVEMENT
Definition: SDK_Amplifier_DS402_StateMachine.mh:94
DS402_OP_PPM
#define DS402_OP_PPM
Definition: SDK_Amplifier_DS402_StateMachine.mh:120
DS402_PROFILE_DECELERATION
#define DS402_PROFILE_DECELERATION
Definition: SDK_Amplifier_DS402_StateMachine.mh:143
DS402_PPM_ABSOLUTE
#define DS402_PPM_ABSOLUTE
Definition: SDK_Amplifier_DS402_StateMachine.mh:189
helperDS402_ExecuteTransition
long helperDS402_ExecuteTransition(long busId, long transition)
Execute a state transition.
Definition: SDK_Amplifier_DS402_StateMachine.mc:152
DS402_MODES_OF_OPERATION
#define DS402_MODES_OF_OPERATION
Definition: SDK_Amplifier_DS402_StateMachine.mh:119
DS402_SW_BIT_INTERNAL_LIMIT
#define DS402_SW_BIT_INTERNAL_LIMIT
Definition: SDK_Amplifier_DS402_StateMachine.mh:107
DS402_TRANSITION_DISABLE_OPERATION
#define DS402_TRANSITION_DISABLE_OPERATION
Definition: SDK_Amplifier_DS402_StateMachine.mh:74
DS402_DRIVE_STATE_OPERATION_ENABLED
#define DS402_DRIVE_STATE_OPERATION_ENABLED
Definition: SDK_Amplifier_DS402_StateMachine.mh:64
DS402_DRIVE_STATE_NOT_READY_TO_SWITCH_ON
#define DS402_DRIVE_STATE_NOT_READY_TO_SWITCH_ON
Drive States and Transitions - CiA 402 State Machine.
Definition: SDK_Amplifier_DS402_StateMachine.mh:60
DS402_DRIVE_STATE_READY_TO_SWITCH_ON
#define DS402_DRIVE_STATE_READY_TO_SWITCH_ON
Definition: SDK_Amplifier_DS402_StateMachine.mh:62
sdkDS402_PrintState
void sdkDS402_PrintState(long state)
Print the name of certain drive state.
Definition: SDK_Amplifier_DS402_StateMachine.mc:111
sdkDS402_SetProfileDeceleration
void sdkDS402_SetProfileDeceleration(long busId, long dec)
Set the profile deceleration DS402_PROFILE_DECELERATION(0x6084)
Definition: SDK_Amplifier_DS402_StateMachine.mc:401
sdkDS402_SetProfileAcceleration
void sdkDS402_SetProfileAcceleration(long busId, long acc)
Profile Mode settings.
Definition: SDK_Amplifier_DS402_StateMachine.mc:389
DS402_CW_BIT_ENABLE_VOLTAGE
#define DS402_CW_BIT_ENABLE_VOLTAGE
Definition: SDK_Amplifier_DS402_StateMachine.mh:85
DS402_SW_BIT_READY_TO_SWITCH_ON
#define DS402_SW_BIT_READY_TO_SWITCH_ON
Definition: SDK_Amplifier_DS402_StateMachine.mh:97
DS402_SW_PPM_BIT_FOLLWING_ERROR
#define DS402_SW_PPM_BIT_FOLLWING_ERROR
Definition: SDK_Amplifier_DS402_StateMachine.mh:111
sdkDS402_PPM_TargetReached
long sdkDS402_PPM_TargetReached(long busId)
Checks whether the target was reached.
Definition: SDK_Amplifier_DS402_StateMachine.mc:836
DS402_QUICK_STOP_DECELERATION
#define DS402_QUICK_STOP_DECELERATION
Definition: SDK_Amplifier_DS402_StateMachine.mh:144
DS402_CW_BIT_SWITCH_ON
#define DS402_CW_BIT_SWITCH_ON
Definition: SDK_Amplifier_DS402_StateMachine.mh:84
DS402_SW_PPM_BIT_SETPOINT_ACK
#define DS402_SW_PPM_BIT_SETPOINT_ACK
Definition: SDK_Amplifier_DS402_StateMachine.mh:110
DS402_CW_PPM_BIT_NEW_SETPOINT
#define DS402_CW_PPM_BIT_NEW_SETPOINT
Definition: SDK_Amplifier_DS402_StateMachine.mh:91
DS402_CONTROLWORD
#define DS402_CONTROLWORD
Definition: SDK_Amplifier_DS402_StateMachine.mh:83
DS402_OP_PVM
#define DS402_OP_PVM
Definition: SDK_Amplifier_DS402_StateMachine.mh:121
DS402_TRANSITION_QUICK_STOP
#define DS402_TRANSITION_QUICK_STOP
Definition: SDK_Amplifier_DS402_StateMachine.mh:75
DS402_DRIVE_STATE_SWITCHED_ON
#define DS402_DRIVE_STATE_SWITCHED_ON
Definition: SDK_Amplifier_DS402_StateMachine.mh:63
DS402_CW_PPM_BIT_CHANGE_IMMEDIATELY
#define DS402_CW_PPM_BIT_CHANGE_IMMEDIATELY
Definition: SDK_Amplifier_DS402_StateMachine.mh:92
DS402_PPM_RELATIVE
#define DS402_PPM_RELATIVE
Definition: SDK_Amplifier_DS402_StateMachine.mh:190
sdkDS402_WriteControlWord
void sdkDS402_WriteControlWord(long busId, long value)
Write control word.
Definition: SDK_Amplifier_DS402_StateMachine.mc:60
DS402_TRANSITION_SHUTDOWN
#define DS402_TRANSITION_SHUTDOWN
Definition: SDK_Amplifier_DS402_StateMachine.mh:70

Data Sheets | Released Software | Software Manuals | Hardware Manuals | Maxon Shop

Maxon Support Center