欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 分享一個基于MSP430F149的步進電機入門教程,附Lv8731驅動芯片及驅動手冊 [打印本頁]

作者: 小白一個呀    時間: 2021-8-4 21:05
標題: 分享一個基于MSP430F149的步進電機入門教程,附Lv8731驅動芯片及驅動手冊
#include  <msp430x14x.h>

#define Step_A P4OUT=0xfe;
#define Step_B P4OUT=0xfd;
#define Step_C P4OUT=0xfb;
#define Step_D P4OUT=0xf7;

#define Step_AB P4OUT=0xfc;
#define Step_BC P4OUT=0xf9;
#define Step_CD P4OUT=0xf3;
#define Step_DA P4OUT=0xf6;

#define Step_OFF P4OUT=0xf0;

unsigned char a[4]={0xfe,0xfd,0xfb,0xf7},i;


void DelayUs2x(unsigned char t);
void DelayMs(unsigned char t);

/********************主函數**********************/
void main(void)
{
       unsigned char temp;
       unsigned int Speed;               //旋轉一周時間
       Speed=4;
      
       WDTCTL = WDTPW + WDTHOLD;                    // 關狗
      
    /*------選擇系統主時鐘為8MHz-------*/
       BCSCTL1 &= ~XT2OFF;                          //打開XT2高頻晶體振蕩器
       do
        {
        IFG1 &= ~OFIFG;                             //清除晶振失敗標志
        for (temp = 0xFF; temp > 0; temp--);        //等待8MHz晶體起振
        }
       while ((IFG1 & OFIFG));                      //等待晶振運行起來
       BCSCTL2 |= SELM1 + SELS + DIVM_3 +DIVS_3;
      
       P1DIR = 0xff;P1OUT = 0xff;
       P2DIR = 0xff;P2OUT = 0xff;
       P3DIR = 0xff;P3OUT = 0xff;
       P4DIR = 0xff;P4OUT = 0xff;
       P5DIR = 0xff;P5OUT = 0xff;
       P6DIR = 0xff;P6OUT = 0xff;


       while(1)
        {
            /*Step_AB               
            DelayMs(Speed);                    //電機轉速調整,數字越小,轉速越快
            Step_BC                           //四相八拍運行方式即 A-AB-B-BC-C-CD-D-DA-A.
            DelayMs(Speed);
            Step_CD
            DelayMs(Speed);
            Step_DA
            DelayMs(Speed);*/
            
                 /*Step_A               
                 DelayMs(Speed);                    //電機轉速調整,數字越小,轉速越快
                 Step_AB                            //四相四拍運行方式
                 DelayMs(Speed);
                 Step_B
                 DelayMs(Speed);
                 Step_BC
                 DelayMs(Speed);
                 Step_C
                 DelayMs(Speed);
                 Step_CD
                 DelayMs(Speed);
                 Step_D
                 DelayMs(Speed);
                 Step_DA
                 DelayMs(Speed);*/
              
                 Step_DA               
                 DelayMs(Speed);                    //電機轉速調整,數字越小,轉速越快
                 Step_D                            //四相四拍運行方式
                 DelayMs(Speed);
                 Step_CD
                 DelayMs(Speed);
                 Step_C
                 DelayMs(Speed);
                 Step_BC
                 DelayMs(Speed);
                 Step_B
                 DelayMs(Speed);
                 Step_AB
                 DelayMs(Speed);
                 Step_A
                 DelayMs(Speed);
         
          /*for(i=0;i<4;i++)
          {
            P4OUT=a[ i];
            DelayMs(Speed);
          }*/
         
         
         
         
        }
}







/*------------------------------------------------
uS延時函數,大致延時
長度 T=tx2+5 uS
------------------------------------------------*/
void DelayUs2x(unsigned char t)
{   
while(--t);
}
/*------------------------------------------------
mS延時函數
------------------------------------------------*/
void DelayMs(unsigned char t)
{
     
while(t--)
{
     //大致延時1mS
     DelayUs2x(245);
     DelayUs2x(245);
}
}

屏幕截圖 2021-08-04 205654.png (9.63 KB, 下載次數: 146)

屏幕截圖 2021-08-04 205654.png

屏幕截圖 2021-08-04 205615.png (154.46 KB, 下載次數: 137)

屏幕截圖 2021-08-04 205615.png

430F149步進.rar

5.03 MB, 下載次數: 18, 下載積分: 黑幣 -5


作者: ht星海    時間: 2021-9-14 17:34
有MSP430F149的中文用戶手冊嗎?
作者: ht星海    時間: 2021-9-14 17:35
MSP430F149的用戶手冊有嗎?

作者: ht星海    時間: 2021-9-15 20:29
你們用的啥IDE?




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