找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2157|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

單片機步進電機仿真89c51+uln2004a

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:469684 發(fā)表于 2020-5-9 22:25 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
  1. #include<reg51.h>
  2. #include<absacc.h>
  3. #define uint unsigned int
  4. #define uchar unsigned char
  5. void delay(uint x);
  6. void out(char state)
  7. {
  8.         code uchar table[]={0x03,0x09,0x0c,0x06}; //反轉(zhuǎn)
  9. //        code uchar table[]={0x03,0x06,0x0C,0x09};//正轉(zhuǎn)
  10.         P1=table[state];
  11. //        PORT=table[state];
  12.         delay(8);
  13. }


  14. uchar phase=0;
  15. //out(uchar x);
  16. void main()
  17. {
  18.         for(;;)
  19.         {
  20.                 out(phase=++phase&0x03);//調(diào)用輸出函數(shù)
  21.         }
  22. }

  23. void delay(uint x)
  24. {
  25.         uchar j;
  26.         while(x-->0)
  27.         {
  28.                 for(j=0;j<125;j++)
  29.                 {;;}
  30.         }
  31. }
復(fù)制代碼


51hei截圖20200509222359.png (105.42 KB, 下載次數(shù): 41)

51hei截圖20200509222359.png

步進電機仿真.zip

38.39 KB, 下載次數(shù): 24, 下載積分: 黑幣 -5

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表