在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            關(guān) 閉

            新聞中心

            EEPW首頁 > 工控自動(dòng)化 > 設(shè)計(jì)應(yīng)用 > 步進(jìn)電機(jī)控制程序(c語言+51單片機(jī))

            步進(jìn)電機(jī)控制程序(c語言+51單片機(jī))

            作者: 時(shí)間:2011-05-01 來源:網(wǎng)絡(luò) 收藏

            void ext_int0(void) interrupt 0 { /* 主 齒輪 中斷 */
            uint tmp;
            EA = 0;
            if( !pri_dj ){
            round_num ++;
            if (round_num % Chilun_Num == 0 ){
            one_round_flg = 1;
            tmp = round_num / Chilun_Num ;
            set_display_num();
            P0 = 0xf0;
            P0 = P0 | LEDBuf[0] ;
            led_1000 = 0;
            P0 |= 0xf0;

            本文引用地址:http://www.biyoush.com/article/162126.htm

            P0 = 0xf0;
            P0 = P0 | LEDBuf[1] ;
            led_100 = 0;
            P0 |= 0xf0;

            P0 = 0xf0;
            P0 = P0 | LEDBuf[2] ;
            led_10 = 0;
            P0 |= 0xf0;

            P0 = 0xf0;
            P0 = P0 | LEDBuf[3] ;
            led_1 = 0;
            P0 |= 0xf0;

            P0 = 0xf0;
            }
            if ( round_num >= set_round_num ) Dj_stop();
            }
            EA = 0x81;
            }

            void display(){
            uchar i;
            uint tmp = 0;
            tmp = round_num / Chilun_Num ;
            set_display_num();
            for(i = 0; i LEDLen ; i ++){
            P0 = 0xf0;
            P0 = P0 | LEDBuf[i] ;
            if(i==0) led_1000 = 0; //P0^4
            if(i==1) led_100 = 0; //P0^5
            if(i==2) led_10 = 0; //P0^6
            if(i==3) led_1 = 0; //P0^7
            P0 |= 0xf0;
            }
            P0 = 0xf0;
            }

            void read_num(){
            /* 讀播碼盤 到 set_round_num ,set_pwm_width */
            uchar tmp;
            P2 = 0xFF;
            P2 = 0xEF; // 1110 1111
            delay ( 1ms );
            tmp = ~(P2 | 0xF0);

            P2 = 0xDF; // 1101 1111
            delay ( 1ms );
            tmp = (~(P2 | 0xF0 )) * 10 + tmp;
            set_round_num = tmp;

            P2 = 0xBF; // 1011 1111
            delay ( 1ms );
            tmp = (~(P2 | 0xF0));

            P2 = 0x7F; // 0111 1111
            delay ( 1ms );
            tmp = (~(P2 | 0xF0)) * 10 + tmp;

            set_round_num = set_round_num + tmp * 100;
            set_round_num = set_round_num * Chilun_Num;

            P2 = 0xFF;
            P1 = 0xbF; // 0111 1111
            delay ( 1ms );
            tmp = ~(P2 | 0xF0) ;

            P1 = 0xFF;
            P2 = 0xFF;
            P1 = 0x7F; // 1011 1111
            delay ( 1ms );
            tmp = (~(P2 | 0xF0)) * 10 + tmp ;
            set_pwm_width = tmp ;

            P1 = 0xFF;
            P2 = 0xFF;
            }

            void fx_run(){
            #define f_Delay_time 180
            while ( bujin_fx_stop ) { /* 反向 回車 直到 傳感器 動(dòng)作*/
            P1 = 0xf3; //0011
            delay ( f_Delay_time );
            P1 = 0xf6; //0110
            delay ( f_Delay_time );
            P1 = 0xfc; //1100
            delay ( f_Delay_time );
            P1 = 0xf9; //1001
            delay ( f_Delay_time );
            }
            P1 = 0xff;
            }

            51單片機(jī)相關(guān)文章:51單片機(jī)教程


            c語言相關(guān)文章:c語言教程



            上一頁 1 2 下一頁

            評論


            相關(guān)推薦

            技術(shù)專區(qū)

            關(guān)閉