10 unsigned char _k_p_position,
11 unsigned char _k_i_position,
12 unsigned char _k_p_speed,
13 unsigned char _k_i_speed,
14 unsigned char _k_p_torque,
15 unsigned char _k_i_torque)
19 _can_message[2] = _k_p_position;
20 _can_message[3] = _k_i_position;
21 _can_message[4] = _k_p_speed;
22 _can_message[5] = _k_i_speed;
23 _can_message[6] = _k_p_torque;
24 _can_message[7] = _k_i_torque;
28 unsigned char _k_p_position,
29 unsigned char _k_i_position,
30 unsigned char _k_p_speed,
31 unsigned char _k_i_speed,
32 unsigned char _k_p_torque,
33 unsigned char _k_i_torque)
37 _can_message[2] = _k_p_position;
38 _can_message[3] = _k_i_position;
39 _can_message[4] = _k_p_speed;
40 _can_message[5] = _k_i_speed;
41 _can_message[6] = _k_p_torque;
42 _can_message[7] = _k_i_torque;
55 _can_message[4] = *(uint8_t *)(&_acceleration);
56 _can_message[5] = *((uint8_t *)(&_acceleration) + 1);
57 _can_message[6] = *((uint8_t *)(&_acceleration) + 2);
58 _can_message[7] = *((uint8_t *)(&_acceleration) + 3);
71 _can_message[6] = *(uint8_t *)(&_encoder_offset);
72 _can_message[7] = *((uint8_t *)(&_encoder_offset) + 1);
138 _can_message[4] = *(uint8_t *)(&_torque_current);
139 _can_message[5] = *((uint8_t *)(&_torque_current) + 1);
146 _can_message[4] = *(uint8_t *)(&_speed);
147 _can_message[5] = *((uint8_t *)(&_speed) + 1);
148 _can_message[6] = *((uint8_t *)(&_speed) + 2);
149 _can_message[7] = *((uint8_t *)(&_speed) + 3);
156 _can_message[4] = *(uint8_t *)(&_multiturn_angle);
157 _can_message[5] = *((uint8_t *)(&_multiturn_angle) + 1);
158 _can_message[6] = *((uint8_t *)(&_multiturn_angle) + 2);
159 _can_message[7] = *((uint8_t *)(&_multiturn_angle) + 3);
166 _can_message[2] = *(uint8_t *)(&_max_speed);
167 _can_message[3] = *((uint8_t *)(&_max_speed) + 1);
168 _can_message[4] = *(uint8_t *)(&_multiturn_angle);
169 _can_message[5] = *((uint8_t *)(&_multiturn_angle) + 1);
170 _can_message[6] = *((uint8_t *)(&_multiturn_angle) + 2);
171 _can_message[7] = *((uint8_t *)(&_multiturn_angle) + 3);
178 _can_message[1] = _spin_direction;
179 _can_message[4] = *(uint8_t *)(&_singleturn_angle);
180 _can_message[5] = *((uint8_t *)(&_singleturn_angle) + 1);
187 _can_message[1] = _spin_direction;
188 _can_message[2] = *(uint8_t *)(&_max_speed);
189 _can_message[3] = *((uint8_t *)(&_max_speed) + 1);
190 _can_message[4] = *(uint8_t *)(&_single_turn_angle);
191 _can_message[5] = *((uint8_t *)(&_single_turn_angle) + 1);
#define MOTOR_COMMAND_MOTOR_STOP
#define MOTOR_COMMAND_MOTOR_OFF
#define MOTOR_COMMAND_READ_SINGLE_CIRCLE_COMMAND
#define MOTOR_COMMAND_WRITE_CURRENT_POSITION_TO_ROM
#define MOTOR_COMMAND_POSITION_CLOSED_LOOP_4
#define MOTOR_COMMAND_READ_MULTI_TURN_ANGLE
#define MOTOR_COMMAND_WRITE_PID_PARAMETERS_TO_ROM
#define MOTOR_COMMAND_SPEED_CLOSED_LOOP
#define MOTOR_COMMAND_MOTOR_RUNNING
#define MOTOR_COMMAND_READ_MOTOR_STATUS_2
#define MOTOR_COMMAND_POSITION_CLOSED_LOOP_1
#define MOTOR_COMMAND_POSITION_CLOSED_LOOP_2
#define MOTOR_COMMAND_WRITE_ENCODER_POSITION_OFFSET
#define MOTOR_COMMAND_WRITE_ACCELERATION_TO_RAM
#define MOTOR_COMMAND_READ_PID_PARAMETERS
#define MOTOR_COMMAND_READ_MOTOR_STATUS_1_AND_ERROR_FLAG
#define MOTOR_COMMAND_WRITE_PID_PARAMETERS_TO_RAM
#define MOTOR_COMMAND_READ_MOTOR_STATUS_3
#define MOTOR_COMMAND_READ_ACCELERATION
#define MOTOR_COMMAND_TORQUE_CLOSED_LOOP
#define MOTOR_COMMAND_CLEAR_MOTOR_ERROR_FLAG
#define MOTOR_COMMAND_READ_ENCODER_POSITION
#define MOTOR_COMMAND_POSITION_CLOSED_LOOP_3
void readMotorStatus1AndErrorFlag(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to send back a CAN mess...
void motorStop(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to stop its controller ...
void positionControl3(unsigned char *_can_message, uint16_t _singleturn_angle, uint8_t _spin_direction)
The function creates a CAN data message that can be used to set the motor's single turn position with...
void readAcceleration(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to send back a CAN mess...
void readMotorStatus2(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to send back a CAN mess...
void torqueCurrentControl(unsigned char *_can_message, int16_t _torque_current)
The function creates a CAN data message that can be used to set the motor's torque current....
void speedControl(unsigned char *_can_message, int32_t speed)
The function creates a CAN data message that can be used to set the motor's speed....
void writeAccelerationToRAM(unsigned char *_can_message, int32_t _acceleration)
The function creates a CAN data message that can be used to set the acceleration of the motor.
void positionControl1(unsigned char *_can_message, int32_t _multiturn_angle)
The function creates a CAN data message that can be used to set the motor's multi turn position....
void motorRunning(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to resume its control o...
void readCircleTurnAngle(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to send back a CAN mess...
void positionControl4(unsigned char *_can_message, uint16_t _single_turn_angle, uint8_t _spin_direction, uint16_t max_speed)
The function creates a CAN data message that can be used to set the motor's single turn position with...
void motorOff(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to turn off its control...
void clearMotorErrorFlag(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to clear its error stat...
void readMultiTurnAngle(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to send back a CAN mess...
void readPIDParameters(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to send back a CAN mess...
void writePIDParametersToROM(unsigned char *_can_message, unsigned char _k_p_position, unsigned char _k_i_position, unsigned char _k_p_speed, unsigned char _k_i_speed, unsigned char _k_p_torque, unsigned char _k_i_torque)
The function creates a CAN data message that can be used to set the PI parameters of the motor....
void readEncoderPosition(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to send back a CAN mess...
void writePIDParametersToRAM(unsigned char *_can_message, unsigned char _k_p_position, unsigned char _k_i_position, unsigned char _k_p_speed, unsigned char _k_i_speed, unsigned char _k_p_torque, unsigned char _k_i_torque)
The function creates a CAN data message that can be used to set the PI parameters of the motor in RAM...
void writeCurrentPositionToROM(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to set the current posi...
void writeEncoderPositionOffset(unsigned char *_can_message, uint16_t _encoder_offset)
The function creates a CAN data message that can be used to request the motor to set the encoder posi...
void positionControl2(unsigned char *_can_message, int32_t _multiturn_angle, uint16_t _max_speed)
The function creates a CAN data message that can be used to set the motor's multi turn position with ...
void readMotorStatus3(unsigned char *_can_message)
The function creates a CAN data message that can be used to request the motor to send back a CAN mess...
void emptyCanMessage(unsigned char *_can_message)
The function takes in an array are converts the first 8 elements to zero.