標(biāo)題:
電機(jī)位置閉環(huán)控制(STM32F1)
[打印本頁(yè)]
作者:
lijinghu
時(shí)間:
2020-1-7 13:07
標(biāo)題:
電機(jī)位置閉環(huán)控制(STM32F1)
電機(jī)位置閉[attach]216383[/attach]
環(huán)控制(STM32F1)
單片機(jī)源程序如下:
#include "sys.h"
u8 Flag_Stop=1; //停止標(biāo)志位
int Encoder,Position=10000; //編碼器的脈沖計(jì)數(shù)
long SHOW;
int Moto1; //電機(jī)PWM變量 應(yīng)是Motor的 向Moto致敬
int main(void)
{
Stm32_Clock_Init(9); //系統(tǒng)時(shí)鐘設(shè)置
delay_init(72); //延時(shí)初始化
LED_Init(); //初始化與 LED 連接的硬件接口
uart_init(72,115200); //初始化串口1
MiniBalance_PWM_Init(7199,0); //=====初始化PWM 10KHZ 高頻可以防止電機(jī)低頻時(shí)的尖叫聲
Encoder_Init_TIM2(); //初始化編碼器
Timer3_Init(99,7199); //=====10MS進(jìn)一次中斷服務(wù)函數(shù),中斷服務(wù)函數(shù)在control.c
while(1)
{
printf("Encoder:%d Position:%d \r\n",Encoder,Position);
}
}
復(fù)制代碼
原理圖: 無(wú)
仿真: 無(wú)
代碼:
電機(jī)位置閉環(huán)控制(代碼詳細(xì)注釋,F(xiàn)1寄存器版本).7z
(122.53 KB, 下載次數(shù): 26)
2020-1-7 14:48 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1