![]() |
miniFOC 1.0.3
This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.
|
this is the header file of encoder.c. More...
Go to the source code of this file.
Functions | |
void | encoder_zeroing (void) |
correct the mechanical angle zero deviation between the magnetic encoder and FOC. More... | |
unsigned short | encoder_get_mechanical_angle (void) |
read mechanical angle directly from encoder More... | |
float | encoder_get_electronic_angle (void) |
according to the electrical angle calculated from the mechanical angle, this function will call encoder_get_mechanical_angle() function. More... | |
void | encoder_update_speed (void) |
called every 2 milliseconds to calculate the speed. More... | |
Variables | |
volatile unsigned short | machine_angle_offset |
mechanical angle offset, which is used to align the mechanical angle with the zero point of the electrical angle. More... | |
this is the header file of encoder.c.
Definition in file encoder.h.
float encoder_get_electronic_angle | ( | void | ) |
according to the electrical angle calculated from the mechanical angle, this function will call encoder_get_mechanical_angle() function.
register | raw data reading back |
Definition at line 93 of file encoder.c.
References ELECANGLE_COEFFICIENT, encoder_get_mechanical_angle(), ENCODER_RESO, FOC_Struct, MECHANGLE_COEFFICIENT, FOC_Structure_t::mechanical_angle, and POLAR_PAIRS.
Referenced by TIMER2_IRQHandler().
unsigned short encoder_get_mechanical_angle | ( | void | ) |
read mechanical angle directly from encoder
register | raw data reading back |
Definition at line 76 of file encoder.c.
References encoder_read_data(), ENCODER_RESO, last_mechanical_angle, machine_angle_offset, and total_machine_angle.
Referenced by encoder_get_electronic_angle(), and foc_calibrate_phase().
void encoder_update_speed | ( | void | ) |
called every 2 milliseconds to calculate the speed.
Definition at line 106 of file encoder.c.
References filter_update_value(), FOC_Struct, FOC_Structure_t::rotate_speed, systick_mechanical_angle_last, total_machine_angle, and velocity_filter.
Referenced by SysTick_Handler().
void encoder_zeroing | ( | void | ) |
correct the mechanical angle zero deviation between the magnetic encoder and FOC.
Definition at line 119 of file encoder.c.
References CALI_TORQUE, delayms(), encoder_read_data(), foc_calculate_dutycycle(), machine_angle_offset, total_machine_angle, and update_pwm_dutycycle().
Referenced by main().
|
extern |
mechanical angle offset, which is used to align the mechanical angle with the zero point of the electrical angle.
Definition at line 23 of file encoder.c.
Referenced by encoder_get_mechanical_angle(), encoder_zeroing(), flash_read_parameters(), flash_write_parameters(), and report_local_variable().