標(biāo)題: 圓弧插補(bǔ),直線插補(bǔ) 51單片機(jī)能夠同時(shí)控制兩個(gè)步進(jìn)電機(jī)正反轉(zhuǎn) [打印本頁]

作者: 朱青竹    時(shí)間: 2017-5-3 00:31
標(biāo)題: 圓弧插補(bǔ),直線插補(bǔ) 51單片機(jī)能夠同時(shí)控制兩個(gè)步進(jìn)電機(jī)正反轉(zhuǎn)
急求!急求!步進(jìn)電機(jī)是兩個(gè)45bf005-2型反應(yīng)式步進(jìn)電機(jī),驅(qū)動用ULN2003a,51單片機(jī)能夠同時(shí)控制兩個(gè)步進(jìn)電機(jī)正反轉(zhuǎn),畫圓弧,可以的話可以給報(bào)酬的。謝謝!
作者: yzwzfyz    時(shí)間: 2017-5-3 01:34
單片機(jī)不僅可以控制兩個(gè)電機(jī)正反轉(zhuǎn),再多也行啊。
作者: 朱青竹    時(shí)間: 2017-5-3 06:56
我只知道一個(gè)的#include<reg52.h>#define uchar unsigned char#define uint  unsigned int#define MotorData P0                    //步進(jìn)電機(jī)控制接口定義uchar phasecw[3] ={0x04,0x02,0x01};//正轉(zhuǎn) 電機(jī)導(dǎo)通相序 C-B-Auchar phaseccw[3]={0x01,0x02,0x04};//反轉(zhuǎn) 電機(jī)導(dǎo)通相序 A-B-C//ms延時(shí)函數(shù)void Delay_xms(uint x){ uint i,j; for(i=0;i<x;i++)  for(j=0;j<112;j++);}//順時(shí)針轉(zhuǎn)動void MotorCW(void){ uchar i; for(i=0;i<3;i++)  {   MotorData=phasecw[i];   Delay_xms(3);//轉(zhuǎn)速調(diào)節(jié)  }}//逆時(shí)針轉(zhuǎn)動void MotorCCW(void){ uchar i; for(i=0;i<3;i++)  {   MotorData=phaseccw[i];   Delay_xms(3);//轉(zhuǎn)速調(diào)節(jié)  }}//停止轉(zhuǎn)動void MotorStop(void){ MotorData=0x00;}//主函數(shù)void main(void){ uint i; Delay_xms(50);//等待系統(tǒng)穩(wěn)定 while(1) {  for(i=0;i<500;i++)  {   MotorCW();   //順時(shí)針轉(zhuǎn)動  }   MotorStop();  //停止轉(zhuǎn)動  Delay_xms(500);  for(i=0;i<500;i++)  {   MotorCCW();  //逆時(shí)針轉(zhuǎn)動  }   MotorStop();  //停止轉(zhuǎn)動  Delay_xms(500);   }}
作者: 朱青竹    時(shí)間: 2017-5-3 06:56
有沒有具體的程序啊
作者: 朱青竹    時(shí)間: 2017-5-3 07:00
yzwzfyz 發(fā)表于 2017-5-3 01:34
單片機(jī)不僅可以控制兩個(gè)電機(jī)正反轉(zhuǎn),再多也行啊。

#include<reg52.h>#define uchar unsigned char#define uint  unsigned int#define MotorData P0                    //步進(jìn)電機(jī)控制接口定義uchar phasecw[3] ={0x04,0x02,0x01};//正轉(zhuǎn) 電機(jī)導(dǎo)通相序 C-B-Auchar phaseccw[3]={0x01,0x02,0x04};//反轉(zhuǎn) 電機(jī)導(dǎo)通相序 A-B-C//ms延時(shí)函數(shù)void Delay_xms(uint x){ uint i,j; for(i=0;i<x;i++)  for(j=0;j<112;j++);}//順時(shí)針轉(zhuǎn)動void MotorCW(void){ uchar i; for(i=0;i<3;i++)  {   MotorData=phasecw;   Delay_xms(3);//轉(zhuǎn)速調(diào)節(jié)  }}//逆時(shí)針轉(zhuǎn)動void MotorCCW(void){ uchar i; for(i=0;i<3;i++)  {   MotorData=phaseccw;   Delay_xms(3);//轉(zhuǎn)速調(diào)節(jié)  }}//停止轉(zhuǎn)動void MotorStop(void){ MotorData=0x00;}//主函數(shù)void main(void){ uint i; Delay_xms(50);//等待系統(tǒng)穩(wěn)定 while(1) {  for(i=0;i<500;i++)  {   MotorCW();   //順時(shí)針轉(zhuǎn)動  }   MotorStop();  //停止轉(zhuǎn)動  Delay_xms(500);  for(i=0;i<500;i++)  {   MotorCCW();  //逆時(shí)針轉(zhuǎn)動  }   MotorStop();  //停止轉(zhuǎn)動  Delay_xms(500);   }}我只知道控制一個(gè)的,你有沒有具體的控制兩個(gè)電機(jī)的程序啊
作者: 2441982213    時(shí)間: 2022-11-24 21:50
有沒有具體的程序啊
作者: TTQ001    時(shí)間: 2022-11-25 01:57
http://www.torrancerestoration.com/bbs/dpj-34111-1.html
http://www.torrancerestoration.com/bbs/dpj-51834-1.html
http://www.torrancerestoration.com/bbs/dpj-220045-1.html




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1