標(biāo)題:
步進(jìn)電機(jī)正反轉(zhuǎn)程序
[打印本頁]
作者:
chf
時(shí)間:
2017-4-25 16:56
標(biāo)題:
步進(jìn)電機(jī)正反轉(zhuǎn)程序
#include <reg52.h>
unsigned char code F_Rotation[4]={0x02,0x04,0x08,0x10};//正轉(zhuǎn)表格
unsigned char code B_Rotation[4]={0x10,0x08,0x040,0x02};//反轉(zhuǎn)表格
void Delay(unsigned int i)//延時(shí)
{
while(--i);
}
main()
{
unsigned char i;
while(1)
{
for(i=0;i<4;i++) //4相
{
P1=F_Rotation[i]; //輸出對(duì)應(yīng)的相 可以自行換成反轉(zhuǎn)表格
Delay(500); //改變這個(gè)參數(shù)可以調(diào)整電機(jī)轉(zhuǎn)速
}
}
}
復(fù)制代碼
作者:
啊哈哈000
時(shí)間:
2017-5-4 08:08
有沒有原理圖啊
作者:
10507018217
時(shí)間:
2017-6-5 19:50
啊哈哈000 發(fā)表于 2017-5-4 08:08
有沒有原理圖啊
我有
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1