加入星計(jì)劃,您可以享受以下權(quán)益:

  • 創(chuàng)作內(nèi)容快速變現(xiàn)
  • 行業(yè)影響力擴(kuò)散
  • 作品版權(quán)保護(hù)
  • 300W+ 專業(yè)用戶
  • 1.5W+ 優(yōu)質(zhì)創(chuàng)作者
  • 5000+ 長(zhǎng)期合作伙伴
立即加入

基于51單片機(jī)的舞蹈機(jī)器人步進(jìn)機(jī)仿真設(shè)計(jì)

09/27 08:55
981
服務(wù)支持:
技術(shù)交流群

完成交易后在“購買成功”頁面掃碼入群,即可與技術(shù)大咖們分享疑惑和經(jīng)驗(yàn)、收獲成長(zhǎng)和認(rèn)同、領(lǐng)取優(yōu)惠和紅包等。

虛擬商品不可退

當(dāng)前內(nèi)容為數(shù)字版權(quán)作品,購買后不支持退換且無法轉(zhuǎn)移使用。

加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點(diǎn)資訊討論
放大
實(shí)物圖
相關(guān)方案
  • 方案介紹
  • 相關(guān)文件
  • 相關(guān)推薦
  • 電子產(chǎn)業(yè)圖譜
申請(qǐng)入駐 產(chǎn)業(yè)圖譜

部分程序:

#include "reg51.h"

#include "intrins.H"

//8步式步進(jìn)電機(jī)脈沖序列

//unsigned char steps[8] = {0x77,0x33,0xbb,0x99,0xdd,0xcc,0xee,0x66};

unsigned char steps[8] = {0x2,0x6,0x4,0xc,0x8,0x9,0x1,0x3};

//當(dāng)前各電機(jī)在上述序列中的位置

unsigned char cur_step[8] = {0,0,0,0,0,0,0,0};

//這個(gè)文件用于記錄舞步信息序列

char speed_tickers[8] = {0,0,0,0,0,0,0,0};

//從上述文件中讀出的當(dāng)前舞步信息

unsigned char speeds[8] = {0,0,0,0,0,0,0,0};

unsigned char data_pointer = 0;//指向舞步數(shù)據(jù)的指針

unsigned char time_t = 0;//指定重新讀取一次 speeds 值的計(jì)時(shí)周期

code char dancedata[] = {54,15,12,12,87,95,65,45,-89,-88,-54,-54,54,68,-45,-65,-65,-48,101,121,115,117,19,

-98,-100,-21,-114,-101,-24,-98,95,102,102,100,130,30,10,-90,-120,87,102,103,105,109,104,-30,-102,-104,-106,110,100,

54,15,12,12,87,95,65,45,-89,-88,-54,-54,-98,95,102,102,100,130,30,10,-90,-120,87,102-114,-101,-24,-98,95,102,102,

100,130,30,10,-90,-120,87,102,102,100,130,30,10,-90,-120,87,102,103,105,54,15,12,12,87,95,65,45,-89,-88,-54,

-98,-100,-21,-114,-101,-24,-98,95,102,102,100,130,30,10,-90,-120,87,102,103,105,12,87,95,65,45,-89,-88,-54,

-98,-100,-21,-114,-101,-24,-98,95,102,102,100,130,30,10,-90,-120,87,102,103,105,109,104,-30,-102,-104,-106,110,

100,130,30,10,-90,-120,87,102,102,100,130,30,10,-90,-120,87,-120,87,102,103,105,109,104,-30,-102,-104,-106,110,

54,15,12,12,87,95,65,45,-89,-88,-54,-54,-98,95,102,102,100,130,30,10,-90,-120,87,102-114,-101,-24,-98,95,102,102,

54,15,12,12,87,95,65,45,-89,-88,-54,-54,-98,95,102,102,100,130,30,10,-90,-120,87,102-114,-101,-24,-98,95,102,102,

54,15,12,12,87,95,65,45,-89,-88,-54,-54,-98,95,102,102,100,130,30,10,-90,-120,87,102-114,-101,-24,-98,95,102,102,

54,15,12,12,87,95,65,45,-89,-88,-54,-54,-98,95,102,102,100,130,30,10,-90,-120,87,102-114,-101,-24,-98,95,102,102,

-98,-100,-21,-114,-101,-24,-98,95,102,102,100,130,30,10,-90,-120,87,102,103,105,12,87,95,65,45,-89,-88,-54,

-98,-100,-21,-114,-101,-24,-98,95,102,102,100,130,30,10,-90,-120,87,102,103,105,12,87,95,65,45,-89,-88,-54,

-98,-100,-21,-114,-101,-24,-98,95,102,102,100,130,30,10,-90,-120,87,102,103,105,12,87,95,65,45,-89,-88,-54,

};

code char pin[8] = {1,2,4,8,16,32,64,128};

char MAX_SPEED_TICKER = 120;

unsigned char i; //電機(jī)序號(hào)

void SetAllSpeeds(void)? //設(shè)置各電機(jī)的速度,并讓它運(yùn)動(dòng)起來

{

char delta;? //旋轉(zhuǎn)方向 1:正 -1:反? 0:停

for(i=0;i<8;i++)

{

P2=pin[i]; //發(fā)送鎖存信號(hào)

speed_tickers[i] += speeds[i]; //計(jì)數(shù)值增加 speed[i]越高,增加得越多

if(speed_tickers[i] >= MAX_SPEED_TICKER) //如果計(jì)數(shù)值超過預(yù)定最大值,就發(fā)送脈沖

{

speed_tickers[i] = 0;

delta = 1;

}

{

speed_tickers[i] = 0;

delta = -1;

}

else delta = 0;

cur_step[i] += delta;

cur_step[i] &= 0x07; //計(jì)算當(dāng)前應(yīng)發(fā)脈沖

P0 = steps[cur_step[i]];

P2 = 0;

}

}

void main()? //程序的入口

{

InitTimer();? //初始化后等中斷

while(1);

}

 

  • 有需要資料的可了解一下.docx

相關(guān)推薦

電子產(chǎn)業(yè)圖譜