![]() |
BLDC control on ATAVRMC303 with ATxMega128A1
|

Go to the source code of this file.
Functions | |
| U8 | mc_control_current (U8 cur_cmd) |
| use to control current , current regulation loop need parameter : Kp_cur, Ki_cur ,Kd_cur and K_cur_scal in config_motor.h need to call in Te ms More... | |
| U8 | mc_control_speed (U8 speed_cmd) |
| use to control speed , speed regulation loop need parameter : Kp_speed, Ki_speed ,Kd_speed and K_speed_scal in config_motor.h need to call in Te ms More... | |
| U8 | mc_get_Duty_Cycle () |
| set type of regulation More... | |
| void | mc_regulation_loop () |
| launch speed control or no regulation More... | |
| void | mc_set_Current_Loop () |
| set type of regulation More... | |
| void | mc_set_Open_Loop () |
| set type of regulation More... | |
| void | mc_set_Speed_Loop () |
| set type of regulation More... | |
Variables | |
| S16 | cur_der = 0 |
| S16 | cur_derivative = 0 |
| S16 | cur_error = 0 |
| Error calculation. More... | |
| S16 | cur_integ = 0 |
| S16 | cur_integral = 0 |
| S16 | cur_proportional = 0 |
| U8 | duty_cycle = 0 |
| Parameter to set PWM Duty Cycle after regulation calculation. More... | |
| S16 | last_cur_error = 0 |
| Variable for the last error. More... | |
| S16 | last_speed_error = 0 |
| Variable for the last error. More... | |
| U8 | regulation_type = OPEN_LOOP |
| Define the type of regulation (OPEN_LOOP or CLOSE_LOOP) More... | |
| S16 | speed_der = 0 |
| S16 | speed_derivative = 0 |
| S16 | speed_error = 0 |
| Error calculation. More... | |
| S16 | speed_integ = 0 |
| S16 | speed_integral = 0 |
| S16 | speed_proportional = 0 |
| U8 mc_control_current | ( | U8 | cur_cmd | ) |
use to control current , current regulation loop need parameter : Kp_cur, Ki_cur ,Kd_cur and K_cur_scal in config_motor.h need to call in Te ms
Definition at line 103 of file mc_control.c.
References cur_error, cur_integ, cur_integral, cur_proportional, K_cur_scal, Ki_cur, Kp_cur, and mci_get_measured_current().
Referenced by mc_regulation_loop().

| U8 mc_control_speed | ( | U8 | speed_cmd | ) |
use to control speed , speed regulation loop need parameter : Kp_speed, Ki_speed ,Kd_speed and K_speed_scal in config_motor.h need to call in Te ms
Definition at line 48 of file mc_control.c.
References K_speed_scal, Ki_speed, Kp_speed, mci_get_measured_speed(), speed_error, speed_integ, speed_integral, and speed_proportional.
Referenced by mc_regulation_loop().

| U8 mc_get_Duty_Cycle | ( | ) |
set type of regulation
Definition at line 197 of file mc_control.c.
References duty_cycle.
Referenced by mc_switch_commutation(), mci_retry_run(), and mci_run().
| void mc_regulation_loop | ( | ) |
launch speed control or no regulation
Definition at line 159 of file mc_control.c.
References CURRENT_LOOP, duty_cycle, mc_control_current(), mc_control_speed(), mc_get_motor_speed(), mc_get_potentiometer_value(), OPEN_LOOP, regulation_type, and SPEED_LOOP.
Referenced by main(), mci_retry_run(), and mci_run().

| void mc_set_Current_Loop | ( | ) |
set type of regulation
Definition at line 189 of file mc_control.c.
References CURRENT_LOOP, and regulation_type.
| void mc_set_Open_Loop | ( | ) |
set type of regulation
Definition at line 175 of file mc_control.c.
References OPEN_LOOP, and regulation_type.
| void mc_set_Speed_Loop | ( | ) |
set type of regulation
Definition at line 182 of file mc_control.c.
References regulation_type, and SPEED_LOOP.
| S16 cur_der = 0 |
Definition at line 36 of file mc_control.c.
| S16 cur_derivative = 0 |
Definition at line 35 of file mc_control.c.
| S16 cur_error = 0 |
| S16 cur_integ = 0 |
Definition at line 33 of file mc_control.c.
Referenced by mc_control_current().
| S16 cur_integral = 0 |
Definition at line 32 of file mc_control.c.
Referenced by mc_control_current().
| S16 cur_proportional = 0 |
Definition at line 34 of file mc_control.c.
Referenced by mc_control_current().
| U8 duty_cycle = 0 |
Parameter to set PWM Duty Cycle after regulation calculation.
Definition at line 17 of file mc_control.c.
Referenced by mc_get_Duty_Cycle(), and mc_regulation_loop().
| S16 last_cur_error = 0 |
Variable for the last error.
Definition at line 31 of file mc_control.c.
| S16 last_speed_error = 0 |
Variable for the last error.
Definition at line 22 of file mc_control.c.
| U8 regulation_type = OPEN_LOOP |
Define the type of regulation (OPEN_LOOP or CLOSE_LOOP)
Definition at line 18 of file mc_control.c.
Referenced by mc_regulation_loop(), mc_set_Current_Loop(), mc_set_Open_Loop(), and mc_set_Speed_Loop().
| S16 speed_der = 0 |
Definition at line 27 of file mc_control.c.
| S16 speed_derivative = 0 |
Definition at line 26 of file mc_control.c.
| S16 speed_error = 0 |
| S16 speed_integ = 0 |
Definition at line 24 of file mc_control.c.
Referenced by mc_control_speed().
| S16 speed_integral = 0 |
Definition at line 23 of file mc_control.c.
Referenced by mc_control_speed().
| S16 speed_proportional = 0 |
Definition at line 25 of file mc_control.c.
Referenced by mc_control_speed().