RL78/G1G Sensorless Speed control of 120-degree conducting controlled permanent magnetic synchronous motor (Implementation)
R01AN3582EJ0100 Rev.1.00
Page 25 of 46
Jan 13, 2017
Table 3-13
List of Functions “mtr_gmc.c”
File name
Function name
Process overview
mtr_gmc.c
mtr_get_vdc
Input: None
Output: (int16) s2_temp / the bus voltage value
Obtain the bus voltage
mtr_check_over_voltage_error
Input: (int16) s2_vdc / bus voltage value
(int16) s2_limit_voltage / over voltage limit
Output: (uint16) u2_temp0 / over voltage error flag (when error happens)
Check over voltage error
mtr_check_under_voltage_error
Input: (int16) s2_vdc / bus voltage value
(int16) s2_limit_voltage / under voltage limit
Output: (uint16) u2_temp0 / under voltage error flag (when error happens)
Check low voltage error
mtr_check_over_speed_error
Input: (uint16) u2_speed_rad / rotational speed
(uint16) u2_speed_limit / speed limit
Output: (uint16) u2_temp0 / over speed error flag (when error happens)
Check over speed error
mtr_get_duty
Input: (volatile int16) s2_v_ref / reference voltage
(volatile int16) s2_vdc_ad / bus voltage A/D conversion value
Output: (int16) s2_temp / rate of PWM duty
Calculate PWM duty
mtr_generate_pattern
Input: (uint16) u2_vu_ad / U phase voltage A/D conversion value
(uint16) u2_vv_ad / V phase voltage A/D conversion value
(uint16) u2_vw_ad / W phase voltage A/D conversion value
(uint16) u2_vn_ad / 3 phase average A/D conversion value
Output: (uint8) u1_temp / pseudo Hall sensor pattern
Generate pseudo Hall
sensor pattern
mtr_check_timeout_error
Input: (uint16) u2_cnt_timeout / counter of timeout
(uint16) u2_timeout_limit / timeout limit
Output: (uint16) u2_temp0 / flag of timeout error (when error happens)
Check timeout error