基于STM32F4开发的FOC算法无刷电机驱动源码,有C和C++代码,能直接用于项目。//进入转矩模式 void enter_torque_mode(void){ drv.enable_gd(); //gpio.enable->write(1); controller.ovp_flag = 0; reset_foc(&controller); // Tesets integrators, and other control loop parameters wait(.001); controller.i_d_ref = 0; controller.i_q_ref = 0; // Current Setpoints gpio.led->write(1); // Turn on status LED state_change = 0; printf("\n\r Entering Motor Mode \n\r"); } //校准编码器位置 void calibrate(void){ drv.enable_gd(); //gpio.enable->write(1); gpio.led->write(1); // Turn on status LED order_phases(&spi, &gpio, &controller, &prefs); // Check phase ordering calibrate(&spi, &gpio, &controller, &prefs); // Perform calibration procedure gpio.led->write(0);; // Turn off status LED wait(.2); printf("\n\r Calibration complete. Press 'esc' to return to menu\n\r"); drv.disable_gd(); //gpio.enable->write(0); state_change = 0; }
2021-05-09 16:48:21 89.75MB FOC驱动 STM32 无刷电机 单片机
1