AK80-64 AK Series Actuator Driver Manual V1.0.8

Table Of Contents
https://www.cubemars.com/
34 / 52
5.1.1 Duty cycle mode:
Duty cycle mode sends data definitions
Data bits
Data[3]
Data[2]
Data[1]
Data[0]
Range
0~0xff
0~0xff
0~0xff
0~0xff
Corresponding
variables
Duty cycle 25-32
bit
Duty cycle 17-24
bit
Duty cycle 9-16
bit
Duty cycle 1-8 bit
void comm_can_set_duty(uint8_t controller_id, float duty) {
int32_t send_index = 0;
uint8_t buffer[4];
buffer_append_int32(buffer, (int32_t)(duty * 100000.0), &send_index);
comm_can_transmit_eid(controller_id |((uint32_t)CAN_PACKET_SET_DUTY << 8), buffer,
send_index);
}
5.1.2 Current loop mode
Current loop mode sends data definition
Data bits
Data[3]
Data[2]
Data[1]
Data[0]
Range
0~0xff
0~0xff
0~0xff
0~0xff
Corresponding
variables
Current 25-32 bit
Current 17-24 bit
Current 9-16 bit
Current 1-8 bit
Among them, the current value is of int32 type, and the value -60000-60000 represents -60-60A.
Current loop mode sending routine
void comm_can_set_current(uint8_t controller_id, float current) {
int32_t send_index = 0;
uint8_t buffer[4];
buffer_append_int32(buffer, (int32_t)(current * 1000.0), &send_index);
comm_can_transmit_eid(controller_id |
((uint32_t)CAN_PACKET_SET_CURRENT << 8), buffer, send_index);
}