16    unsigned int upload_var[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 
   17    unsigned char buffer[8] = {0, 0, 0, 0, 0, 0, 0, 0};
 
   46    for (
unsigned char counter = 0; counter < 5; ++counter) {
 
   48        buffer[0] = (
unsigned char) ((upload_var[counter * 2] >> 24UL) & 0x000000ffUL);
 
   49        buffer[1] = (
unsigned char) ((upload_var[counter * 2] >> 16UL) & 0x000000ffUL);
 
   50        buffer[2] = (
unsigned char) ((upload_var[counter * 2] >> 8UL) & 0x000000ffUL);
 
   51        buffer[3] = (
unsigned char) (upload_var[counter * 2] & 0x000000ffUL);
 
   54        buffer[4] = (
unsigned char) ((upload_var[counter * 2 + 1] >> 24UL) & 0x000000ffUL);
 
   55        buffer[5] = (
unsigned char) ((upload_var[counter * 2 + 1] >> 16UL) & 0x000000ffUL);
 
   56        buffer[6] = (
unsigned char) ((upload_var[counter * 2 + 1] >> 8UL) & 0x000000ffUL);
 
   57        buffer[7] = (
unsigned char) (upload_var[counter * 2 + 1] & 0x000000ffUL);
 
   70    unsigned char buffer[8] = {0, 0, 0, 0, 0, 0, 0, 0};
 
   77    buffer[0] = (
unsigned char) ((velocity >> 24UL) & 0x000000ffUL);
 
   78    buffer[1] = (
unsigned char) ((velocity >> 16UL) & 0x000000ffUL);
 
   79    buffer[2] = (
unsigned char) ((velocity >> 8UL) & 0x000000ffUL);
 
   80    buffer[3] = (
unsigned char) (velocity & 0x000000ffUL);
 
   83    buffer[4] = (
unsigned char) ((angle >> 24UL) & 0x000000ffUL);
 
   84    buffer[5] = (
unsigned char) ((angle >> 16UL) & 0x000000ffUL);
 
   85    buffer[6] = (
unsigned char) ((angle >> 8UL) & 0x000000ffUL);
 
   86    buffer[7] = (
unsigned char) (angle & 0x000000ffUL);
 
volatile unsigned short machine_angle_offset
mechanical angle offset, which is used to align the mechanical angle with the zero point of the elect...
 
unsigned char foc_parameter_available_flag
flag variable for FOC parameter availability
 
volatile FOC_Structure_t FOC_Struct
FOC handler.
 
volatile unsigned char phase_sequence
motor phase sequence flag variable
 
#define led_toggle()
flip the LED pin level
 
main function Header File
 
volatile unsigned char pid_control_mode_flag
flag variable of PID closed loop mode
 
unsigned char pid_parameter_available_flag
flag variable for PID parameter availability
 
volatile PID_Structure_t angle_pid_handler
algorithm handler of PID angle loop
 
volatile PID_Structure_t speed_pid_handler
algorithm handler of PID speed loop
 
#define ANGLE_LOOP_CONTROL
angle loop control mode
 
#define TORQUE_LOOP_CONTROL
torque loop control mode
 
#define SPEED_LOOP_CONTROL
speed loop control mode
 
void report_local_variable(void)
report PID parameters and current user settings
 
void report_angle_speed(void)
report angle and speed using medium capacity transport protocol
 
float user_expect
user expect value of miniFOC
 
float rotate_speed
motor rotate speed calculate from timer
 
float mechanical_angle
mechanical angle read form encoder
 
float ki
integral term coefficient in PID
 
float kp
proportional term coefficient in PID
 
float sum_maximum
maximum of anti saturation integral in PID
 
float expect
user expectations in PID
 
float kd
differential term coefficient in PID
 
unsigned int float_to_int32(float data0)
convert floating point numbers to int32 type data
 
void delayms(unsigned long count)
millisecond delay function, any time time.
 
void mdtp_data_transmit(unsigned char pid, const unsigned char *buffer)
medium capacity data transmission protocol packing function